Repository navigation
Commit 85bc5ef
authored
fix: Projection stats Absent for columns referenced >1 time (apache#22679)
## Which issue does this PR close?
- Closes apache#22678.
## Rationale for this change
`ProjectionExprs::project_statistics` uses `std::mem::take` to move an
input column's `ColumnStatistics` into the output when given a direct
column reference. This means if the column is referenced again (either
directly or in a `CAST` expression), the statistics are `Absent`. The
simple fix is to just `clone` instead of `take`.
This pattern crops up in TPC-DS q54, which includes a CTE that projects
both `d_date_sk` and `CAST(d_date_sk AS Float64)`, but it's a more
general bug.
## What changes are included in this PR?
* Fix bug
* Add unit tests
## Are these changes tested?
Yes; new test added.
## Are there any user-facing changes?
No.1 parent 73e3c2a commit 85bc5ef
1 file changed
Lines changed: 51 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
| 664 | + | |
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
| |||
2866 | 2866 | | |
2867 | 2867 | | |
2868 | 2868 | | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
2869 | 2919 | | |
2870 | 2920 | | |
2871 | 2921 | | |
| |||
0 commit comments