Search in sources :

Example 1 with ByStreamSize

use of com.facebook.presto.orc.writer.StreamLayout.ByStreamSize in project presto by prestodb.

the class TestStreamLayout method testByStreamSize.

@Test
public void testByStreamSize() {
    List<StreamDataOutput> streams = new ArrayList<>();
    int length = 10_000;
    for (int i = 0; i < 10; i++) {
        streams.add(createStream(i, StreamKind.PRESENT, length - i));
        streams.add(createStream(i, StreamKind.DATA, length - 100 - i));
    }
    Collections.shuffle(streams);
    new ByStreamSize().reorder(streams);
    assertEquals(streams.size(), 20);
    Iterator<StreamDataOutput> iterator = streams.iterator();
    for (int i = 9; i >= 0; i--) {
        verifyStream(iterator.next().getStream(), i, StreamKind.DATA, length - 100 - i);
    }
    for (int i = 9; i >= 0; i--) {
        verifyStream(iterator.next().getStream(), i, StreamKind.PRESENT, length - i);
    }
    assertFalse(iterator.hasNext());
}
Also used : ByStreamSize(com.facebook.presto.orc.writer.StreamLayout.ByStreamSize) ArrayList(java.util.ArrayList) StreamDataOutput(com.facebook.presto.orc.stream.StreamDataOutput) Test(org.testng.annotations.Test)

Aggregations

StreamDataOutput (com.facebook.presto.orc.stream.StreamDataOutput)1 ByStreamSize (com.facebook.presto.orc.writer.StreamLayout.ByStreamSize)1 ArrayList (java.util.ArrayList)1 Test (org.testng.annotations.Test)1