Commit 3ca7a7f
perf: cache serialized query plans to avoid per-partition serialization
Add caching for serialized protobuf query plans to avoid serializing
the same plan repeatedly for every partition in CometExecIterator.
Changes:
- Add serializeNativePlan() helper method in CometExec
- Add getCometIterator() overload accepting pre-serialized bytes
- Update CometExecUtils.getNativeLimitRDD to serialize once
- Update CometTakeOrderedAndProjectExec to serialize plans once
For a query with N partitions, this eliminates N-1 redundant protobuf
serializations per affected code path, reducing CPU overhead and GC
pressure during query execution.
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 0a6f97d commit 3ca7a7f
File tree
3 files changed
+60
-16
lines changed- spark/src/main/scala/org/apache/spark/sql/comet
3 files changed
+60
-16
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
56 | 59 | | |
57 | | - | |
58 | | - | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
Lines changed: 20 additions & 9 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 | + | |
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| |||
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
157 | 166 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
162 | 173 | | |
163 | 174 | | |
164 | 175 | | |
| |||
Lines changed: 36 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
116 | 129 | | |
117 | 130 | | |
118 | 131 | | |
| |||
130 | 143 | | |
131 | 144 | | |
132 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
133 | 168 | | |
134 | 169 | | |
135 | 170 | | |
| |||
139 | 174 | | |
140 | 175 | | |
141 | 176 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 177 | + | |
147 | 178 | | |
148 | 179 | | |
149 | 180 | | |
| |||
0 commit comments