use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class ThriftIndexedTpchService method thriftPageToList.
private static List<List<String>> thriftPageToList(TrinoThriftPageResult page, int begin, int end) {
checkArgument(begin <= end, "invalid interval");
if (begin == end) {
// empty interval
return ImmutableList.of();
}
List<TrinoThriftBlock> blocks = page.getColumnBlocks();
List<List<String>> result = new ArrayList<>(blocks.size());
for (TrinoThriftBlock block : blocks) {
result.add(blockAsList(block, begin, end));
}
return result;
}
use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TestTrinoThriftBigint method testWriteBlockEmpty.
@Test
public void testWriteBlockEmpty() {
TrinoThriftBlock column = fromBlock(longBlock());
assertNotNull(column.getBigintData());
assertNull(column.getBigintData().getNulls());
assertNull(column.getBigintData().getLongs());
}
use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TestTrinoThriftBigint method testReadBlockWrongActualType.
@Test
public void testReadBlockWrongActualType() {
TrinoThriftBlock columnsData = integerData(new TrinoThriftInteger(null, null));
assertThatThrownBy(() -> columnsData.toBlock(BIGINT)).isInstanceOf(IllegalArgumentException.class).hasMessageMatching("type doesn't match:.*");
}
use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TestTrinoThriftBigint method testReadBlockAllNullsOption2.
@Test
public void testReadBlockAllNullsOption2() {
TrinoThriftBlock columnsData = longColumn(new boolean[] { true, true, true, true, true, true, true }, new long[] { 0, 0, 0, 0, 0, 0, 0 });
Block actual = columnsData.toBlock(BIGINT);
assertBlockEquals(actual, list(null, null, null, null, null, null, null));
}
use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TestTrinoThriftBigint method testReadBlockAllNonNullOption1.
@Test
public void testReadBlockAllNonNullOption1() {
TrinoThriftBlock columnsData = longColumn(null, new long[] { 2, 7, 1, 3, 8, 4, 5 });
Block actual = columnsData.toBlock(BIGINT);
assertBlockEquals(actual, list(2L, 7L, 1L, 3L, 8L, 4L, 5L));
}
Aggregations