Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunjeet committed Nov 2, 2023
1 parent dfc4f79 commit bcdb800
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public boolean isNull(int ordinal, int fieldIndex) {
do {
shardsHolder = this.shardsVolatile;
shard = shardsHolder.shards[ordinal & shardsHolder.shardNumberMask];
fixedLengthValue = shard.isNull(ordinal >> shard.shardOrdinalShift, fieldIndex);
fixedLengthValue = shard.readValue(ordinal >> shard.shardOrdinalShift, fieldIndex);
} while(readWasUnsafe(shardsHolder, ordinal, shard));

switch(((HollowObjectSchema) schema).getFieldType(fieldIndex)) {
Expand Down Expand Up @@ -639,7 +639,7 @@ private boolean readWasUnsafe(ShardsHolder shardsHolder, int ordinal, HollowObje
HollowUnsafeHandle.getUnsafe().loadFence();
ShardsHolder currShardsHolder = shardsVolatile;
// Validate against the underlying shard so that, during a delta application that involves re-sharding the worst
// case no. of times a read will be invalidatedis 3: when shards are expanded or truncated, when a shard is affected
// case no. of times a read will be invalidated is 3: when shards are expanded or truncated, when a shard is affected
// by a split or join, and finally when delta is applied to a shard. If only shardsHolder was checked here, the
// worst-case scenario could lead to read invalidation (numShards+2) times: once for shards expansion/truncation, o
// nce for split/join on any shard, and then once when delta is applied.
Expand Down Expand Up @@ -699,9 +699,11 @@ public void ignoreUpdateThreadForSampling(Thread t) {

HollowObjectTypeDataElements[] currentDataElements() {
final HollowObjectTypeReadStateShard[] shards = this.shardsVolatile.shards;
return Arrays.stream(shards)
.map(shard -> shard.dataElements)
.toArray(HollowObjectTypeDataElements[]::new);
HollowObjectTypeDataElements[] elements = new HollowObjectTypeDataElements[shards.length];
for (int i=0;i<shards.length;i++) {
elements[i] = shards[i].dataElements;
}
return elements;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HollowObjectTypeReadStateShard {
this.dataElements = dataElements;
}

public long isNull(int ordinal, int fieldIndex) {
public long readValue(int ordinal, int fieldIndex) {
long bitOffset = fieldOffset(ordinal, fieldIndex);
int numBitsForField = dataElements.bitsPerField[fieldIndex];
return numBitsForField <= 56 ?
Expand Down

0 comments on commit bcdb800

Please sign in to comment.