use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testSingleColumnCollectMinMaxRangeWhenTooManyPositions.
@Test
public void testSingleColumnCollectMinMaxRangeWhenTooManyPositions() {
int maxDistinctValues = 100;
Page largePage = new Page(createLongSequenceBlock(0, maxDistinctValues + 1));
assertDynamicFilters(maxDistinctValues, ImmutableList.of(BIGINT), ImmutableList.of(largePage), ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.create(ValueSet.ofRanges(range(BIGINT, 0L, true, (long) maxDistinctValues, true)), false)))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testCollectMultipleColumns.
@Test
public void testCollectMultipleColumns() {
OperatorFactory operatorFactory = createOperatorFactory(channel(0, BOOLEAN), 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("0"), Domain.multipleValues(BOOLEAN, ImmutableList.of(true, false)), 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 testCollectOnlyFirstColumn.
@Test
public void testCollectOnlyFirstColumn() {
OperatorFactory operatorFactory = createOperatorFactory(channel(0, BOOLEAN));
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("0"), Domain.multipleValues(BOOLEAN, ImmutableList.of(true, false))))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testCollectDeduplication.
@Test
public void testCollectDeduplication() {
int maxDistinctValues = 100;
// lots of zeros
Page largePage = new Page(createLongRepeatBlock(7, maxDistinctValues * 10));
// lots of nulls
Page nullsPage = new Page(createLongsBlock(Arrays.asList(new Long[maxDistinctValues * 10])));
assertDynamicFilters(maxDistinctValues, ImmutableList.of(BIGINT), ImmutableList.of(largePage, nullsPage), ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.create(ValueSet.of(BIGINT, 7L), false)))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestDynamicFilterSourceOperator method testSingleColumnCollectMinMaxRangeWhenTooManyBytes.
@Test
public void testSingleColumnCollectMinMaxRangeWhenTooManyBytes() {
DataSize maxSize = DataSize.of(10, KILOBYTE);
long maxByteSize = maxSize.toBytes();
String largeText = "A".repeat((int) maxByteSize + 1);
Page largePage = new Page(createStringsBlock(largeText));
assertDynamicFilters(100, maxSize, 100, ImmutableList.of(VARCHAR), ImmutableList.of(largePage), ImmutableList.of(TupleDomain.withColumnDomains(ImmutableMap.of(new DynamicFilterId("0"), Domain.create(ValueSet.ofRanges(range(VARCHAR, utf8Slice(largeText), true, utf8Slice(largeText), true)), false)))));
}
Aggregations