hareshkh commented on issue #17122:
URL: https://github.com/apache/datafusion/issues/17122#issuecomment-3178108708

   @alamb : From projections.rs
   ```rust
   fn stats_projection(
       mut stats: Statistics,
       exprs: impl Iterator<Item = Arc<dyn PhysicalExpr>>,
       schema: SchemaRef,
   ) -> Statistics {
       let mut primitive_row_size = 0;
       let mut primitive_row_size_possible = true;
       let mut column_statistics = vec![];
       for expr in exprs {
           let col_stats = if let Some(col) = 
expr.as_any().downcast_ref::<Column>() {
               stats.column_statistics[col.index()].clone()
           } else {
               // TODO stats: estimate more statistics from expressions
               // (expressions should compute their statistics themselves)
               ColumnStatistics::new_unknown()
           };
           column_statistics.push(col_stats);
           if let Ok(data_type) = expr.data_type(&schema) {
               if let Some(value) = data_type.primitive_width() {
                   primitive_row_size += value;
                   continue;
               }
           }
           primitive_row_size_possible = false;
       }
   
       if primitive_row_size_possible {
           stats.total_byte_size =
               Precision::Exact(primitive_row_size).multiply(&stats.num_rows);
       }
       stats.column_statistics = column_statistics;
       stats
   }
   ```
   
   the code here: 
   ```rust
   if let Ok(data_type) = expr.data_type(&schema) {
       if let Some(value) = data_type.primitive_width() {
           primitive_row_size += value;
           continue;
       }
   }
   ```
   would fail when it calls `data_type()` for a `Column`
   
   And because we only care about the `Ok()` case, the error is generated but 
ignored.


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to