Skip to content

Commit

Permalink
Type sharding: Revert min/max shard ordinal calculation, rename varia…
Browse files Browse the repository at this point in the history
…ble to enhance clarity
  • Loading branch information
dkoszewnik committed Jan 26, 2017
1 parent c27eeb2 commit 3ed20ff
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ private void gatherStatistics() {
int maxElementOrdinal = 0;

maxShardOrdinal = new int[numShards];
int minOrdinalsPerShard = (maxOrdinal + 1) / numShards;
int minRecordLocationsPerShard = (maxOrdinal + 1) / numShards;
for(int i=0;i<numShards;i++)
maxShardOrdinal[i] = (i < ((maxOrdinal + 1) & (numShards - 1))) ? minOrdinalsPerShard + 1 : minOrdinalsPerShard;
maxShardOrdinal[i] = (i < ((maxOrdinal + 1) & (numShards - 1))) ? minRecordLocationsPerShard : minRecordLocationsPerShard - 1;

ByteData data = ordinalMap.getByteData().getUnderlyingArray();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ private void gatherStatistics() {
int maxOrdinal = ordinalMap.maxOrdinal();

maxShardOrdinal = new int[numShards];
int minOrdinalsPerShard = (maxOrdinal + 1) / numShards;
int minRecordLocationsPerShard = (maxOrdinal + 1) / numShards;
for(int i=0;i<numShards;i++)
maxShardOrdinal[i] = (i < ((maxOrdinal + 1) & (numShards - 1))) ? minOrdinalsPerShard + 1 : minOrdinalsPerShard;
maxShardOrdinal[i] = (i < ((maxOrdinal + 1) & (numShards - 1))) ? minRecordLocationsPerShard : minRecordLocationsPerShard - 1;

int maxMapSize = 0;
ByteData data = ordinalMap.getByteData().getUnderlyingArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public void prepareForWrite() {
}

maxShardOrdinal = new int[numShards];
int minOrdinalsPerShard = (maxOrdinal + 1) / numShards;
int minRecordLocationsPerShard = (maxOrdinal + 1) / numShards;
for(int i=0;i<numShards;i++)
maxShardOrdinal[i] = (i < ((maxOrdinal + 1) & (numShards - 1))) ? minOrdinalsPerShard + 1 : minOrdinalsPerShard;
maxShardOrdinal[i] = (i < ((maxOrdinal + 1) & (numShards - 1))) ? minRecordLocationsPerShard : minRecordLocationsPerShard - 1;
}

private void discoverObjectFieldStatisticsForRecord(FieldStatistics fieldStats, int ordinal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ private void gatherStatistics() {
int maxOrdinal = ordinalMap.maxOrdinal();

maxShardOrdinal = new int[numShards];
int minOrdinalsPerShard = (maxOrdinal + 1) / numShards;
int minRecordLocationsPerShard = (maxOrdinal + 1) / numShards;
for(int i=0;i<numShards;i++)
maxShardOrdinal[i] = (i < ((maxOrdinal + 1) & (numShards - 1))) ? minOrdinalsPerShard + 1 : minOrdinalsPerShard;
maxShardOrdinal[i] = (i < ((maxOrdinal + 1) & (numShards - 1))) ? minRecordLocationsPerShard : minRecordLocationsPerShard - 1;

int maxSetSize = 0;
ByteData data = ordinalMap.getByteData().getUnderlyingArray();
Expand Down

0 comments on commit 3ed20ff

Please sign in to comment.