Commit 2f8bbba
authored
feat: Distributed Procedure Support Part 1/X - core code base changes (#26373)
## Description
This PR is the first part of many PRs to support distributed procedure
into Presto. It is a split of the original entire PR which is located
here: #22659.
The whole work in this PR includes the following parts:
1. Re-factor `ProcedureRegistry`/`Procedure` data structure to support
the creation and register of `DistributedProcedure`. And make sure
`ProcedureRegistry` be available in `presto-analyzer` module and
connectors, so that we can recognize distributed procedures in call
statement during prepare analyze stages.
2. Handle call statement on distributed procedures in preparer stage. In
this stage, we figure out the procedure's type in call statement, and
define a new query type `CALL_DISTRIBUTED_PROCEDURE` for `call
distributed procedure` in `BuiltInPreparedQuery`. In this way, `call
distributed procedure` statement would be handled by
`SqlQueryExecutionFactory`, then be created and handled as a
`SqlQueryExecution`.
3. Analyze and plan the `call distributed procedure` statement based on
the subtype of the distributed procedure. For subtype
`TableDataRewriteDistributedProcedure`, ultimately generate a logical
plan for it as follows:
```
OutputNode <- TableFinishNode <- CallDistributedProcedureNode <- FilterNode <- TableScanNode
```
4. Optimize, segmentation, grouped tag and local plan for the logical
plan generated above. The handle logical for
`CallDistributedProcedureNode` is similar as `TableWriterNode`. Besides,
a new optimizer `RewriteWriterTarget` is added, which is placed after
all optimization rules. It is used to update the `TableHandle` held in
`TableFinishNode` and `CallDistributedProcedureNode` based on the
underlying `TableScanNode` after the entire optimization is completed,
considering the possible filter pushing down.
## Motivation and Context
prestodb/rfcs#12
## Impact
N/A
## Test Plan
- Add test cases in each phase involving the procedure architecture
expansion, including creating and registering for distributed
procedures, preparing for call distributed procedure, analyzing for call
distributed procedure, logical planning and optimizing for call
distributed procedure
## Contributor checklist
- [x] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards).
- [x] PR description addresses the issue accurately and concisely. If
the change is non-trivial, a GitHub Issue is referenced.
- [ ] Documented new properties (with its default value), SQL syntax,
functions, or other functionality.
- [x] If release notes are required, they follow the [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [x] Adequate tests were added if applicable.
- [x] CI passed.
- [ ] If adding new dependencies, verified they have an [OpenSSF
Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or
higher (or obtained explicit TSC approval for lower scores).
## Release Notes
```
== RELEASE NOTES ==
General Changes
* Upgrade the procedure architecture to support distributed executing procedures
```1 parent 1a10043 commit 2f8bbba
File tree
109 files changed
+4090
-813
lines changed- presto-analyzer/src
- main/java/com/facebook/presto/sql/analyzer
- utils
- test/java/com/facebook/presto/sql/analyzer
- presto-common/src/main/java/com/facebook/presto/common
- resourceGroups
- presto-iceberg/src/main/java/com/facebook/presto/iceberg
- procedure
- presto-main-base/src
- main/java/com/facebook/presto
- connector
- execution
- scheduler
- metadata
- operator
- split
- sql
- analyzer
- planner
- optimizations
- planPrinter
- plan
- sanity
- rewrite
- testing
- util
- test/java/com/facebook/presto
- execution
- metadata
- sql
- analyzer
- planner
- presto-main/src
- main/java/com/facebook/presto/server
- test/java/com/facebook/presto/server/remotetask
- presto-native-execution/presto_cpp/presto_protocol
- connector
- hive
- iceberg
- tpch
- core
- special
- presto-parser/src/main/java/com/facebook/presto/sql/tree
- presto-spark-base/src/main/java/com/facebook/presto/spark
- presto-spi/src/main/java/com/facebook/presto/spi
- analyzer
- connector
- classloader
- plan
- procedure
- presto-tests/src/test/java/com/facebook/presto/tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
109 files changed
+4090
-813
lines changedLines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
179 | 187 | | |
180 | 188 | | |
181 | 189 | | |
| |||
670 | 678 | | |
671 | 679 | | |
672 | 680 | | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
673 | 721 | | |
674 | 722 | | |
675 | 723 | | |
| |||
1044 | 1092 | | |
1045 | 1093 | | |
1046 | 1094 | | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
1047 | 1105 | | |
1048 | 1106 | | |
1049 | 1107 | | |
| |||
Lines changed: 41 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
| 53 | + | |
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
| |||
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
| 67 | + | |
59 | 68 | | |
60 | 69 | | |
61 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
62 | 73 | | |
63 | 74 | | |
| 75 | + | |
64 | 76 | | |
65 | 77 | | |
66 | 78 | | |
| |||
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
90 | 114 | | |
91 | 115 | | |
92 | 116 | | |
| |||
103 | 127 | | |
104 | 128 | | |
105 | 129 | | |
106 | | - | |
| 130 | + | |
107 | 131 | | |
108 | 132 | | |
109 | 133 | | |
| |||
131 | 155 | | |
132 | 156 | | |
133 | 157 | | |
| 158 | + | |
134 | 159 | | |
135 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
136 | 165 | | |
137 | 166 | | |
138 | 167 | | |
139 | 168 | | |
140 | 169 | | |
| 170 | + | |
141 | 171 | | |
142 | 172 | | |
143 | 173 | | |
| |||
157 | 187 | | |
158 | 188 | | |
159 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
160 | 193 | | |
161 | 194 | | |
162 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
163 | 201 | | |
164 | 202 | | |
165 | 203 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments