use of com.facebook.presto.orc.writer.StreamLayout.ByColumnSize in project presto by prestodb.
the class TestStreamLayout method testByColumnSize.
@Test
public void testByColumnSize() {
// Assume the file has 3 streams
// 1st Column( 1010), Data(1000), Present(10)
// 2nd column (1010), Dictionary (300), Present (10), Data(600), Length(100)
// 3rd Column > 2GB
List<StreamDataOutput> streams = new ArrayList<>();
streams.add(createStream(1, StreamKind.DATA, 1_000));
streams.add(createStream(1, StreamKind.PRESENT, 10));
streams.add(createStream(2, StreamKind.DICTIONARY_DATA, 300));
streams.add(createStream(2, StreamKind.PRESENT, 10));
streams.add(createStream(2, StreamKind.DATA, 600));
streams.add(createStream(2, StreamKind.LENGTH, 100));
streams.add(createStream(3, StreamKind.DATA, Integer.MAX_VALUE));
streams.add(createStream(3, StreamKind.PRESENT, Integer.MAX_VALUE));
Collections.shuffle(streams);
new ByColumnSize().reorder(streams);
Iterator<StreamDataOutput> iterator = streams.iterator();
verifyStream(iterator.next().getStream(), 1, StreamKind.PRESENT, 10);
verifyStream(iterator.next().getStream(), 1, StreamKind.DATA, 1000);
verifyStream(iterator.next().getStream(), 2, StreamKind.PRESENT, 10);
verifyStream(iterator.next().getStream(), 2, StreamKind.LENGTH, 100);
verifyStream(iterator.next().getStream(), 2, StreamKind.DICTIONARY_DATA, 300);
verifyStream(iterator.next().getStream(), 2, StreamKind.DATA, 600);
verifyStream(iterator.next().getStream(), 3, StreamKind.PRESENT, Integer.MAX_VALUE);
verifyStream(iterator.next().getStream(), 3, StreamKind.DATA, Integer.MAX_VALUE);
assertFalse(iterator.hasNext());
}
Aggregations