Skip to content

Commit

Permalink
Restore private modifier, cleanup, more test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunjeet committed Oct 9, 2023
1 parent cbde6f3 commit 34d9a21
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public class HollowObjectTypeDataElements {
final long nullValueForField[];
int bitsPerRecord;

int bitsPerUnfilteredField[];
boolean unfilteredFieldIsIncluded[];
private int bitsPerUnfilteredField[];
private boolean unfilteredFieldIsIncluded[];

final ArraySegmentRecycler memoryRecycler;
final MemoryMode memoryMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,31 @@

import static org.junit.Assert.assertEquals;

import com.netflix.hollow.core.write.HollowObjectTypeWriteState;
import java.io.IOException;
import org.junit.Assert;
import org.junit.Test;

public class HollowObjectTypeDataElementsJoinerTest extends AbstractHollowObjectTypeDataElementsSplitJoinTest {
@Override
protected void initializeTypeStates() {
writeStateEngine.setTargetMaxTypeShardSize(16);
writeStateEngine.addTypeState(new HollowObjectTypeWriteState(schema));
}

@Test
public void testJoin() throws IOException {
HollowObjectTypeDataElementsJoiner joiner = new HollowObjectTypeDataElementsJoiner();

HollowObjectTypeReadState typeReadState = populateTypeStateWith(5);
HollowObjectTypeReadState typeReadState = populateTypeStateWith(1);
assertEquals(1, typeReadState.numShards());

HollowObjectTypeReadState typeReadStateSharded = populateTypeStateWith(5);
assertDataUnchanged(5);
assertEquals(8, typeReadStateSharded.numShards());

HollowObjectTypeDataElements joinedDataElements = joiner.join(typeReadStateSharded.currentDataElements());

HollowObjectTypeDataElements joinedDataElements = joiner.join(typeReadState.currentDataElements());
typeReadState.setCurrentData(joinedDataElements);
assertDataUnchanged(5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ public void testSplitThenJoinWithFilter() throws IOException {
}
}

@Test
public void testSplitThenJoinWithEmptyJoin() throws IOException {
HollowObjectTypeDataElementsSplitter splitter = new HollowObjectTypeDataElementsSplitter();

HollowObjectTypeReadState typeReadState = populateTypeStateWith(1);
assertEquals(1, typeReadState.numShards());

HollowObjectTypeDataElements[] splitBy4 = splitter.split(typeReadState.currentDataElements()[0], 4);
assertEquals(-1, splitBy4[1].maxOrdinal);
assertEquals(-1, splitBy4[3].maxOrdinal);

HollowObjectTypeDataElementsJoiner joiner = new HollowObjectTypeDataElementsJoiner();
HollowObjectTypeDataElements joined = joiner.join(new HollowObjectTypeDataElements[]{splitBy4[1], splitBy4[3]});

assertEquals(-1, joined.maxOrdinal);
}

// manually invoked
// @Test
public void testSplittingAndJoiningWithSnapshotBlob() throws Exception {
Expand Down

0 comments on commit 34d9a21

Please sign in to comment.