Skip to content

Commit

Permalink
feat(online): union all query (4paradigm#3590)
Browse files Browse the repository at this point in the history
* feat(online): union query

* refactor: group_and_sort_optimized

Re-impl column to source info in physical node, support multiple result
source info, previously it is one result only.

Multiple source result is required for SetOperationNode, like union all,
every input node may produce the target column.
  • Loading branch information
aceforeverd authored Dec 4, 2023
1 parent d1d2e38 commit 85926ce
Show file tree
Hide file tree
Showing 39 changed files with 1,902 additions and 547 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
22 changes: 0 additions & 22 deletions cases/plan/error_request_query.yaml

This file was deleted.

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 85926ce

Please sign in to comment.