ankitsultana commented on code in PR #10535:
URL: https://github.com/apache/pinot/pull/10535#discussion_r1172056816
##########
pinot-query-planner/src/test/resources/queries/SetOpPlans.json:
##########
@@ -0,0 +1,95 @@
+{
+ "set_op_tests": {
+ "queries": [
+ {
+ "description": "UNION ALL from two tables",
+ "sql": "EXPLAIN PLAN FOR SELECT col1, col2 FROM a UNION ALL SELECT
col1, col2 FROM b",
+ "output": [
+ "Execution Plan",
+ "\nLogicalUnion(all=[true])",
+ "\n LogicalProject(col1=[$0], col2=[$1])",
+ "\n LogicalTableScan(table=[[a]])",
+ "\n LogicalProject(col1=[$0], col2=[$1])",
+ "\n LogicalTableScan(table=[[b]])",
+ "\n"
+ ]
+ },
+ {
+ "description": "UNION ALL from three tables",
+ "sql": "EXPLAIN PLAN FOR SELECT col1, col2 FROM a UNION ALL SELECT
col1, col2 FROM b UNION ALL SELECT col1, col2 FROM c",
+ "output": [
+ "Execution Plan",
+ "\nLogicalUnion(all=[true])",
+ "\n LogicalUnion(all=[true])",
+ "\n LogicalProject(col1=[$0], col2=[$1])",
+ "\n LogicalTableScan(table=[[a]])",
+ "\n LogicalProject(col1=[$0], col2=[$1])",
+ "\n LogicalTableScan(table=[[b]])",
+ "\n LogicalProject(col1=[$0], col2=[$1])",
+ "\n LogicalTableScan(table=[[c]])",
+ "\n"
+ ]
+ },
+ {
+ "description": "UNION from three tables",
+ "sql": "EXPLAIN PLAN FOR SELECT col1, col2 FROM a UNION SELECT col1,
col2 FROM b UNION SELECT col1, col2 FROM c",
+ "output": [
+ "Execution Plan",
+ "\nLogicalAggregate(group=[{0, 1}])",
+ "\n LogicalExchange(distribution=[hash[0, 1]])",
+ "\n LogicalAggregate(group=[{0, 1}])",
+ "\n LogicalUnion(all=[true])",
+ "\n LogicalUnion(all=[true])",
+ "\n LogicalProject(col1=[$0], col2=[$1])",
+ "\n LogicalTableScan(table=[[a]])",
+ "\n LogicalProject(col1=[$0], col2=[$1])",
+ "\n LogicalTableScan(table=[[b]])",
+ "\n LogicalProject(col1=[$0], col2=[$1])",
+ "\n LogicalTableScan(table=[[c]])",
+ "\n"
+ ]
+ },
+ {
+ "description": "INTERSECT from three tables",
+ "sql": "EXPLAIN PLAN FOR SELECT col1, col2 FROM a INTERSECT SELECT
col1, col2 FROM b INTERSECT SELECT col1, col2 FROM c",
Review Comment:
@xiangfu0 : Shouldn't intersect require an exchange?
If the row `col1=10, col2=11` in tables `a` and `b` are on different
servers, if we don't shuffle using the intersection key (or broadcast one side)
we may end up dropping them from the result-set.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]