Skip to content

Commit

Permalink
Type sharding: minor modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoszewnik committed Jan 11, 2017
1 parent bba6a3b commit 82ca191
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected void applyToChecksum(HollowChecksum checksum, BitSet populatedOrdinals
int shardOrdinal = ordinal / numShards;
int size = size(shardOrdinal);

checksum.applyInt(shardOrdinal);
checksum.applyInt(ordinal);
for(int i=0;i<size;i++)
checksum.applyInt(getElementOrdinal(shardOrdinal, i));
}
Expand All @@ -130,6 +130,6 @@ public long getApproximateHoleCostInBytes(BitSet populatedOrdinals, int shardNum
holeOrdinal = populatedOrdinals.nextClearBit(holeOrdinal + 1);
}

return (holeBits * (long)currentData.bitsPerListPointer) / 8;
return holeBits / 8;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ protected void applyToChecksum(HollowChecksum checksum, HollowSchema withSchema,
int ordinal = populatedOrdinals.nextSetBit(0);
while(ordinal != -1) {
if((ordinal & (numShards - 1)) == shardNumber) {
int translatedOrdinal = ordinal / numShards;
int shardOrdinal = ordinal / numShards;
checksum.applyInt(ordinal);
for(int i=0;i<fieldIndexes.length;i++) {
int fieldIdx = fieldIndexes[i];
if(!schema.getFieldType(fieldIdx).isVariableLength()) {
long bitOffset = fieldOffset(currentData, translatedOrdinal, fieldIdx);
long bitOffset = fieldOffset(currentData, shardOrdinal, fieldIdx);
int numBitsForField = currentData.bitsPerField[fieldIdx];
long fixedLengthValue = numBitsForField <= 56 ?
currentData.fixedLengthData.getElementValue(bitOffset, numBitsForField)
Expand All @@ -415,7 +415,7 @@ protected void applyToChecksum(HollowChecksum checksum, HollowSchema withSchema,
else
checksum.applyLong(fixedLengthValue);
} else {
checksum.applyInt(findVarLengthFieldHashCode(translatedOrdinal, fieldIdx));
checksum.applyInt(findVarLengthFieldHashCode(shardOrdinal, fieldIdx));
}
}
}
Expand Down Expand Up @@ -448,7 +448,7 @@ public long getApproximateHoleCostInBytes(BitSet populatedOrdinals, int shardNum
holeOrdinal = populatedOrdinals.nextClearBit(holeOrdinal + 1);
}

return (holeBits * (long)currentData.bitsPerRecord) / 8;
return holeBits / 8;
}

}

0 comments on commit 82ca191

Please sign in to comment.