use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testCollectOnlyLastColumn.
@Test
public void testCollectOnlyLastColumn() {
OperatorFactory operatorFactory = createOperatorFactory(channel(1, DOUBLE));
verifyPassthrough(createOperator(operatorFactory), ImmutableList.of(BOOLEAN, DOUBLE), new Page(createBooleansBlock(true, 2), createDoublesBlock(1.5, 3.0)), new Page(createBooleansBlock(false, 1), createDoublesBlock(4.5)));
operatorFactory.noMoreOperators();
assertEquals(partitions.build(), ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("1"), Domain.multipleValues(DOUBLE, ImmutableList.of(1.5, 3.0, 4.5))))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testCollectWithDoubleNaN.
@Test
public void testCollectWithDoubleNaN() {
BlockBuilder input = DOUBLE.createBlockBuilder(null, 10);
DOUBLE.writeDouble(input, 42.0);
DOUBLE.writeDouble(input, Double.NaN);
OperatorFactory operatorFactory = createOperatorFactory(channel(0, DOUBLE));
verifyPassthrough(createOperator(operatorFactory), ImmutableList.of(DOUBLE), new Page(input.build()));
operatorFactory.noMoreOperators();
assertEquals(partitions.build(), ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.multipleValues(DOUBLE, ImmutableList.of(42.0))))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testMultipleColumnsCollectMinMaxRangeWhenTooManyBytes.
@Test
public void testMultipleColumnsCollectMinMaxRangeWhenTooManyBytes() {
DataSize maxSize = DataSize.of(10, KILOBYTE);
long maxByteSize = maxSize.toBytes();
String largeTextA = "A".repeat((int) (maxByteSize / 2) + 1);
String largeTextB = "B".repeat((int) (maxByteSize / 2) + 1);
Page largePage = new Page(createStringsBlock(largeTextA), createStringsBlock(largeTextB));
List<TupleDomain<DynamicFilterId>> expectedTupleDomains = ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.create(ValueSet.ofRanges(range(VARCHAR, utf8Slice(largeTextA), true, utf8Slice(largeTextA), true)), false), new DynamicFilterId("1"), Domain.create(ValueSet.ofRanges(range(VARCHAR, utf8Slice(largeTextB), true, utf8Slice(largeTextB), true)), false))));
assertDynamicFilters(100, maxSize, 100, ImmutableList.of(VARCHAR, VARCHAR), ImmutableList.of(largePage), expectedTupleDomains);
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testCollectMultipleOperators.
@Test
public void testCollectMultipleOperators() {
OperatorFactory operatorFactory = createOperatorFactory(channel(0, BIGINT));
// will finish before noMoreOperators()
Operator op1 = createOperator(operatorFactory);
verifyPassthrough(op1, ImmutableList.of(BIGINT), new Page(createLongsBlock(1, 2)), new Page(createLongsBlock(3, 5)));
// will finish after noMoreOperators()
Operator op2 = createOperator(operatorFactory);
operatorFactory.noMoreOperators();
assertEquals(partitions.build(), ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.multipleValues(BIGINT, ImmutableList.of(1L, 2L, 3L, 5L))))));
verifyPassthrough(op2, ImmutableList.of(BIGINT), new Page(createLongsBlock(2, 3)), new Page(createLongsBlock(1, 4)));
assertEquals(partitions.build(), ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.multipleValues(BIGINT, ImmutableList.of(1L, 2L, 3L, 5L)))), TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.multipleValues(BIGINT, ImmutableList.of(1L, 2L, 3L, 4L))))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testCollectRowsNonOrderable.
@Test
public void testCollectRowsNonOrderable() {
int maxDistinctValues = 100;
Block block = createColorSequenceBlock(0, maxDistinctValues / 2);
ImmutableList.Builder<Object> values = ImmutableList.builder();
for (int position = 0; position < block.getPositionCount(); ++position) {
values.add(readNativeValue(COLOR, block, position));
}
assertDynamicFilters(maxDistinctValues, ImmutableList.of(COLOR), ImmutableList.of(new Page(block)), ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.create(ValueSet.copyOf(COLOR, values.build()), false)))));
}
Aggregations