use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TestTrinoThriftBigint method testWriteBlockAlternating.
@Test
public void testWriteBlockAlternating() {
Block source = longBlock(1, null, 2, null, 3, null, 4, null, 5, null, 6, null, 7, null);
TrinoThriftBlock column = fromBlock(source);
assertNotNull(column.getBigintData());
assertEquals(column.getBigintData().getNulls(), new boolean[] { false, true, false, true, false, true, false, true, false, true, false, true, false, true });
assertEquals(column.getBigintData().getLongs(), new long[] { 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0 });
}
use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TestTrinoThriftBigint method testWriteBlockSingleValue.
@Test
public void testWriteBlockSingleValue() {
TrinoThriftBlock column = fromBlock(longBlock(1));
assertNotNull(column.getBigintData());
assertNull(column.getBigintData().getNulls());
assertEquals(column.getBigintData().getLongs(), new long[] { 1 });
}
use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TestTrinoThriftBigint method testWriteBlockAllNonNull.
@Test
public void testWriteBlockAllNonNull() {
Block source = longBlock(1, 2, 3, 4, 5);
TrinoThriftBlock column = fromBlock(source);
assertNotNull(column.getBigintData());
assertNull(column.getBigintData().getNulls());
assertEquals(column.getBigintData().getLongs(), new long[] { 1, 2, 3, 4, 5 });
}
use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TrinoThriftEquatableValueSet method fromEquatableValueSet.
public static TrinoThriftEquatableValueSet fromEquatableValueSet(EquatableValueSet valueSet) {
Type type = valueSet.getType();
Set<ValueEntry> values = valueSet.getEntries();
List<TrinoThriftBlock> thriftValues = new ArrayList<>(values.size());
for (ValueEntry value : values) {
checkState(type.equals(value.getType()), "ValueEntrySet has elements of different types: %s vs %s", type, value.getType());
thriftValues.add(fromBlock(value.getBlock(), type));
}
return new TrinoThriftEquatableValueSet(valueSet.inclusive(), thriftValues);
}
use of io.trino.plugin.thrift.api.TrinoThriftBlock in project trino by trinodb.
the class TestTrinoThriftBigint method testReadBlockAllNonNullOption2.
@Test
public void testReadBlockAllNonNullOption2() {
TrinoThriftBlock columnsData = longColumn(new boolean[] { false, false, false, false, false, false, false }, 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