Skip to content

Commit

Permalink
feat: union query
Browse files Browse the repository at this point in the history
  • Loading branch information
aceforeverd committed Nov 14, 2023
1 parent 927744e commit 0bf34d0
Show file tree
Hide file tree
Showing 33 changed files with 1,251 additions and 417 deletions.
196 changes: 96 additions & 100 deletions cases/plan/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -437,44 +437,45 @@ cases:
| +-is_constant: 0
+-inner_node_list[list]:
+-0:
+-node[kQuery]: kQueryUnion
+-union_type: ALL UNION
+-left:
| +-node[kQuery]: kQuerySelect
| +-distinct_opt: false
| +-where_expr: null
| +-group_expr_list: null
| +-having_expr: null
| +-order_expr_list: null
| +-limit: null
| +-select_list[list]:
| | +-0:
| | +-node[kResTarget]
| | +-val:
| | | +-expr[primary]
| | | +-value: 1
| | | +-type: int32
| | +-name: <nil>
| +-tableref_list: []
| +-window_list: []
+-right:
+-node[kQuery]: kQuerySelect
+-distinct_opt: false
+-where_expr: null
+-group_expr_list: null
+-having_expr: null
+-order_expr_list: null
+-limit: null
+-select_list[list]:
| +-0:
| +-node[kResTarget]
| +-val:
| | +-expr[primary]
| | +-value: 2
| | +-type: int32
| +-name: <nil>
+-tableref_list: []
+-window_list: []
+-node[kQuery]: kQuerySetOperation
+-operator: UNION ALL
+-inputs[list]:
+-0:
| +-node[kQuery]: kQuerySelect
| +-distinct_opt: false
| +-where_expr: null
| +-group_expr_list: null
| +-having_expr: null
| +-order_expr_list: null
| +-limit: null
| +-select_list[list]:
| | +-0:
| | +-node[kResTarget]
| | +-val:
| | | +-expr[primary]
| | | +-value: 1
| | | +-type: int32
| | +-name: <nil>
| +-tableref_list: []
| +-window_list: []
+-1:
+-node[kQuery]: kQuerySelect
+-distinct_opt: false
+-where_expr: null
+-group_expr_list: null
+-having_expr: null
+-order_expr_list: null
+-limit: null
+-select_list[list]:
| +-0:
| +-node[kResTarget]
| +-val:
| | +-expr[primary]
| | +-value: 2
| | +-type: int32
| +-name: <nil>
+-tableref_list: []
+-window_list: []
- id: 21_create_procedure
desc: create procedure, parameters and union distinct query
Expand Down Expand Up @@ -515,68 +516,63 @@ cases:
| +-is_constant: 0
+-inner_node_list[list]:
+-0:
+-node[kQuery]: kQueryUnion
+-union_type: DISTINCT UNION
+-left:
| +-node[kQuery]: kQueryUnion
| +-union_type: DISTINCT UNION
| +-left:
| | +-node[kQuery]: kQuerySelect
| | +-distinct_opt: false
| | +-where_expr: null
| | +-group_expr_list: null
| | +-having_expr: null
| | +-order_expr_list: null
| | +-limit: null
| | +-select_list[list]:
| | | +-0:
| | | +-node[kResTarget]
| | | +-val:
| | | | +-expr[primary]
| | | | +-value: 1
| | | | +-type: int32
| | | +-name: <nil>
| | +-tableref_list: []
| | +-window_list: []
| +-right:
| +-node[kQuery]: kQuerySelect
| +-distinct_opt: false
| +-where_expr: null
| +-group_expr_list: null
| +-having_expr: null
| +-order_expr_list: null
| +-limit: null
| +-select_list[list]:
| | +-0:
| | +-node[kResTarget]
| | +-val:
| | | +-expr[primary]
| | | +-value: 2
| | | +-type: int32
| | +-name: <nil>
| +-tableref_list: []
| +-window_list: []
+-right:
+-node[kQuery]: kQuerySelect
+-distinct_opt: false
+-where_expr: null
+-group_expr_list: null
+-having_expr: null
+-order_expr_list: null
+-limit: null
+-select_list[list]:
| +-0:
| +-node[kResTarget]
| +-val:
| | +-expr[primary]
| | +-value: 3
| | +-type: int32
| +-name: <nil>
+-tableref_list: []
+-window_list: []
+-node[kQuery]: kQuerySetOperation
+-operator: UNION DISTINCT
+-inputs[list]:
+-0:
| +-node[kQuery]: kQuerySelect
| +-distinct_opt: false
| +-where_expr: null
| +-group_expr_list: null
| +-having_expr: null
| +-order_expr_list: null
| +-limit: null
| +-select_list[list]:
| | +-0:
| | +-node[kResTarget]
| | +-val:
| | | +-expr[primary]
| | | +-value: 1
| | | +-type: int32
| | +-name: <nil>
| +-tableref_list: []
| +-window_list: []
+-1:
| +-node[kQuery]: kQuerySelect
| +-distinct_opt: false
| +-where_expr: null
| +-group_expr_list: null
| +-having_expr: null
| +-order_expr_list: null
| +-limit: null
| +-select_list[list]:
| | +-0:
| | +-node[kResTarget]
| | +-val:
| | | +-expr[primary]
| | | +-value: 2
| | | +-type: int32
| | +-name: <nil>
| +-tableref_list: []
| +-window_list: []
+-2:
+-node[kQuery]: kQuerySelect
+-distinct_opt: false
+-where_expr: null
+-group_expr_list: null
+-having_expr: null
+-order_expr_list: null
+-limit: null
+-select_list[list]:
| +-0:
| +-node[kResTarget]
| +-val:
| | +-expr[primary]
| | +-value: 3
| | +-type: int32
| +-name: <nil>
+-tableref_list: []
+-window_list: []
- id: 22
desc: create index 1
Expand Down
85 changes: 43 additions & 42 deletions cases/plan/simple_query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -466,53 +466,54 @@ cases:
SELECT * FROM t1 UNION ALL SELECT * FROM t3 CONFIG ( zone = 'middle' );
expect:
node_tree_str: |
+-node[kQuery]: kQueryUnion
+-node[kQuery]: kQuerySetOperation
+-config_options:
| +-zone:
| +-expr[primary]
| +-value: middle
| +-type: string
+-union_type: ALL UNION
+-left:
| +-node[kQuery]: kQuerySelect
| +-distinct_opt: false
| +-where_expr: null
| +-group_expr_list: null
| +-having_expr: null
| +-order_expr_list: null
| +-limit: null
| +-select_list[list]:
| | +-0:
| | +-node[kResTarget]
| | +-val:
| | | +-expr[all]
| | +-name: <nil>
| +-tableref_list[list]:
| | +-0:
| | +-node[kTableRef]: kTable
| | +-table: t1
| | +-alias: <nil>
| +-window_list: []
+-right:
+-node[kQuery]: kQuerySelect
+-distinct_opt: false
+-where_expr: null
+-group_expr_list: null
+-having_expr: null
+-order_expr_list: null
+-limit: null
+-select_list[list]:
| +-0:
| +-node[kResTarget]
| +-val:
| | +-expr[all]
| +-name: <nil>
+-tableref_list[list]:
| +-0:
| +-node[kTableRef]: kTable
| +-table: t3
| +-alias: <nil>
+-window_list: []
+-operator: UNION ALL
+-inputs[list]:
+-0:
| +-node[kQuery]: kQuerySelect
| +-distinct_opt: false
| +-where_expr: null
| +-group_expr_list: null
| +-having_expr: null
| +-order_expr_list: null
| +-limit: null
| +-select_list[list]:
| | +-0:
| | +-node[kResTarget]
| | +-val:
| | | +-expr[all]
| | +-name: <nil>
| +-tableref_list[list]:
| | +-0:
| | +-node[kTableRef]: kTable
| | +-table: t1
| | +-alias: <nil>
| +-window_list: []
+-1:
+-node[kQuery]: kQuerySelect
+-distinct_opt: false
+-where_expr: null
+-group_expr_list: null
+-having_expr: null
+-order_expr_list: null
+-limit: null
+-select_list[list]:
| +-0:
| +-node[kResTarget]
| +-val:
| | +-expr[all]
| +-name: <nil>
+-tableref_list[list]:
| +-0:
| +-node[kTableRef]: kTable
| +-table: t3
| +-alias: <nil>
+-window_list: []
- id: array
desc: |
array query
Expand Down
Loading

0 comments on commit 0bf34d0

Please sign in to comment.