use of io.prestosql.execution.QueryStats in project hetu-core by openlookeng.
the class TestMemorySmoke method testJoinDynamicFilteringSingleValue.
@Test
public void testJoinDynamicFilteringSingleValue() {
final long buildSideRowsCount = 15_000L;
assertQueryResult("SELECT COUNT() FROM orders", buildSideRowsCount);
assertQueryResult("SELECT COUNT() FROM orders WHERE comment = 'nstructions sleep furiously among '", 1L);
assertQueryResult("SELECT orderkey FROM orders WHERE comment = 'nstructions sleep furiously among '", 1L);
assertQueryResult("SELECT COUNT() FROM lineitem WHERE orderkey = 1", 6L);
Session session = Session.builder(getSession()).setSystemProperty(ENABLE_DYNAMIC_FILTERING, "true").setSystemProperty(JOIN_DISTRIBUTION_TYPE, FeaturesConfig.JoinDistributionType.BROADCAST.name()).build();
DistributedQueryRunner runner = (DistributedQueryRunner) getQueryRunner();
ResultWithQueryId<MaterializedResult> result = runner.executeWithQueryId(session, "SELECT * FROM lineitem JOIN orders " + "ON lineitem.orderkey = orders.orderkey AND orders.comment = 'nstructions sleep furiously among '");
assertEquals(result.getResult().getRowCount(), 6);
// Probe-side is dynamically filtered:
// Note: because the global dynamic filter is not applied in the memory connector, we have changed the assert value for this test
QueryStats stats = runner.getCoordinator().getQueryManager().getFullQueryInfo(result.getQueryId()).getQueryStats();
Set rowsRead = stats.getOperatorSummaries().stream().filter(summary -> summary.getOperatorType().equals("ScanFilterAndProjectOperator")).map(summary -> summary.getInputPositions()).collect(toImmutableSet());
assertEquals(rowsRead, ImmutableSet.of(6L, buildSideRowsCount));
}
use of io.prestosql.execution.QueryStats in project hetu-core by openlookeng.
the class TestMemorySmoke method testSemiJoinDynamicFilteringSingleValue.
@Test
public void testSemiJoinDynamicFilteringSingleValue() {
final long buildSideRowsCount = 15_000L;
Session session = Session.builder(getSession()).setSystemProperty(ENABLE_DYNAMIC_FILTERING, "true").setSystemProperty(JOIN_DISTRIBUTION_TYPE, FeaturesConfig.JoinDistributionType.BROADCAST.name()).build();
DistributedQueryRunner runner = (DistributedQueryRunner) getQueryRunner();
ResultWithQueryId<MaterializedResult> result = runner.executeWithQueryId(session, "SELECT * FROM lineitem WHERE orderkey IN (SELECT orderkey from orders WHERE orders.comment = 'nstructions sleep furiously among ')");
assertEquals(result.getResult().getRowCount(), 6);
QueryStats stats = runner.getCoordinator().getQueryManager().getFullQueryInfo(result.getQueryId()).getQueryStats();
Set rowsRead = stats.getOperatorSummaries().stream().filter(summary -> summary.getOperatorType().equals("ScanFilterAndProjectOperator")).map(summary -> summary.getInputPositions()).collect(toImmutableSet());
assertEquals(rowsRead, ImmutableSet.of(6L, buildSideRowsCount));
}
use of io.prestosql.execution.QueryStats in project hetu-core by openlookeng.
the class TestMemorySmoke method testJoinDynamicFilteringNone.
@Test
public void testJoinDynamicFilteringNone() {
final long buildSideRowsCount = 15_000L;
assertQueryResult("SELECT COUNT() FROM orders", buildSideRowsCount);
assertQueryResult("SELECT COUNT() FROM orders WHERE totalprice < 0", 0L);
Session session = Session.builder(getSession()).setSystemProperty(ENABLE_DYNAMIC_FILTERING, "true").setSystemProperty(JOIN_DISTRIBUTION_TYPE, FeaturesConfig.JoinDistributionType.BROADCAST.name()).build();
DistributedQueryRunner runner = (DistributedQueryRunner) getQueryRunner();
ResultWithQueryId<MaterializedResult> result = runner.executeWithQueryId(session, "SELECT * FROM lineitem JOIN orders " + "ON lineitem.orderkey = orders.orderkey AND orders.totalprice < 0");
assertEquals(result.getResult().getRowCount(), 0);
// Probe-side is not scanned at all, due to dynamic filtering:
// Note that because of the Global Dynamic Filter not being applied in the Memory Connector, we have changed this test
QueryStats stats = runner.getCoordinator().getQueryManager().getFullQueryInfo(result.getQueryId()).getQueryStats();
Set rowsRead = stats.getOperatorSummaries().stream().filter(summary -> summary.getOperatorType().equals("ScanFilterAndProjectOperator")).map(summary -> summary.getInputPositions()).collect(toImmutableSet());
assertEquals(rowsRead, ImmutableSet.of(0L, buildSideRowsCount));
}
Aggregations