use of io.trino.operator.OperatorStats in project trino by trinodb.
the class BaseIcebergConnectorTest method verifySplitCount.
private void verifySplitCount(QueryId queryId, long expectedSplitCount) {
checkArgument(expectedSplitCount >= 0);
OperatorStats operatorStats = getOperatorStats(queryId);
if (expectedSplitCount > 0) {
assertThat(operatorStats.getTotalDrivers()).isEqualTo(expectedSplitCount);
assertThat(operatorStats.getPhysicalInputPositions()).isGreaterThan(0);
} else {
// expectedSplitCount == 0
assertThat(operatorStats.getTotalDrivers()).isEqualTo(1);
assertThat(operatorStats.getPhysicalInputPositions()).isEqualTo(0);
}
}
use of io.trino.operator.OperatorStats in project trino by trinodb.
the class BaseIcebergConnectorTest method testLocalDynamicFilteringWithSelectiveBuildSizeJoin.
@Test
public void testLocalDynamicFilteringWithSelectiveBuildSizeJoin() {
long fullTableScan = (Long) computeActual("SELECT count(*) FROM lineitem").getOnlyValue();
// Pick a value for totalprice where file level stats will not be able to filter out any data
// This assumes the totalprice ranges in every file have some overlap, otherwise this test will fail.
MaterializedRow range = getOnlyElement(computeActual("SELECT max(lower_bounds[4]), min(upper_bounds[4]) FROM \"orders$files\"").getMaterializedRows());
double totalPrice = (Double) computeActual(format("SELECT totalprice FROM orders WHERE totalprice > %s AND totalprice < %s LIMIT 1", range.getField(0), range.getField(1))).getOnlyValue();
Session session = Session.builder(getSession()).setSystemProperty(JOIN_DISTRIBUTION_TYPE, BROADCAST.name()).build();
ResultWithQueryId<MaterializedResult> result = getDistributedQueryRunner().executeWithQueryId(session, "SELECT * FROM lineitem JOIN orders ON lineitem.orderkey = orders.orderkey AND orders.totalprice = " + totalPrice);
OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), new QualifiedObjectName(ICEBERG_CATALOG, "tpch", "lineitem"));
// Assert some lineitem rows were filtered out on file level
assertThat(probeStats.getInputPositions()).isLessThan(fullTableScan);
}
use of io.trino.operator.OperatorStats in project trino by trinodb.
the class BaseDynamicPartitionPruningTest method testJoinWithImplicitCoercion.
@Test(timeOut = 30_000)
public void testJoinWithImplicitCoercion() {
// setup partitioned fact table with integer suppkey
createLineitemTable("partitioned_lineitem_int", ImmutableList.of("orderkey", "CAST(suppkey as int) suppkey_int"), ImmutableList.of("suppkey_int"));
assertQuery("SELECT count(*) FROM partitioned_lineitem_int", "VALUES " + LINEITEM_COUNT);
@Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem_int l JOIN supplier s ON l.suppkey_int = s.suppkey AND s.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_int"));
// 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()));
}
use of io.trino.operator.OperatorStats in project trino by trinodb.
the class BaseDynamicPartitionPruningTest method testSemiJoinLargeBuildSideRangeDynamicFiltering.
@Test(timeOut = 30_000)
public void testSemiJoinLargeBuildSideRangeDynamicFiltering() {
@Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem WHERE orderkey IN (SELECT orderkey FROM orders)";
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 because the build-side is too large for dynamic filtering
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());
assertEquals(domainStats.getSimplifiedDomain(), Domain.create(ValueSet.ofRanges(range(BIGINT, 1L, true, 60000L, true)), false).toString(getSession().toConnectorSession()));
}
use of io.trino.operator.OperatorStats in project trino by trinodb.
the class BaseDynamicPartitionPruningTest method testJoinLargeBuildSideRangeDynamicFiltering.
@Test(timeOut = 30_000)
public void testJoinLargeBuildSideRangeDynamicFiltering() {
@Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem JOIN orders ON partitioned_lineitem.orderkey = orders.orderkey";
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 because the build-side is too large for dynamic filtering
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());
assertEquals(domainStats.getSimplifiedDomain(), Domain.create(ValueSet.ofRanges(range(BIGINT, 1L, true, 60000L, true)), false).toString(getSession().toConnectorSession()));
}
Aggregations