EmilyMatt commented on code in PR #19419:
URL: https://github.com/apache/datafusion/pull/19419#discussion_r2653185753
##########
datafusion/physical-expr/src/projection.rs:
##########
@@ -587,6 +587,54 @@ impl ProjectionExprs {
let expr = &proj_expr.expr;
let col_stats = if let Some(col) =
expr.as_any().downcast_ref::<Column>() {
std::mem::take(&mut stats.column_statistics[col.index()])
+ } else if let Some(literal) =
expr.as_any().downcast_ref::<Literal>() {
+ // Handle literal expressions (constants) by calculating
proper statistics
+ let data_type = expr.data_type(output_schema)?;
+
+ if literal.value().is_null() {
+ let null_count = match stats.num_rows {
+ Precision::Exact(num_rows) =>
Precision::Exact(num_rows),
+ _ => Precision::Absent,
+ };
+
+ ColumnStatistics {
Review Comment:
Since ScalarValues accept None as well, I wonder if these stats can't just
all output the same ScalarValue cloned? (I.e., min/max value, sum value)
byte_size can probably be 0
--
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]