Search in sources :

Example 16 with DynamicFilterDomainStats

use of io.trino.server.DynamicFilterService.DynamicFilterDomainStats in project trino by trinodb.

the class BaseDynamicPartitionPruningTest method testJoinWithEmptyBuildSide.

@Test(timeOut = 30_000)
public void testJoinWithEmptyBuildSide() {
    @Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem JOIN supplier ON partitioned_lineitem.suppkey = supplier.suppkey AND supplier.name = 'abc'";
    ResultWithQueryId<MaterializedResult> result = getDistributedQueryRunner().executeWithQueryId(getSession(), selectQuery);
    MaterializedResult expected = computeActual(withDynamicFilteringDisabled(), selectQuery);
    assertEqualsIgnoreOrder(result.getResult(), expected);
    OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), getQualifiedTableName(PARTITIONED_LINEITEM));
    assertEquals(probeStats.getInputPositions(), 0L);
    DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId());
    assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getLazyDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getReplicatedDynamicFilters(), 0L);
    assertEquals(dynamicFiltersStats.getDynamicFiltersCompleted(), 1L);
    DynamicFilterDomainStats domainStats = getOnlyElement(dynamicFiltersStats.getDynamicFilterDomainStats());
    assertEquals(domainStats.getSimplifiedDomain(), none(BIGINT).toString(getSession().toConnectorSession()));
    assertTrue(domainStats.getCollectionDuration().isPresent());
}
Also used : DynamicFilterDomainStats(io.trino.server.DynamicFilterService.DynamicFilterDomainStats) Language(org.intellij.lang.annotations.Language) DynamicFiltersTestUtil.getSimplifiedDomainString(io.trino.util.DynamicFiltersTestUtil.getSimplifiedDomainString) OperatorStats(io.trino.operator.OperatorStats) DynamicFiltersStats(io.trino.server.DynamicFilterService.DynamicFiltersStats) Test(org.testng.annotations.Test)

Example 17 with DynamicFilterDomainStats

use of io.trino.server.DynamicFilterService.DynamicFilterDomainStats in project trino by trinodb.

the class BaseDynamicPartitionPruningTest method testSemiJoinWithSelectiveBuildSide.

@Test(timeOut = 30_000)
public void testSemiJoinWithSelectiveBuildSide() {
    @Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem WHERE suppkey IN (SELECT suppkey FROM supplier WHERE name = 'Supplier#000000001')";
    ResultWithQueryId<MaterializedResult> result = getDistributedQueryRunner().executeWithQueryId(getSession(), selectQuery);
    MaterializedResult expected = computeActual(withDynamicFilteringDisabled(), selectQuery);
    assertEqualsIgnoreOrder(result.getResult(), expected);
    OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), getQualifiedTableName(PARTITIONED_LINEITEM));
    // Probe-side is partially scanned
    assertEquals(probeStats.getInputPositions(), 615L);
    DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId());
    assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getLazyDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getReplicatedDynamicFilters(), 0L);
    assertEquals(dynamicFiltersStats.getDynamicFiltersCompleted(), 1L);
    DynamicFilterDomainStats domainStats = getOnlyElement(dynamicFiltersStats.getDynamicFilterDomainStats());
    assertEquals(domainStats.getSimplifiedDomain(), singleValue(BIGINT, 1L).toString(getSession().toConnectorSession()));
}
Also used : DynamicFilterDomainStats(io.trino.server.DynamicFilterService.DynamicFilterDomainStats) Language(org.intellij.lang.annotations.Language) DynamicFiltersTestUtil.getSimplifiedDomainString(io.trino.util.DynamicFiltersTestUtil.getSimplifiedDomainString) OperatorStats(io.trino.operator.OperatorStats) DynamicFiltersStats(io.trino.server.DynamicFilterService.DynamicFiltersStats) Test(org.testng.annotations.Test)

Example 18 with DynamicFilterDomainStats

use of io.trino.server.DynamicFilterService.DynamicFilterDomainStats in project trino by trinodb.

the class BaseDynamicPartitionPruningTest method testRightJoinWithSelectiveBuildSide.

@Test(timeOut = 30_000)
public void testRightJoinWithSelectiveBuildSide() {
    @Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem l RIGHT JOIN supplier s ON l.suppkey = s.suppkey WHERE name = 'Supplier#000000001'";
    ResultWithQueryId<MaterializedResult> result = getDistributedQueryRunner().executeWithQueryId(getSession(), selectQuery);
    MaterializedResult expected = computeActual(withDynamicFilteringDisabled(), selectQuery);
    assertEqualsIgnoreOrder(result.getResult(), expected);
    OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), getQualifiedTableName(PARTITIONED_LINEITEM));
    // Probe-side is partially scanned
    assertEquals(probeStats.getInputPositions(), 615L);
    DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId());
    assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getLazyDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getReplicatedDynamicFilters(), 0L);
    assertEquals(dynamicFiltersStats.getDynamicFiltersCompleted(), 1L);
    DynamicFilterDomainStats domainStats = getOnlyElement(dynamicFiltersStats.getDynamicFilterDomainStats());
    assertEquals(domainStats.getSimplifiedDomain(), singleValue(BIGINT, 1L).toString(getSession().toConnectorSession()));
}
Also used : DynamicFilterDomainStats(io.trino.server.DynamicFilterService.DynamicFilterDomainStats) Language(org.intellij.lang.annotations.Language) DynamicFiltersTestUtil.getSimplifiedDomainString(io.trino.util.DynamicFiltersTestUtil.getSimplifiedDomainString) OperatorStats(io.trino.operator.OperatorStats) DynamicFiltersStats(io.trino.server.DynamicFilterService.DynamicFiltersStats) Test(org.testng.annotations.Test)

Example 19 with DynamicFilterDomainStats

use of io.trino.server.DynamicFilterService.DynamicFilterDomainStats in project trino by trinodb.

the class BaseDynamicPartitionPruningTest method testJoinWithNonSelectiveBuildSide.

@Test(timeOut = 30_000)
public void testJoinWithNonSelectiveBuildSide() {
    @Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem JOIN supplier ON partitioned_lineitem.suppkey = supplier.suppkey";
    ResultWithQueryId<MaterializedResult> result = getDistributedQueryRunner().executeWithQueryId(getSession(), selectQuery);
    MaterializedResult expected = computeActual(withDynamicFilteringDisabled(), selectQuery);
    assertEqualsIgnoreOrder(result.getResult(), expected);
    OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), getQualifiedTableName(PARTITIONED_LINEITEM));
    // Probe-side is fully scanned
    assertEquals(probeStats.getInputPositions(), LINEITEM_COUNT);
    DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId());
    assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getLazyDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getReplicatedDynamicFilters(), 0L);
    assertEquals(dynamicFiltersStats.getDynamicFiltersCompleted(), 1L);
    DynamicFilterDomainStats domainStats = getOnlyElement(dynamicFiltersStats.getDynamicFilterDomainStats());
    assertThat(domainStats.getSimplifiedDomain()).isEqualTo(getSimplifiedDomainString(1L, 100L, 100, BIGINT));
}
Also used : DynamicFilterDomainStats(io.trino.server.DynamicFilterService.DynamicFilterDomainStats) Language(org.intellij.lang.annotations.Language) DynamicFiltersTestUtil.getSimplifiedDomainString(io.trino.util.DynamicFiltersTestUtil.getSimplifiedDomainString) OperatorStats(io.trino.operator.OperatorStats) DynamicFiltersStats(io.trino.server.DynamicFilterService.DynamicFiltersStats) Test(org.testng.annotations.Test)

Example 20 with DynamicFilterDomainStats

use of io.trino.server.DynamicFilterService.DynamicFilterDomainStats in project trino by trinodb.

the class BaseDynamicPartitionPruningTest method testSemiJoinWithNonSelectiveBuildSide.

@Test(timeOut = 30_000)
public void testSemiJoinWithNonSelectiveBuildSide() {
    @Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem WHERE suppkey IN (SELECT suppkey FROM supplier)";
    ResultWithQueryId<MaterializedResult> result = getDistributedQueryRunner().executeWithQueryId(getSession(), selectQuery);
    MaterializedResult expected = computeActual(withDynamicFilteringDisabled(), selectQuery);
    assertEqualsIgnoreOrder(result.getResult(), expected);
    OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), getQualifiedTableName(PARTITIONED_LINEITEM));
    // Probe-side is fully scanned
    assertEquals(probeStats.getInputPositions(), LINEITEM_COUNT);
    DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId());
    assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getLazyDynamicFilters(), 1L);
    assertEquals(dynamicFiltersStats.getReplicatedDynamicFilters(), 0L);
    assertEquals(dynamicFiltersStats.getDynamicFiltersCompleted(), 1L);
    DynamicFilterDomainStats domainStats = getOnlyElement(dynamicFiltersStats.getDynamicFilterDomainStats());
    assertThat(domainStats.getSimplifiedDomain()).isEqualTo(getSimplifiedDomainString(1L, 100L, 100, BIGINT));
}
Also used : DynamicFilterDomainStats(io.trino.server.DynamicFilterService.DynamicFilterDomainStats) Language(org.intellij.lang.annotations.Language) DynamicFiltersTestUtil.getSimplifiedDomainString(io.trino.util.DynamicFiltersTestUtil.getSimplifiedDomainString) OperatorStats(io.trino.operator.OperatorStats) DynamicFiltersStats(io.trino.server.DynamicFilterService.DynamicFiltersStats) Test(org.testng.annotations.Test)

Aggregations

DynamicFilterDomainStats (io.trino.server.DynamicFilterService.DynamicFilterDomainStats)20 DynamicFiltersStats (io.trino.server.DynamicFilterService.DynamicFiltersStats)18 Test (org.testng.annotations.Test)18 OperatorStats (io.trino.operator.OperatorStats)14 Language (org.intellij.lang.annotations.Language)14 DynamicFiltersTestUtil.getSimplifiedDomainString (io.trino.util.DynamicFiltersTestUtil.getSimplifiedDomainString)13 DynamicFilterId (io.trino.sql.planner.plan.DynamicFilterId)6 StageId (io.trino.execution.StageId)4 TaskId (io.trino.execution.TaskId)4 QueryId (io.trino.spi.QueryId)4 Symbol (io.trino.sql.planner.Symbol)4 Expression (io.trino.sql.tree.Expression)4 CaseFormat (com.google.common.base.CaseFormat)2 UPPER_UNDERSCORE (com.google.common.base.CaseFormat.UPPER_UNDERSCORE)2 Joiner (com.google.common.base.Joiner)2 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)2 Preconditions.checkState (com.google.common.base.Preconditions.checkState)2 Verify.verify (com.google.common.base.Verify.verify)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2