quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject [06/14] incubator-quickstep git commit: Implement parser and resolver for UNION and INTERSECT.
Date Sun, 09 Apr 2017 01:48:46 GMT
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5b7b5cb8/parser/preprocessed/SqlParser_gen.hpp
----------------------------------------------------------------------
diff --git a/parser/preprocessed/SqlParser_gen.hpp b/parser/preprocessed/SqlParser_gen.hpp
index f1876b8..857eaaf 100644
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ b/parser/preprocessed/SqlParser_gen.hpp
@@ -65,117 +65,119 @@ extern int quickstep_yydebug;
     TOKEN_IS = 275,
     UNARY_PLUS = 276,
     UNARY_MINUS = 277,
-    TOKEN_ADD = 278,
-    TOKEN_ALL = 279,
-    TOKEN_ALTER = 280,
-    TOKEN_AS = 281,
-    TOKEN_ASC = 282,
-    TOKEN_BIGINT = 283,
-    TOKEN_BIT = 284,
-    TOKEN_BITWEAVING = 285,
-    TOKEN_BLOCKPROPERTIES = 286,
-    TOKEN_BLOCKSAMPLE = 287,
-    TOKEN_BLOOM_FILTER = 288,
-    TOKEN_CSB_TREE = 289,
-    TOKEN_BY = 290,
-    TOKEN_CASE = 291,
-    TOKEN_CHARACTER = 292,
-    TOKEN_CHECK = 293,
-    TOKEN_COLUMN = 294,
-    TOKEN_CONSTRAINT = 295,
-    TOKEN_COPY = 296,
-    TOKEN_CREATE = 297,
-    TOKEN_CURRENT = 298,
-    TOKEN_DATE = 299,
-    TOKEN_DATETIME = 300,
-    TOKEN_DAY = 301,
-    TOKEN_DECIMAL = 302,
-    TOKEN_DEFAULT = 303,
-    TOKEN_DELETE = 304,
-    TOKEN_DELIMITER = 305,
-    TOKEN_DESC = 306,
-    TOKEN_DISTINCT = 307,
-    TOKEN_DOUBLE = 308,
-    TOKEN_DROP = 309,
-    TOKEN_ELSE = 310,
-    TOKEN_END = 311,
-    TOKEN_ESCAPE_STRINGS = 312,
-    TOKEN_EXISTS = 313,
-    TOKEN_EXTRACT = 314,
-    TOKEN_FALSE = 315,
-    TOKEN_FIRST = 316,
-    TOKEN_FLOAT = 317,
-    TOKEN_FOLLOWING = 318,
-    TOKEN_FOR = 319,
-    TOKEN_FOREIGN = 320,
-    TOKEN_FROM = 321,
-    TOKEN_FULL = 322,
-    TOKEN_GROUP = 323,
-    TOKEN_HASH = 324,
-    TOKEN_HAVING = 325,
-    TOKEN_HOUR = 326,
-    TOKEN_IN = 327,
-    TOKEN_INDEX = 328,
-    TOKEN_INNER = 329,
-    TOKEN_INSERT = 330,
-    TOKEN_INTEGER = 331,
-    TOKEN_INTERVAL = 332,
-    TOKEN_INTO = 333,
-    TOKEN_JOIN = 334,
-    TOKEN_KEY = 335,
-    TOKEN_LAST = 336,
-    TOKEN_LEFT = 337,
-    TOKEN_LIMIT = 338,
-    TOKEN_LONG = 339,
-    TOKEN_MINUTE = 340,
-    TOKEN_MONTH = 341,
-    TOKEN_NULL = 342,
-    TOKEN_NULLS = 343,
-    TOKEN_OFF = 344,
-    TOKEN_ON = 345,
-    TOKEN_ORDER = 346,
-    TOKEN_OUTER = 347,
-    TOKEN_OVER = 348,
-    TOKEN_PARTITION = 349,
-    TOKEN_PARTITIONS = 350,
-    TOKEN_PERCENT = 351,
-    TOKEN_PRECEDING = 352,
-    TOKEN_PRIMARY = 353,
-    TOKEN_PRIORITY = 354,
-    TOKEN_QUIT = 355,
-    TOKEN_RANGE = 356,
-    TOKEN_REAL = 357,
-    TOKEN_REFERENCES = 358,
-    TOKEN_RIGHT = 359,
-    TOKEN_ROW = 360,
-    TOKEN_ROW_DELIMITER = 361,
-    TOKEN_ROWS = 362,
-    TOKEN_SECOND = 363,
-    TOKEN_SELECT = 364,
-    TOKEN_SET = 365,
-    TOKEN_SMA = 366,
-    TOKEN_SMALLINT = 367,
-    TOKEN_SUBSTRING = 368,
-    TOKEN_TABLE = 369,
-    TOKEN_THEN = 370,
-    TOKEN_TIME = 371,
-    TOKEN_TIMESTAMP = 372,
-    TOKEN_TRUE = 373,
-    TOKEN_TUPLESAMPLE = 374,
-    TOKEN_UNBOUNDED = 375,
-    TOKEN_UNIQUE = 376,
-    TOKEN_UPDATE = 377,
-    TOKEN_USING = 378,
-    TOKEN_VALUES = 379,
-    TOKEN_VARCHAR = 380,
-    TOKEN_WHEN = 381,
-    TOKEN_WHERE = 382,
-    TOKEN_WINDOW = 383,
-    TOKEN_WITH = 384,
-    TOKEN_YEAR = 385,
-    TOKEN_YEARMONTH = 386,
-    TOKEN_EOF = 387,
-    TOKEN_LEX_ERROR = 388
+    TOKEN_ALL = 278,
+    TOKEN_UNION = 279,
+    TOKEN_INTERSECT = 280,
+    TOKEN_ADD = 281,
+    TOKEN_ALTER = 282,
+    TOKEN_AS = 283,
+    TOKEN_ASC = 284,
+    TOKEN_BIGINT = 285,
+    TOKEN_BIT = 286,
+    TOKEN_BITWEAVING = 287,
+    TOKEN_BLOCKPROPERTIES = 288,
+    TOKEN_BLOCKSAMPLE = 289,
+    TOKEN_BLOOM_FILTER = 290,
+    TOKEN_CSB_TREE = 291,
+    TOKEN_BY = 292,
+    TOKEN_CASE = 293,
+    TOKEN_CHARACTER = 294,
+    TOKEN_CHECK = 295,
+    TOKEN_COLUMN = 296,
+    TOKEN_CONSTRAINT = 297,
+    TOKEN_COPY = 298,
+    TOKEN_CREATE = 299,
+    TOKEN_CURRENT = 300,
+    TOKEN_DATE = 301,
+    TOKEN_DATETIME = 302,
+    TOKEN_DAY = 303,
+    TOKEN_DECIMAL = 304,
+    TOKEN_DEFAULT = 305,
+    TOKEN_DELETE = 306,
+    TOKEN_DELIMITER = 307,
+    TOKEN_DESC = 308,
+    TOKEN_DISTINCT = 309,
+    TOKEN_DOUBLE = 310,
+    TOKEN_DROP = 311,
+    TOKEN_ELSE = 312,
+    TOKEN_END = 313,
+    TOKEN_ESCAPE_STRINGS = 314,
+    TOKEN_EXISTS = 315,
+    TOKEN_EXTRACT = 316,
+    TOKEN_FALSE = 317,
+    TOKEN_FIRST = 318,
+    TOKEN_FLOAT = 319,
+    TOKEN_FOLLOWING = 320,
+    TOKEN_FOR = 321,
+    TOKEN_FOREIGN = 322,
+    TOKEN_FROM = 323,
+    TOKEN_FULL = 324,
+    TOKEN_GROUP = 325,
+    TOKEN_HASH = 326,
+    TOKEN_HAVING = 327,
+    TOKEN_HOUR = 328,
+    TOKEN_IN = 329,
+    TOKEN_INDEX = 330,
+    TOKEN_INNER = 331,
+    TOKEN_INSERT = 332,
+    TOKEN_INTEGER = 333,
+    TOKEN_INTERVAL = 334,
+    TOKEN_INTO = 335,
+    TOKEN_JOIN = 336,
+    TOKEN_KEY = 337,
+    TOKEN_LAST = 338,
+    TOKEN_LEFT = 339,
+    TOKEN_LIMIT = 340,
+    TOKEN_LONG = 341,
+    TOKEN_MINUTE = 342,
+    TOKEN_MONTH = 343,
+    TOKEN_NULL = 344,
+    TOKEN_NULLS = 345,
+    TOKEN_OFF = 346,
+    TOKEN_ON = 347,
+    TOKEN_ORDER = 348,
+    TOKEN_OUTER = 349,
+    TOKEN_OVER = 350,
+    TOKEN_PARTITION = 351,
+    TOKEN_PARTITIONS = 352,
+    TOKEN_PERCENT = 353,
+    TOKEN_PRECEDING = 354,
+    TOKEN_PRIMARY = 355,
+    TOKEN_PRIORITY = 356,
+    TOKEN_QUIT = 357,
+    TOKEN_RANGE = 358,
+    TOKEN_REAL = 359,
+    TOKEN_REFERENCES = 360,
+    TOKEN_RIGHT = 361,
+    TOKEN_ROW = 362,
+    TOKEN_ROW_DELIMITER = 363,
+    TOKEN_ROWS = 364,
+    TOKEN_SECOND = 365,
+    TOKEN_SELECT = 366,
+    TOKEN_SET = 367,
+    TOKEN_SMA = 368,
+    TOKEN_SMALLINT = 369,
+    TOKEN_SUBSTRING = 370,
+    TOKEN_TABLE = 371,
+    TOKEN_THEN = 372,
+    TOKEN_TIME = 373,
+    TOKEN_TIMESTAMP = 374,
+    TOKEN_TRUE = 375,
+    TOKEN_TUPLESAMPLE = 376,
+    TOKEN_UNBOUNDED = 377,
+    TOKEN_UNIQUE = 378,
+    TOKEN_UPDATE = 379,
+    TOKEN_USING = 380,
+    TOKEN_VALUES = 381,
+    TOKEN_VARCHAR = 382,
+    TOKEN_WHEN = 383,
+    TOKEN_WHERE = 384,
+    TOKEN_WINDOW = 385,
+    TOKEN_WITH = 386,
+    TOKEN_YEAR = 387,
+    TOKEN_YEARMONTH = 388,
+    TOKEN_EOF = 389,
+    TOKEN_LEX_ERROR = 390
   };
 #endif
 
@@ -184,7 +186,7 @@ extern int quickstep_yydebug;
 
 union YYSTYPE
 {
-#line 120 "../SqlParser.ypp" /* yacc.c:1915  */
+#line 121 "../SqlParser.ypp" /* yacc.c:1909  */
 
   quickstep::ParseString *string_value_;
 
@@ -216,6 +218,8 @@ union YYSTYPE
   quickstep::ParseSelectionItem *selection_item_;
   quickstep::ParseSelectionList *selection_list_;
 
+  quickstep::ParseSetOperation *set_operation_;
+
   quickstep::ParseTableReference *table_reference_;
   quickstep::PtrList<quickstep::ParseTableReference> *table_reference_list_;
   quickstep::ParseTableReferenceSignature *table_reference_signature_;
@@ -243,7 +247,7 @@ union YYSTYPE
   quickstep::PtrVector<quickstep::ParseString> *command_argument_list_;
 
   quickstep::ParseStatement *statement_;
-  quickstep::ParseStatementSelect *select_statement_;
+  quickstep::ParseStatementSetOperation *set_operation_statement_;
   quickstep::ParseStatementUpdate *update_statement_;
   quickstep::ParseStatementInsert *insert_statement_;
   quickstep::ParseStatementDelete *delete_statement_;
@@ -284,7 +288,7 @@ union YYSTYPE
 
   quickstep::ParsePriority *opt_priority_clause_;
 
-#line 288 "SqlParser_gen.hpp" /* yacc.c:1915  */
+#line 292 "SqlParser_gen.hpp" /* yacc.c:1909  */
 };
 
 typedef union YYSTYPE YYSTYPE;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5b7b5cb8/parser/tests/Aggregate.test
----------------------------------------------------------------------
diff --git a/parser/tests/Aggregate.test b/parser/tests/Aggregate.test
index e7b8945..5fc5228 100644
--- a/parser/tests/Aggregate.test
+++ b/parser/tests/Aggregate.test
@@ -17,50 +17,54 @@
 
 SELECT AGG(*), AGG(), AGG(a, b, c) FROM test
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-FunctionCall[name=AGG,is_star=true]
-  | +-SelectListItem
-  | | +-FunctionCall[name=AGG]
-  | +-SelectListItem
-  |   +-FunctionCall[name=AGG]
-  |     +-AttributeReference[attribute_name=a]
-  |     +-AttributeReference[attribute_name=b]
-  |     +-AttributeReference[attribute_name=c]
-  +-from_clause=
-    +-TableReference[table=test]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectList
+      | +-SelectListItem
+      | | +-FunctionCall[name=AGG,is_star=true]
+      | +-SelectListItem
+      | | +-FunctionCall[name=AGG]
+      | +-SelectListItem
+      |   +-FunctionCall[name=AGG]
+      |     +-AttributeReference[attribute_name=a]
+      |     +-AttributeReference[attribute_name=b]
+      |     +-AttributeReference[attribute_name=c]
+      +-from_clause=
+        +-TableReference[table=test]
 ==
 
 SELECT AGG()+1, AGG()*2+1+AGG(a, b)/AGG(c, d) FROM test
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Add
-  | |   +-left_operand=FunctionCall[name=AGG]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=Add
-  |     | +-left_operand=Multiply
-  |     | | +-left_operand=FunctionCall[name=AGG]
-  |     | | +-right_operand=Literal
-  |     | |   +-NumericLiteral[numeric_string=2,float_like=false]
-  |     | +-right_operand=Literal
-  |     |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-right_operand=Divide
-  |       +-left_operand=FunctionCall[name=AGG]
-  |       | +-AttributeReference[attribute_name=a]
-  |       | +-AttributeReference[attribute_name=b]
-  |       +-right_operand=FunctionCall[name=AGG]
-  |         +-AttributeReference[attribute_name=c]
-  |         +-AttributeReference[attribute_name=d]
-  +-from_clause=
-    +-TableReference[table=test]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectList
+      | +-SelectListItem
+      | | +-Add
+      | |   +-left_operand=FunctionCall[name=AGG]
+      | |   +-right_operand=Literal
+      | |     +-NumericLiteral[numeric_string=1,float_like=false]
+      | +-SelectListItem
+      |   +-Add
+      |     +-left_operand=Add
+      |     | +-left_operand=Multiply
+      |     | | +-left_operand=FunctionCall[name=AGG]
+      |     | | +-right_operand=Literal
+      |     | |   +-NumericLiteral[numeric_string=2,float_like=false]
+      |     | +-right_operand=Literal
+      |     |   +-NumericLiteral[numeric_string=1,float_like=false]
+      |     +-right_operand=Divide
+      |       +-left_operand=FunctionCall[name=AGG]
+      |       | +-AttributeReference[attribute_name=a]
+      |       | +-AttributeReference[attribute_name=b]
+      |       +-right_operand=FunctionCall[name=AGG]
+      |         +-AttributeReference[attribute_name=c]
+      |         +-AttributeReference[attribute_name=d]
+      +-from_clause=
+        +-TableReference[table=test]
 ==
 
 # Function calls as arguments of another function calls.
@@ -68,25 +72,27 @@ SelectStatement
 # the query is not valid. The query resolver will capture the error.
 SELECT AGG(AGG(AGG()+1)*2, AGG(*)/2.0) FROM test
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-FunctionCall[name=AGG]
-  |     +-Multiply
-  |     | +-left_operand=FunctionCall[name=AGG]
-  |     | | +-Add
-  |     | |   +-left_operand=FunctionCall[name=AGG]
-  |     | |   +-right_operand=Literal
-  |     | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  |     | +-right_operand=Literal
-  |     |   +-NumericLiteral[numeric_string=2,float_like=false]
-  |     +-Divide
-  |       +-left_operand=FunctionCall[name=AGG,is_star=true]
-  |       +-right_operand=Literal
-  |         +-NumericLiteral[numeric_string=2.0,float_like=true]
-  +-from_clause=
-    +-TableReference[table=test]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectList
+      | +-SelectListItem
+      |   +-FunctionCall[name=AGG]
+      |     +-Multiply
+      |     | +-left_operand=FunctionCall[name=AGG]
+      |     | | +-Add
+      |     | |   +-left_operand=FunctionCall[name=AGG]
+      |     | |   +-right_operand=Literal
+      |     | |     +-NumericLiteral[numeric_string=1,float_like=false]
+      |     | +-right_operand=Literal
+      |     |   +-NumericLiteral[numeric_string=2,float_like=false]
+      |     +-Divide
+      |       +-left_operand=FunctionCall[name=AGG,is_star=true]
+      |       +-right_operand=Literal
+      |         +-NumericLiteral[numeric_string=2.0,float_like=true]
+      +-from_clause=
+        +-TableReference[table=test]
 ==
 
 SELECT AGG(*, a) FROM test
@@ -98,93 +104,101 @@ SELECT AGG(*, a) FROM test
 
 SELECT AGG()+1 FROM test GROUP BY a+1, AGG()+1 HAVING AGG()*2>1
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=FunctionCall[name=AGG]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=1,float_like=false]
-  +-group_by=GroupBy
-  | +-Add
-  | | +-left_operand=AttributeReference[attribute_name=a]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-Add
-  |   +-left_operand=FunctionCall[name=AGG]
-  |   +-right_operand=Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-having=HAVING
-  | +-Greater
-  |   +-left_operand=Multiply
-  |   | +-left_operand=FunctionCall[name=AGG]
-  |   | +-right_operand=Literal
-  |   |   +-NumericLiteral[numeric_string=2,float_like=false]
-  |   +-right_operand=Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectList
+      | +-SelectListItem
+      |   +-Add
+      |     +-left_operand=FunctionCall[name=AGG]
+      |     +-right_operand=Literal
+      |       +-NumericLiteral[numeric_string=1,float_like=false]
+      +-group_by=GroupBy
+      | +-Add
+      | | +-left_operand=AttributeReference[attribute_name=a]
+      | | +-right_operand=Literal
+      | |   +-NumericLiteral[numeric_string=1,float_like=false]
+      | +-Add
+      |   +-left_operand=FunctionCall[name=AGG]
+      |   +-right_operand=Literal
+      |     +-NumericLiteral[numeric_string=1,float_like=false]
+      +-having=HAVING
+      | +-Greater
+      |   +-left_operand=Multiply
+      |   | +-left_operand=FunctionCall[name=AGG]
+      |   | +-right_operand=Literal
+      |   |   +-NumericLiteral[numeric_string=2,float_like=false]
+      |   +-right_operand=Literal
+      |     +-NumericLiteral[numeric_string=1,float_like=false]
+      +-from_clause=
+        +-TableReference[table=test]
 ==
 
 SELECT 1 FROM test HAVING AGG() > 1 AND 1=1
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-having=HAVING
-  | +-And
-  |   +-Greater
-  |   | +-left_operand=FunctionCall[name=AGG]
-  |   | +-right_operand=Literal
-  |   |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |   +-Equal
-  |     +-left_operand=Literal
-  |     | +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectList
+      | +-SelectListItem
+      |   +-Literal
+      |     +-NumericLiteral[numeric_string=1,float_like=false]
+      +-having=HAVING
+      | +-And
+      |   +-Greater
+      |   | +-left_operand=FunctionCall[name=AGG]
+      |   | +-right_operand=Literal
+      |   |   +-NumericLiteral[numeric_string=1,float_like=false]
+      |   +-Equal
+      |     +-left_operand=Literal
+      |     | +-NumericLiteral[numeric_string=1,float_like=false]
+      |     +-right_operand=Literal
+      |       +-NumericLiteral[numeric_string=1,float_like=false]
+      +-from_clause=
+        +-TableReference[table=test]
 ==
 
 SELECT 1 FROM test GROUP BY AGG()+1, AGG()/AGG()
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-group_by=GroupBy
-  | +-Add
-  | | +-left_operand=FunctionCall[name=AGG]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-Divide
-  |   +-left_operand=FunctionCall[name=AGG]
-  |   +-right_operand=FunctionCall[name=AGG]
-  +-from_clause=
-    +-TableReference[table=test]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectList
+      | +-SelectListItem
+      |   +-Literal
+      |     +-NumericLiteral[numeric_string=1,float_like=false]
+      +-group_by=GroupBy
+      | +-Add
+      | | +-left_operand=FunctionCall[name=AGG]
+      | | +-right_operand=Literal
+      | |   +-NumericLiteral[numeric_string=1,float_like=false]
+      | +-Divide
+      |   +-left_operand=FunctionCall[name=AGG]
+      |   +-right_operand=FunctionCall[name=AGG]
+      +-from_clause=
+        +-TableReference[table=test]
 ==
 
 SELECT AGG(DISTINCT x), AGG(y) FROM test GROUP BY z
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-FunctionCall[name=AGG,is_distinct=true]
-  | |   +-AttributeReference[attribute_name=x]
-  | +-SelectListItem
-  |   +-FunctionCall[name=AGG]
-  |     +-AttributeReference[attribute_name=y]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=z]
-  +-from_clause=
-    +-TableReference[table=test]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectList
+      | +-SelectListItem
+      | | +-FunctionCall[name=AGG,is_distinct=true]
+      | |   +-AttributeReference[attribute_name=x]
+      | +-SelectListItem
+      |   +-FunctionCall[name=AGG]
+      |     +-AttributeReference[attribute_name=y]
+      +-group_by=GroupBy
+      | +-AttributeReference[attribute_name=z]
+      +-from_clause=
+        +-TableReference[table=test]
 ==
 
 SELECT AGG(DISTINCT FUN(x) + y) * AGG(z)
@@ -192,29 +206,31 @@ FROM test
 GROUP BY z
 HAVING AGG(DISTINCT w) + AGG(s) > 1
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Multiply
-  |     +-left_operand=FunctionCall[name=AGG,is_distinct=true]
-  |     | +-Add
-  |     |   +-left_operand=FunctionCall[name=FUN]
-  |     |   | +-AttributeReference[attribute_name=x]
-  |     |   +-right_operand=AttributeReference[attribute_name=y]
-  |     +-right_operand=FunctionCall[name=AGG]
-  |       +-AttributeReference[attribute_name=z]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=z]
-  +-having=HAVING
-  | +-Greater
-  |   +-left_operand=Add
-  |   | +-left_operand=FunctionCall[name=AGG,is_distinct=true]
-  |   | | +-AttributeReference[attribute_name=w]
-  |   | +-right_operand=FunctionCall[name=AGG]
-  |   |   +-AttributeReference[attribute_name=s]
-  |   +-right_operand=Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectList
+      | +-SelectListItem
+      |   +-Multiply
+      |     +-left_operand=FunctionCall[name=AGG,is_distinct=true]
+      |     | +-Add
+      |     |   +-left_operand=FunctionCall[name=FUN]
+      |     |   | +-AttributeReference[attribute_name=x]
+      |     |   +-right_operand=AttributeReference[attribute_name=y]
+      |     +-right_operand=FunctionCall[name=AGG]
+      |       +-AttributeReference[attribute_name=z]
+      +-group_by=GroupBy
+      | +-AttributeReference[attribute_name=z]
+      +-having=HAVING
+      | +-Greater
+      |   +-left_operand=Add
+      |   | +-left_operand=FunctionCall[name=AGG,is_distinct=true]
+      |   | | +-AttributeReference[attribute_name=w]
+      |   | +-right_operand=FunctionCall[name=AGG]
+      |   |   +-AttributeReference[attribute_name=s]
+      |   +-right_operand=Literal
+      |     +-NumericLiteral[numeric_string=1,float_like=false]
+      +-from_clause=
+        +-TableReference[table=test]
 ==

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5b7b5cb8/parser/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/parser/tests/CMakeLists.txt b/parser/tests/CMakeLists.txt
index 9b461ec..63bcd1c 100644
--- a/parser/tests/CMakeLists.txt
+++ b/parser/tests/CMakeLists.txt
@@ -68,6 +68,10 @@ add_test(quickstep_parser_tests_ParserTest_select
          quickstep_parser_tests_ParserTest
          "${CMAKE_CURRENT_SOURCE_DIR}/Select.test"
          "${CMAKE_CURRENT_BINARY_DIR}/Select.test")
+add_test(quickstep_parser_tests_ParserTest_setoperation
+         quickstep_parser_tests_ParserTest
+         "${CMAKE_CURRENT_SOURCE_DIR}/SetOperation.test"
+         "${CMAKE_CURRENT_BINARY_DIR}/SetOperation.test")
 add_test(quickstep_parser_tests_ParserTest_tpch
          quickstep_parser_tests_ParserTest
          "${CMAKE_CURRENT_SOURCE_DIR}/TPCH.test"

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5b7b5cb8/parser/tests/Join.test
----------------------------------------------------------------------
diff --git a/parser/tests/Join.test b/parser/tests/Join.test
index 63edeb4..d8ac83f 100644
--- a/parser/tests/Join.test
+++ b/parser/tests/Join.test
@@ -20,26 +20,31 @@ FROM a JOIN b ON a.w = b.w
        JOIN c ON a.x = c.x
        JOIN d ON a.y = d.y;
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=InnerJoin]
-      +-left_table=JoinedTable[join_type=InnerJoin]
-      | +-left_table=JoinedTable[join_type=InnerJoin]
-      | | +-left_table=TableReference[table=a]
-      | | +-right_table=TableReference[table=b]
-      | | +-join_predicate=Equal
-      | |   +-left_operand=AttributeReference[attribute_name=w,relation_name=a]
-      | |   +-right_operand=AttributeReference[attribute_name=w,relation_name=b]
-      | +-right_table=TableReference[table=c]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
-      |   +-right_operand=AttributeReference[attribute_name=x,relation_name=c]
-      +-right_table=TableReference[table=d]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=y,relation_name=a]
-        +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectStar
+      +-from_clause=
+        +-JoinedTable[join_type=InnerJoin]
+          +-left_table=JoinedTable[join_type=InnerJoin]
+          | +-left_table=JoinedTable[join_type=InnerJoin]
+          | | +-left_table=TableReference[table=a]
+          | | +-right_table=TableReference[table=b]
+          | | +-join_predicate=Equal
+          | |   +-left_operand=AttributeReference[attribute_name=w,
+          | |   | relation_name=a]
+          | |   +-right_operand=AttributeReference[attribute_name=w,
+          | |     relation_name=b]
+          | +-right_table=TableReference[table=c]
+          | +-join_predicate=Equal
+          |   +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
+          |   +-right_operand=AttributeReference[attribute_name=x,
+          |     relation_name=c]
+          +-right_table=TableReference[table=d]
+          +-join_predicate=Equal
+            +-left_operand=AttributeReference[attribute_name=y,relation_name=a]
+            +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
 ==
 
 SELECT *
@@ -50,30 +55,36 @@ WHERE a1.x > b1.x
   AND a1.y > c1.y
   AND a1.z > d1.z;
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=InnerJoin]
-      +-left_table=JoinedTable[join_type=InnerJoin]
-      | +-left_table=JoinedTable[join_type=InnerJoin]
-      | | +-left_table=TableReference[table=a]
-      | | | +-table_signature=TableSignature[table_alias=a1]
-      | | +-right_table=TableReference[table=b]
-      | | | +-table_signature=TableSignature[table_alias=b1]
-      | | +-join_predicate=Equal
-      | |   +-left_operand=AttributeReference[attribute_name=w,relation_name=a1]
-      | |   +-right_operand=AttributeReference[attribute_name=w,relation_name=b1]
-      | +-right_table=TableReference[table=c]
-      | | +-table_signature=TableSignature[table_alias=c1]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=x,relation_name=a1]
-      |   +-right_operand=AttributeReference[attribute_name=x,relation_name=c1]
-      +-right_table=TableReference[table=d]
-      | +-table_signature=TableSignature[table_alias=d1]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=y,relation_name=a1]
-        +-right_operand=AttributeReference[attribute_name=y,relation_name=d1]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectStar
+      +-from_clause=
+        +-JoinedTable[join_type=InnerJoin]
+          +-left_table=JoinedTable[join_type=InnerJoin]
+          | +-left_table=JoinedTable[join_type=InnerJoin]
+          | | +-left_table=TableReference[table=a]
+          | | | +-table_signature=TableSignature[table_alias=a1]
+          | | +-right_table=TableReference[table=b]
+          | | | +-table_signature=TableSignature[table_alias=b1]
+          | | +-join_predicate=Equal
+          | |   +-left_operand=AttributeReference[attribute_name=w,
+          | |   | relation_name=a1]
+          | |   +-right_operand=AttributeReference[attribute_name=w,
+          | |     relation_name=b1]
+          | +-right_table=TableReference[table=c]
+          | | +-table_signature=TableSignature[table_alias=c1]
+          | +-join_predicate=Equal
+          |   +-left_operand=AttributeReference[attribute_name=x,
+          |   | relation_name=a1]
+          |   +-right_operand=AttributeReference[attribute_name=x,
+          |     relation_name=c1]
+          +-right_table=TableReference[table=d]
+          | +-table_signature=TableSignature[table_alias=d1]
+          +-join_predicate=Equal
+            +-left_operand=AttributeReference[attribute_name=y,relation_name=a1]
+            +-right_operand=AttributeReference[attribute_name=y,relation_name=d1]
 ==
 
 SELECT *
@@ -81,82 +92,97 @@ FROM a LEFT OUTER JOIN b ON a.w = b.w
        RIGHT OUTER JOIN c ON a.x = c.x
        FULL OUTER JOIN d ON a.y = d.y;
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=FullOuterJoin]
-      +-left_table=JoinedTable[join_type=RightOuterJoin]
-      | +-left_table=JoinedTable[join_type=LeftOuterJoin]
-      | | +-left_table=TableReference[table=a]
-      | | +-right_table=TableReference[table=b]
-      | | +-join_predicate=Equal
-      | |   +-left_operand=AttributeReference[attribute_name=w,relation_name=a]
-      | |   +-right_operand=AttributeReference[attribute_name=w,relation_name=b]
-      | +-right_table=TableReference[table=c]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
-      |   +-right_operand=AttributeReference[attribute_name=x,relation_name=c]
-      +-right_table=TableReference[table=d]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=y,relation_name=a]
-        +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectStar
+      +-from_clause=
+        +-JoinedTable[join_type=FullOuterJoin]
+          +-left_table=JoinedTable[join_type=RightOuterJoin]
+          | +-left_table=JoinedTable[join_type=LeftOuterJoin]
+          | | +-left_table=TableReference[table=a]
+          | | +-right_table=TableReference[table=b]
+          | | +-join_predicate=Equal
+          | |   +-left_operand=AttributeReference[attribute_name=w,
+          | |   | relation_name=a]
+          | |   +-right_operand=AttributeReference[attribute_name=w,
+          | |     relation_name=b]
+          | +-right_table=TableReference[table=c]
+          | +-join_predicate=Equal
+          |   +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
+          |   +-right_operand=AttributeReference[attribute_name=x,
+          |     relation_name=c]
+          +-right_table=TableReference[table=d]
+          +-join_predicate=Equal
+            +-left_operand=AttributeReference[attribute_name=y,relation_name=a]
+            +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
 ==
 
 SELECT *
 FROM a INNER JOIN b ON (a.w = b.w OR a.x > b.y);
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=InnerJoin]
-      +-left_table=TableReference[table=a]
-      +-right_table=TableReference[table=b]
-      +-join_predicate=Or
-        +-Equal
-        | +-left_operand=AttributeReference[attribute_name=w,relation_name=a]
-        | +-right_operand=AttributeReference[attribute_name=w,relation_name=b]
-        +-Greater
-          +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
-          +-right_operand=AttributeReference[attribute_name=y,relation_name=b]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectStar
+      +-from_clause=
+        +-JoinedTable[join_type=InnerJoin]
+          +-left_table=TableReference[table=a]
+          +-right_table=TableReference[table=b]
+          +-join_predicate=Or
+            +-Equal
+            | +-left_operand=AttributeReference[attribute_name=w,relation_name=a]
+            | +-right_operand=AttributeReference[attribute_name=w,
+            |   relation_name=b]
+            +-Greater
+              +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
+              +-right_operand=AttributeReference[attribute_name=y,
+                relation_name=b]
 ==
 
 SELECT *
 FROM b LEFT JOIN c ON b.x = c.x JOIN d ON c.y = d.y;
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=InnerJoin]
-      +-left_table=JoinedTable[join_type=LeftOuterJoin]
-      | +-left_table=TableReference[table=b]
-      | +-right_table=TableReference[table=c]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=x,relation_name=b]
-      |   +-right_operand=AttributeReference[attribute_name=x,relation_name=c]
-      +-right_table=TableReference[table=d]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=y,relation_name=c]
-        +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectStar
+      +-from_clause=
+        +-JoinedTable[join_type=InnerJoin]
+          +-left_table=JoinedTable[join_type=LeftOuterJoin]
+          | +-left_table=TableReference[table=b]
+          | +-right_table=TableReference[table=c]
+          | +-join_predicate=Equal
+          |   +-left_operand=AttributeReference[attribute_name=x,relation_name=b]
+          |   +-right_operand=AttributeReference[attribute_name=x,
+          |     relation_name=c]
+          +-right_table=TableReference[table=d]
+          +-join_predicate=Equal
+            +-left_operand=AttributeReference[attribute_name=y,relation_name=c]
+            +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
 ==
 
 SELECT *
 FROM b LEFT JOIN (c JOIN d ON c.y = d.y) ON b.x = c.x;
 --
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=LeftOuterJoin]
-      +-left_table=TableReference[table=b]
-      +-right_table=JoinedTable[join_type=InnerJoin]
-      | +-left_table=TableReference[table=c]
-      | +-right_table=TableReference[table=d]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=y,relation_name=c]
-      |   +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=x,relation_name=b]
-        +-right_operand=AttributeReference[attribute_name=x,relation_name=c]
+SetOperationStatement
++-set_operation_query=SetOperation[set_operation_type=Select]
+  +-children=
+    +-Select
+      +-select_clause=SelectStar
+      +-from_clause=
+        +-JoinedTable[join_type=LeftOuterJoin]
+          +-left_table=TableReference[table=b]
+          +-right_table=JoinedTable[join_type=InnerJoin]
+          | +-left_table=TableReference[table=c]
+          | +-right_table=TableReference[table=d]
+          | +-join_predicate=Equal
+          |   +-left_operand=AttributeReference[attribute_name=y,relation_name=c]
+          |   +-right_operand=AttributeReference[attribute_name=y,
+          |     relation_name=d]
+          +-join_predicate=Equal
+            +-left_operand=AttributeReference[attribute_name=x,relation_name=b]
+            +-right_operand=AttributeReference[attribute_name=x,relation_name=c]


Mime
View raw message