Commit 9ae9035
authored
refactor(cubesql): Move all wrapper replacers params to separate enode (#9105)
Move all replacer parameters from `WrapperPushdownReplacer` and `WrapperPullupReplacer` to separate node variant `WrapperReplacerContext`.
Because of the way our current `plan_to_language!` works, for every non-recusive param in input enum it generates separate wrapper struct on Rust side. So, before this we had separate `WrapperPushdownReplacerPushToCube` and `WrapperPullupReplacerPushToCube`. And, because they are separate terminal variants, one can't just copy those in patterns, and had to do it in Rust code, like in `transforming_rewrite`.
This change allows:
* Copy context parts between push-down and pull-up replacers directly in patterns
* Completely ignore context in patterns, like `wrapper_pushdown_replacer(cast_expr("?expr", "?data_type"), "?context")` => `cast_expr(wrapper_pushdown_replacer("?expr", "?context"), "?data_type")`
* Share same eclass with context for a whole replacer stage, instead of one for push-down and one for pull-up
All of this simplifies adding new parameters, and have measurable performance boost. On my laptop I measured from about 1 to 11% boost, depending on a benchmark. For example:
```
power_bi_wrap time: [38.386 ms 38.482 ms 38.624 ms]
change: [-4.7016% -4.3391% -3.9957%] (p = 0.00 < 0.05)
Performance has improved.
...
large_model_1000_select_all_dimensions_with_filter
time: [190.47 ms 190.88 ms 191.17 ms]
change: [-12.353% -11.824% -11.374%] (p = 0.00 < 0.05)
Performance has improved.
```1 parent fc5efb2 commit 9ae9035
File tree
31 files changed
+1426
-2706
lines changed- rust/cubesql/cubesql/src/compile/rewrite
- rules/wrapper
31 files changed
+1426
-2706
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
458 | | - | |
| 457 | + | |
459 | 458 | | |
460 | | - | |
461 | | - | |
| 459 | + | |
| 460 | + | |
462 | 461 | | |
463 | 462 | | |
464 | 463 | | |
| |||
471 | 470 | | |
472 | 471 | | |
473 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
474 | 480 | | |
475 | 481 | | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
491 | 486 | | |
492 | 487 | | |
493 | 488 | | |
| |||
1973 | 1968 | | |
1974 | 1969 | | |
1975 | 1970 | | |
1976 | | - | |
1977 | | - | |
| 1971 | + | |
1978 | 1972 | | |
1979 | 1973 | | |
1980 | 1974 | | |
1981 | 1975 | | |
1982 | 1976 | | |
1983 | 1977 | | |
1984 | 1978 | | |
1985 | | - | |
| 1979 | + | |
1986 | 1980 | | |
1987 | 1981 | | |
1988 | 1982 | | |
1989 | | - | |
1990 | | - | |
1991 | | - | |
1992 | | - | |
1993 | | - | |
1994 | | - | |
1995 | | - | |
1996 | | - | |
1997 | | - | |
1998 | | - | |
1999 | | - | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
2000 | 1989 | | |
2001 | 1990 | | |
2002 | 1991 | | |
| |||
0 commit comments