Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunjeet committed Aug 30, 2024
1 parent 197f82b commit deed160
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ public SegmentedLongArray(ArraySegmentRecycler memoryRecycler, long numLongs) {
public void set(long index, long value) {
int segmentIndex = (int)(index >> log2OfSegmentSize);
int longInSegment = (int)(index & bitmask);
try {
unsafe.putLong(segments[segmentIndex], (long) Unsafe.ARRAY_LONG_BASE_OFFSET + (8 * longInSegment), value);
} catch (ArrayIndexOutOfBoundsException e) {
throw e;
}
unsafe.putLong(segments[segmentIndex], (long) Unsafe.ARRAY_LONG_BASE_OFFSET + (8 * longInSegment), value);

/// duplicate the longs here so that we can read faster.
if(longInSegment == 0 && segmentIndex != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ private void gatherStatistics() {

for(int i=0;i<=maxOrdinal;i++) {
if(currentCyclePopulated.get(i) || previousCyclePopulated.get(i)) {
// SNAP: This is just some representation in ordinal map / pointerForData where
// lists are encoded as size of list, then var int rep. of each ordinal in the list record
long pointer = ordinalMap.getPointerForData(i);
int size = VarInt.readVInt(data, pointer); // no. of elements in list at ordinal i
int size = VarInt.readVInt(data, pointer);

pointer += VarInt.sizeOfVInt(size);

Expand All @@ -98,7 +96,7 @@ private void gatherStatistics() {
pointer += VarInt.sizeOfVInt(elementOrdinal);
}

totalOfListSizes[i & (numShards-1)] += size; // no. of elements aggregated over all list records per shard
totalOfListSizes[i & (numShards-1)] += size;
}
}

Expand All @@ -108,7 +106,7 @@ private void gatherStatistics() {
maxShardTotalOfListSizes = totalOfListSizes[i];
}

bitsPerElement = maxElementOrdinal == 0 ? 1 : 64 - Long.numberOfLeadingZeros(maxElementOrdinal); // max across all shards in type
bitsPerElement = maxElementOrdinal == 0 ? 1 : 64 - Long.numberOfLeadingZeros(maxElementOrdinal);

bitsPerListPointer = maxShardTotalOfListSizes == 0 ? 1 : 64 - Long.numberOfLeadingZeros(maxShardTotalOfListSizes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ private void addRecord(int... ordinals) {
writeStateEngine.add("TestList", rec);
}


protected HollowListTypeReadState populateTypeStateWith(int[][] listContents) throws IOException {
for (int[] list : listContents) {
populateWriteStateEngine(list);
}
// populateWriteStateEngine(numRecords);
populateWriteStateEngine(listContents);
roundTripSnapshot();
return (HollowListTypeReadState) readStateEngine.getTypeState("TestList");
Expand All @@ -73,13 +71,6 @@ protected void assertDataUnchanged(HollowListTypeReadState typeState, int[][] li
Assert.assertEquals(listContents[i][j], iter.next());
}
Assert.assertEquals(HollowOrdinalIterator.NO_MORE_ORDINALS, iter.next());
// System.out.println(obj.toString());
// assertEquals(i, obj.get("longField"));
// assertEquals("Value"+i, obj.getString("stringField"));
// assertEquals((double)i, obj.getDouble("doubleField"), 0);
// if (typeState.getSchema().numFields() == 4) { // filtered
// assertEquals(i, obj.getInt("intField"));
// }
}
}
}

0 comments on commit deed160

Please sign in to comment.