Commit cb66f9a
perf: cache and broadcast serialized plans across partitions
Serialize native query plans once and broadcast to all executors,
avoiding repeated protobuf serialization for each partition.
This optimization:
- Adds serializePlan() method to serialize an Operator once
- Adds getCometIterator() overload accepting pre-serialized bytes
- Updates getNativeLimitRDD to broadcast the serialized plan
- Updates CometTakeOrderedAndProjectExec to broadcast the topK plan
For a query with 1000 partitions across 10 executors, this reduces
plan serialization from 1000x to 1x, and plan transfer from 1000x
to 10x (once per executor via broadcast).
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 86f6eb6 commit cb66f9a
File tree
3 files changed
+56
-12
lines changed- spark/src/main/scala/org/apache/spark/sql/comet
3 files changed
+56
-12
lines changedLines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
56 | 61 | | |
57 | | - | |
58 | | - | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
| |||
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
136 | 143 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
142 | 150 | | |
143 | 151 | | |
144 | 152 | | |
| |||
Lines changed: 37 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
117 | 131 | | |
118 | 132 | | |
119 | 133 | | |
| |||
131 | 145 | | |
132 | 146 | | |
133 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
134 | 170 | | |
135 | 171 | | |
136 | 172 | | |
| |||
140 | 176 | | |
141 | 177 | | |
142 | 178 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 179 | + | |
148 | 180 | | |
149 | 181 | | |
150 | 182 | | |
| |||
0 commit comments