Search in sources :

Example 26 with OperatorStats

use of io.trino.operator.OperatorStats 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 27 with OperatorStats

use of io.trino.operator.OperatorStats 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 28 with OperatorStats

use of io.trino.operator.OperatorStats 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)

Example 29 with OperatorStats

use of io.trino.operator.OperatorStats in project trino by trinodb.

the class TestMemoryConnectorTest method testPhysicalInputPositions.

@Test(timeOut = 30_000)
public void testPhysicalInputPositions() {
    ResultWithQueryId<MaterializedResult> result = getDistributedQueryRunner().executeWithQueryId(getSession(), "SELECT * FROM lineitem JOIN tpch.tiny.supplier ON lineitem.suppkey = supplier.suppkey " + "AND supplier.name = 'Supplier#000000001'");
    assertEquals(result.getResult().getRowCount(), 615);
    OperatorStats probeStats = getScanOperatorStats(getDistributedQueryRunner(), result.getQueryId()).stream().findFirst().orElseThrow();
    assertEquals(probeStats.getInputPositions(), 615);
    assertEquals(probeStats.getPhysicalInputPositions(), LINEITEM_COUNT);
}
Also used : OperatorStats(io.trino.operator.OperatorStats) MaterializedResult(io.trino.testing.MaterializedResult) Test(org.testng.annotations.Test) BaseConnectorTest(io.trino.testing.BaseConnectorTest)

Aggregations

OperatorStats (io.trino.operator.OperatorStats)29 Test (org.testng.annotations.Test)18 Language (org.intellij.lang.annotations.Language)15 DynamicFilterDomainStats (io.trino.server.DynamicFilterService.DynamicFilterDomainStats)14 DynamicFiltersStats (io.trino.server.DynamicFilterService.DynamicFiltersStats)14 DynamicFiltersTestUtil.getSimplifiedDomainString (io.trino.util.DynamicFiltersTestUtil.getSimplifiedDomainString)13 ImmutableList (com.google.common.collect.ImmutableList)4 Session (io.trino.Session)3 MaterializedResult (io.trino.testing.MaterializedResult)3 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2 Duration (io.airlift.units.Duration)2 QueryStats (io.trino.execution.QueryStats)2 QualifiedObjectName (io.trino.metadata.QualifiedObjectName)2 BlockedReason (io.trino.operator.BlockedReason)2 PipelineStats (io.trino.operator.PipelineStats)2 StageGcStatistics (io.trino.spi.eventlistener.StageGcStatistics)2 PlanFragment (io.trino.sql.planner.PlanFragment)2 PlanNodeId (io.trino.sql.planner.plan.PlanNodeId)2 BaseConnectorTest (io.trino.testing.BaseConnectorTest)2 HashSet (java.util.HashSet)2