LorrensP-2158466 commented on issue #10536:
URL: https://github.com/apache/datafusion/issues/10536#issuecomment-2174247044

   Hi, I just stumbled on this issue, and from what I'm getting, we can return 
an error in this case since panicking is maybe unwanted.
   A way to do this:
   ```rust
   pub fn try_from_column(
       schema: &Schema,
       col_stats: &ColumnStatistics,
       col_index: usize,
   ) -> Result<Self> {
       let field = schema.fields()
           .get(col_index)
           .ok_or_else(|| DataFusionError::Internal(
               format!("Could not create `ExprBoundaries` from column index 
{col_index} in ::try_from_column(): Column index out of bounds, schema has {} 
columns.\n", schema.fields.len())
           ))?;
       ...
   }
   ```
   This function only get's called from 
   
https://github.com/apache/datafusion/blob/e1cfb48215ee91a183e06cfee602e42d2c23f429/datafusion/physical-expr/src/analysis.rs#L59C1-L70C6
   Which indicates there are more column stats than columns in the schema.
   
   I can't say more since I can't reproduce the error, so I'm sorry for any 
incompleteness. 


-- 
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