Commit dc78613
Move partition handling out of PhysicalExprAdapter (#19128)
This PR does some refactoring of `PhysicalExprAdapter` and
`PhysicalExprSimplifier` that I found necessary and/or beneficial while
working on #19111.
## Changes made
### Replace `PhysicalExprAdapter::with_partition_values` with
`replace_columns_with_literals`
This is a nice improvement because it:
1. Makes the `PhysicalExprAdapter` trait that users might need to
implement simpler (less boilerplate for users).
2. Decouples these two transformations so that we can replace partition
values and then apply a projection without having to also do the schema
mapping (it would be from the logical schema to the logical schema,
confusing and a waste of compute). I ran into this need in
#19111. I think there may be
other ways of doing it (e.g. piping in the expected output schema from
ParquetSource) but it felt nicer this way and I expect other places may
also need the decoupled transformation.
3. I think we can use it in the future to implement #19089 (edit:
evidently I was right, see identical function in
#19136).
4. It's less lines of code 😄
This will require any users calling `PhysicalExprAdapter` directly to
change their code, I can add an entry to the upgrade guide.
### Remove partition pruning logic from `FilePruner` and deprecate now
unused `PrunableStatistics` and `CompositePruningStatistics`.
Since we replace partition values with literals we no longer need these
structures, they get handled like any other literals.
This is a good chunk of code / complexity that we can bin off.
### Use `TableSchema` instead of `SchemaRef` + `Vec<FieldRef>` in
`ParquetOpener`
`TableSchema` is basically `SchemaRef` + `Vec<FieldRef>` already and
since `ParquetSource` has a `TableSchema` its less code and less clones
to propagate that into `ParquetOpener`
---------
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>1 parent 7ac40d7 commit dc78613
File tree
13 files changed
+445
-409
lines changed- datafusion-examples/examples
- custom_data_source
- data_io
- datafusion
- common/src
- core
- src/datasource
- tests
- parquet
- schema_adapter
- datasource-parquet/src
- physical-expr-adapter/src
- pruning/src
- docs/source/library-user-guide
13 files changed
+445
-409
lines changedLines changed: 2 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | 212 | | |
Lines changed: 36 additions & 98 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
47 | | - | |
| 45 | + | |
| 46 | + | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| |||
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
63 | | - | |
| 62 | + | |
64 | 63 | | |
65 | | - | |
| 64 | + | |
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
| 71 | + | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
| |||
138 | 137 | | |
139 | 138 | | |
140 | 139 | | |
141 | | - | |
142 | | - | |
| 140 | + | |
| 141 | + | |
143 | 142 | | |
144 | 143 | | |
145 | 144 | | |
| |||
206 | 205 | | |
207 | 206 | | |
208 | 207 | | |
209 | | - | |
| 208 | + | |
210 | 209 | | |
211 | 210 | | |
212 | 211 | | |
| |||
227 | 226 | | |
228 | 227 | | |
229 | 228 | | |
230 | | - | |
| 229 | + | |
231 | 230 | | |
232 | 231 | | |
233 | 232 | | |
| |||
280 | 279 | | |
281 | 280 | | |
282 | 281 | | |
283 | | - | |
284 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
285 | 286 | | |
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
289 | 290 | | |
290 | | - | |
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | 302 | | |
304 | 303 | | |
305 | 304 | | |
306 | 305 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
370 | 312 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | 313 | | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
389 | 321 | | |
390 | 322 | | |
391 | | - | |
392 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
393 | 330 | | |
394 | | - | |
| 331 | + | |
| 332 | + | |
395 | 333 | | |
396 | 334 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
282 | 284 | | |
283 | 285 | | |
284 | | - | |
285 | 286 | | |
286 | 287 | | |
287 | | - | |
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
297 | 296 | | |
298 | 297 | | |
299 | | - | |
300 | 298 | | |
301 | 299 | | |
302 | 300 | | |
| |||
307 | 305 | | |
308 | 306 | | |
309 | 307 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 308 | + | |
| 309 | + | |
331 | 310 | | |
332 | 311 | | |
333 | 312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
138 | 142 | | |
139 | 143 | | |
140 | 144 | | |
| |||
156 | 160 | | |
157 | 161 | | |
158 | 162 | | |
| 163 | + | |
159 | 164 | | |
160 | 165 | | |
161 | 166 | | |
| |||
232 | 237 | | |
233 | 238 | | |
234 | 239 | | |
| 240 | + | |
235 | 241 | | |
236 | 242 | | |
237 | 243 | | |
| |||
439 | 445 | | |
440 | 446 | | |
441 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
442 | 452 | | |
443 | 453 | | |
444 | 454 | | |
445 | 455 | | |
| 456 | + | |
446 | 457 | | |
447 | 458 | | |
448 | 459 | | |
| |||
457 | 468 | | |
458 | 469 | | |
459 | 470 | | |
| 471 | + | |
460 | 472 | | |
461 | 473 | | |
462 | 474 | | |
| |||
513 | 525 | | |
514 | 526 | | |
515 | 527 | | |
| 528 | + | |
516 | 529 | | |
517 | 530 | | |
518 | 531 | | |
| |||
0 commit comments