use of io.prestosql.Session in project hetu-core by openlookeng.
the class DynamicFilterMatcher method match.
public MatchResult match(FilterNode filterNode, Metadata metadata, Session session, SymbolAliases symbolAliases) {
checkState(this.filterNode == null, "filterNode must be null at this point");
this.filterNode = filterNode;
this.symbolAliases = symbolAliases;
FunctionResolution functionResolution = new FunctionResolution(metadata.getFunctionAndTypeManager());
LogicalRowExpressions logicalRowExpressions = new LogicalRowExpressions(new RowExpressionDeterminismEvaluator(metadata), functionResolution, metadata.getFunctionAndTypeManager());
boolean staticFilterMatches = expectedStaticFilter.map(filter -> {
RowExpressionVerifier verifier = new RowExpressionVerifier(symbolAliases, metadata, session, filterNode.getOutputSymbols());
RowExpression staticFilter = logicalRowExpressions.combineConjuncts(extractDynamicFilters(filterNode.getPredicate()).getStaticConjuncts());
return verifier.process(filter, staticFilter);
}).orElse(true);
return new MatchResult(match() && staticFilterMatches);
}
use of io.prestosql.Session in project hetu-core by openlookeng.
the class TestLogicalPlanner method testBroadcastCorrelatedSubqueryAvoidsRemoteExchangeBeforeAggregation.
@Test
public void testBroadcastCorrelatedSubqueryAvoidsRemoteExchangeBeforeAggregation() {
Session broadcastJoin = Session.builder(this.getQueryRunner().getDefaultSession()).setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.BROADCAST.name()).setSystemProperty(FORCE_SINGLE_NODE_OUTPUT, Boolean.toString(false)).build();
// make sure there is a remote exchange on the build side
PlanMatchPattern joinBuildSideWithRemoteExchange = anyTree(node(JoinNode.class, anyTree(node(TableScanNode.class)), anyTree(exchange(REMOTE, REPLICATE, anyTree(node(TableScanNode.class))))));
// validates that there exists only one remote exchange
Consumer<Plan> validateSingleRemoteExchange = plan -> assertEquals(countOfMatchingNodes(plan, node -> node instanceof ExchangeNode && ((ExchangeNode) node).getScope() == REMOTE), 1);
Consumer<Plan> validateSingleStreamingAggregation = plan -> assertEquals(countOfMatchingNodes(plan, node -> node instanceof AggregationNode && ((AggregationNode) node).getGroupingKeys().contains(new Symbol("unique")) && ((AggregationNode) node).isStreamable()), 1);
// region is unpartitioned, AssignUniqueId should provide satisfying partitioning for count(*) after LEFT JOIN
assertPlanWithSession("SELECT (SELECT count(*) FROM region r2 WHERE r2.regionkey > r1.regionkey) FROM region r1", broadcastJoin, false, joinBuildSideWithRemoteExchange, validateSingleRemoteExchange.andThen(validateSingleStreamingAggregation));
// orders is naturally partitioned, AssignUniqueId should not overwrite its natural partitioning
assertPlanWithSession("SELECT count(count) " + "FROM (SELECT o1.orderkey orderkey, (SELECT count(*) FROM orders o2 WHERE o2.orderkey > o1.orderkey) count FROM orders o1) " + "GROUP BY orderkey", broadcastJoin, false, joinBuildSideWithRemoteExchange, validateSingleRemoteExchange.andThen(validateSingleStreamingAggregation));
}
use of io.prestosql.Session in project hetu-core by openlookeng.
the class AbstractTestAggregations method testAggregationFilter.
@Test
public void testAggregationFilter() {
assertQuery("SELECT sum(x) FILTER (WHERE y > 4) FROM (VALUES (1, 3), (2, 4), (2, 4), (4, 5)) t (x, y)", "SELECT 4");
assertQuery("SELECT sum(x) FILTER (WHERE x > 1), sum(y) FILTER (WHERE y > 4) FROM (VALUES (1, 3), (2, 4), (2, 4), (4, 5)) t (x, y)", "SELECT 8, 5");
assertQuery("SELECT sum(x) FILTER (WHERE x > 1), sum(x) FROM (VALUES (1), (2), (2), (4)) t (x)", "SELECT 8, 9");
assertQuery("SELECT count(*) FILTER (WHERE x > 1), sum(x) FROM (VALUES (1, 3), (2, 4), (2, 4), (4, 5)) t (x, y)", "SELECT 3, 9");
assertQuery("SELECT count(*) FILTER (WHERE x > 1), count(DISTINCT y) FROM (VALUES (1, 10), (2, 10), (3, 10), (4, 20)) t (x, y)", "SELECT 3, 2");
assertQuery("" + "SELECT sum(b) FILTER (WHERE true) " + "FROM (SELECT count(*) FILTER (WHERE true) AS b)", "SELECT 1");
assertQuery("SELECT count(1) FILTER (WHERE orderstatus = 'O') FROM orders", "SELECT count(*) FROM orders WHERE orderstatus = 'O'");
if (supportsPushdown()) {
Session session1 = Session.builder(getSession()).setCatalogSessionProperty(getSession().getCatalog().get(), "orc_predicate_pushdown_enabled", "true").build();
assertQuery(session1, "SELECT count(1) FILTER (WHERE orderstatus = 'O') FROM orders", "SELECT count(*) FROM orders WHERE orderstatus = 'O'");
}
// filter out all rows
assertQuery("SELECT sum(x) FILTER (WHERE y > 5) FROM (VALUES (1, 3), (2, 4), (2, 4), (4, 5)) t (x, y)", "SELECT null");
assertQuery("SELECT count(*) FILTER (WHERE x > 4), sum(x) FILTER (WHERE y > 5) FROM (VALUES (1, 3), (2, 4), (2, 4), (4, 5)) t (x, y)", "SELECT 0, null");
}
use of io.prestosql.Session in project hetu-core by openlookeng.
the class AbstractTestDistributedQueries method testAddColumn.
@Test
public void testAddColumn() {
assertUpdate("CREATE TABLE test_add_column AS SELECT 123 x", 1);
assertUpdate("CREATE TABLE test_add_column_a AS SELECT 234 x, 111 a", 1);
assertUpdate("CREATE TABLE test_add_column_ab AS SELECT 345 x, 222 a, 33.3E0 b", 1);
assertQueryFails("ALTER TABLE test_add_column ADD COLUMN x bigint", ".* Column 'x' already exists");
assertQueryFails("ALTER TABLE test_add_column ADD COLUMN X bigint", ".* Column 'X' already exists");
assertQueryFails("ALTER TABLE test_add_column ADD COLUMN q bad_type", ".* Unknown type 'bad_type' for column 'q'");
assertUpdate("ALTER TABLE test_add_column ADD COLUMN a bigint");
assertUpdate("INSERT INTO test_add_column SELECT * FROM test_add_column_a", 1);
MaterializedResult materializedRows = computeActual("SELECT x, a FROM test_add_column ORDER BY x");
assertEquals(materializedRows.getMaterializedRows().get(0).getField(0), 123);
assertNull(materializedRows.getMaterializedRows().get(0).getField(1));
assertEquals(materializedRows.getMaterializedRows().get(1).getField(0), 234);
assertEquals(materializedRows.getMaterializedRows().get(1).getField(1), 111L);
if (supportsPushdown()) {
Session session1 = Session.builder(getSession()).setCatalogSessionProperty(getSession().getCatalog().get(), "orc_predicate_pushdown_enabled", "true").build();
MaterializedResult materializedRows1 = computeActual(session1, "SELECT x, a FROM test_add_column ORDER BY x");
assertEquals(materializedRows1.getMaterializedRows().get(0).getField(0), 123);
assertNull(materializedRows1.getMaterializedRows().get(0).getField(1));
assertEquals(materializedRows1.getMaterializedRows().get(1).getField(0), 234);
assertEquals(materializedRows1.getMaterializedRows().get(1).getField(1), 111L);
}
assertUpdate("ALTER TABLE test_add_column ADD COLUMN b double");
assertUpdate("INSERT INTO test_add_column SELECT * FROM test_add_column_ab", 1);
materializedRows = computeActual("SELECT x, a, b FROM test_add_column ORDER BY x");
assertEquals(materializedRows.getMaterializedRows().get(0).getField(0), 123);
assertNull(materializedRows.getMaterializedRows().get(0).getField(1));
assertNull(materializedRows.getMaterializedRows().get(0).getField(2));
assertEquals(materializedRows.getMaterializedRows().get(1).getField(0), 234);
assertEquals(materializedRows.getMaterializedRows().get(1).getField(1), 111L);
assertNull(materializedRows.getMaterializedRows().get(1).getField(2));
assertEquals(materializedRows.getMaterializedRows().get(2).getField(0), 345);
assertEquals(materializedRows.getMaterializedRows().get(2).getField(1), 222L);
assertEquals(materializedRows.getMaterializedRows().get(2).getField(2), 33.3);
assertUpdate("DROP TABLE test_add_column");
assertUpdate("DROP TABLE test_add_column_a");
assertUpdate("DROP TABLE test_add_column_ab");
assertFalse(getQueryRunner().tableExists(getSession(), "test_add_column"));
assertFalse(getQueryRunner().tableExists(getSession(), "test_add_column_a"));
assertFalse(getQueryRunner().tableExists(getSession(), "test_add_column_ab"));
}
use of io.prestosql.Session in project hetu-core by openlookeng.
the class AbstractTestDistributedQueries method testLikePredicateWithPartitionKey.
@Test
public void testLikePredicateWithPartitionKey() {
if (supportsPushdown()) {
assertUpdate("DROP TABLE IF EXISTS test_partition_predicate");
assertUpdate("CREATE TABLE test_partition_predicate (id int, p1 varchar, p2 varchar) WITH (partitioned_by=ARRAY['p2'])");
assertTrue(getQueryRunner().tableExists(getSession(), "test_partition_predicate"));
assertTableColumnNames("test_partition_predicate", "id", "p1", "p2");
assertUpdate("INSERT INTO test_partition_predicate VALUES (1,'aaa','aaa'), (2,'bbb','bbb'), (3,'ccc','ccc')", 3);
assertUpdate("INSERT INTO test_partition_predicate VALUES (4,'ddd','ddd'), (5,'eee','eee'), (6,'fff','fff')", 3);
assertUpdate("INSERT INTO test_partition_predicate VALUES (7,'ggg','ggg'), (8,'hhh','hhh'), (9,'iii','iii')", 3);
Session sessionPushdown = Session.builder(getSession()).setCatalogSessionProperty(getSession().getCatalog().get(), "orc_predicate_pushdown_enabled", "true").setCatalogSessionProperty(getSession().getCatalog().get(), "orc_row_data_cache_enabled", "false").build();
Session sessionCachePushdown = Session.builder(getSession()).setCatalogSessionProperty(getSession().getCatalog().get(), "orc_predicate_pushdown_enabled", "true").setCatalogSessionProperty(getSession().getCatalog().get(), "orc_row_data_cache_enabled", "true").build();
assertUpdate("INSERT INTO test_partition_predicate VALUES (10,NULL,'10'), (11,NULL,NULL), (NULL,NULL,NULL)", 3);
assertUpdate("INSERT INTO test_partition_predicate VALUES (13,'ab',NULL), (14,'aab',NULL), (NULL,'aaab',NULL)", 3);
assertUpdate("INSERT INTO test_partition_predicate VALUES (15,'ab','aab'), (16,'aab','aab'), (NULL,'aaab','aaab')", 3);
assertUpdate("INSERT INTO test_partition_predicate VALUES (18,'b',NULL), (19,'abb',NULL), (NULL,'abbb',NULL)", 3);
assertUpdate("INSERT INTO test_partition_predicate VALUES (21,'b','b'), (22,'abb','abb'), (NULL,'abbb','abbb')", 3);
MaterializedResult resultNormal;
MaterializedResult resultPushdown;
MaterializedResult resultCachePushdown;
/* Conjuct Like */
List<String> sqlList = Arrays.asList("SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE 'a%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE 'a%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE 'aa%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE 'ab%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE '%a' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE '%b' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE '%ab' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE '%a%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE '%aa%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p2 LIKE '%aaa%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE 'a%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE 'a%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE 'aa%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE 'ab%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE '%a' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE '%b' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE '%ab' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE '%a%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE '%aa%' ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and p1 LIKE '%aaa%' ORDER BY id");
for (String sql : sqlList) {
resultNormal = computeActual(sql);
resultPushdown = computeActual(sessionPushdown, sql);
resultCachePushdown = computeActual(sessionCachePushdown, sql);
assertEquals(resultNormal.getMaterializedRows(), resultPushdown.getMaterializedRows());
assertEquals(resultNormal.getMaterializedRows(), resultCachePushdown.getMaterializedRows());
}
/* disjunct Like */
sqlList = Arrays.asList("SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'a%' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'a%' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'aa%' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'ab%' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%a' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%b' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%ab' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%a%' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%aa%' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%aaa%' OR p1 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'a%' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'a%' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'aa%' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'ab%' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%a' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%b' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%ab' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%a%' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%aa%' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%aaa%' OR p1 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'a%' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'a%' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'aa%' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE 'ab%' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%a' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%b' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%ab' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%a%' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%aa%' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p2 LIKE '%aaa%' OR p1 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'a%' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'a%' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'aa%' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'ab%' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%a' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%b' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%ab' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%a%' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%aa%' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%aaa%' OR p2 > 'c') ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'a%' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'a%' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'aa%' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'ab%' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%a' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%b' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%ab' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%a%' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%aa%' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%aaa%' OR p2 IS NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'a%' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'a%' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'aa%' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE 'ab%' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%a' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%b' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%ab' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%a%' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%aa%' OR p2 IS NOT NULL) ORDER BY id", "SELECT id, p1, p2 FROM test_partition_predicate WHERE id > 0 and (p1 LIKE '%aaa%' OR p2 IS NOT NULL) ORDER BY id");
for (String sql : sqlList) {
resultNormal = computeActual(sql);
resultPushdown = computeActual(sessionPushdown, sql);
resultCachePushdown = computeActual(sessionCachePushdown, sql);
if (!resultNormal.getMaterializedRows().equals(resultPushdown.getMaterializedRows()) || !resultNormal.getMaterializedRows().equals(resultCachePushdown.getMaterializedRows())) {
System.out.println("------------------------------------------------------------------------");
System.out.println("Failed Query: " + sql);
System.out.println("------------------------------------------------------------------------");
System.out.println("Expected : " + resultNormal.getMaterializedRows());
System.out.println("Result[Pushdown]: " + resultPushdown.getMaterializedRows());
System.out.println("Result[Cache] : " + resultCachePushdown.getMaterializedRows());
System.out.println("------------------------------------------------------------------------");
resultNormal = computeActual("EXPLAIN " + sql);
resultPushdown = computeActual(sessionPushdown, "EXPLAIN " + sql);
resultCachePushdown = computeActual(sessionCachePushdown, "EXPLAIN " + sql);
System.out.println("Running query [" + sql + "]");
System.out.println("Normal Plan: " + resultNormal);
System.out.println("PushDown Plan: " + resultPushdown);
System.out.println("CacheDown Plan: " + resultCachePushdown);
System.out.println("------------------------------------------------------------------------");
}
assertEquals(resultNormal.getMaterializedRows(), resultPushdown.getMaterializedRows());
assertEquals(resultNormal.getMaterializedRows(), resultCachePushdown.getMaterializedRows());
}
}
}
Aggregations