Search in sources :

Example 81 with DynamicFilterId

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)))));
}
Also used : Page(io.trino.spi.Page) DynamicFilterId(io.trino.sql.planner.plan.DynamicFilterId) Test(org.testng.annotations.Test)

Example 82 with DynamicFilterId

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))))));
}
Also used : Page(io.trino.spi.Page) DynamicFilterId(io.trino.sql.planner.plan.DynamicFilterId) Test(org.testng.annotations.Test)

Example 83 with DynamicFilterId

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))))));
}
Also used : Page(io.trino.spi.Page) DynamicFilterId(io.trino.sql.planner.plan.DynamicFilterId) Test(org.testng.annotations.Test)

Example 84 with DynamicFilterId

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)))));
}
Also used : Page(io.trino.spi.Page) DynamicFilterId(io.trino.sql.planner.plan.DynamicFilterId) Test(org.testng.annotations.Test)

Example 85 with DynamicFilterId

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)))));
}
Also used : DataSize(io.airlift.units.DataSize) Page(io.trino.spi.Page) DynamicFilterId(io.trino.sql.planner.plan.DynamicFilterId) Test(org.testng.annotations.Test)

Aggregations

DynamicFilterId (io.trino.sql.planner.plan.DynamicFilterId)85 Test (org.testng.annotations.Test)73 PlanNode (io.trino.sql.planner.plan.PlanNode)32 BasePlanTest (io.trino.sql.planner.assertions.BasePlanTest)31 Symbol (io.trino.sql.planner.Symbol)29 TupleDomain (io.trino.spi.predicate.TupleDomain)26 DynamicFilter (io.trino.spi.connector.DynamicFilter)24 ColumnHandle (io.trino.spi.connector.ColumnHandle)21 TestingColumnHandle (io.trino.spi.connector.TestingColumnHandle)20 JoinNode (io.trino.sql.planner.plan.JoinNode)19 Domain (io.trino.spi.predicate.Domain)18 QueryId (io.trino.spi.QueryId)17 StageId (io.trino.execution.StageId)16 TaskId (io.trino.execution.TaskId)15 Page (io.trino.spi.Page)15 Map (java.util.Map)15 ImmutableMap (com.google.common.collect.ImmutableMap)14 Expression (io.trino.sql.tree.Expression)13 VerifyException (com.google.common.base.VerifyException)11 SymbolAllocator (io.trino.sql.planner.SymbolAllocator)11