neilconway opened a new pull request, #22679:
URL: https://github.com/apache/datafusion/pull/22679

   ## Which issue does this PR close?
   
   - Closes #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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to