diff --git a/datafusion/common/src/dfschema.rs b/datafusion/common/src/dfschema.rs index 295577dafa61..1686a5d0dfe0 100644 --- a/datafusion/common/src/dfschema.rs +++ b/datafusion/common/src/dfschema.rs @@ -601,7 +601,7 @@ impl Display for DFSchema { /// /// Note that this trait is implemented for &[DFSchema] which is /// widely used in the DataFusion codebase. -pub trait ExprSchema { +pub trait ExprSchema: std::fmt::Debug { /// Is this column reference nullable? fn nullable(&self, col: &Column) -> Result; @@ -610,7 +610,7 @@ pub trait ExprSchema { } // Implement `ExprSchema` for `Arc` -impl> ExprSchema for P { +impl + std::fmt::Debug> ExprSchema for P { fn nullable(&self, col: &Column) -> Result { self.as_ref().nullable(col) } diff --git a/datafusion/expr/src/expr_schema.rs b/datafusion/expr/src/expr_schema.rs index 685d348ced34..4e08860cce70 100644 --- a/datafusion/expr/src/expr_schema.rs +++ b/datafusion/expr/src/expr_schema.rs @@ -375,6 +375,7 @@ mod tests { ); } + #[derive(Debug)] struct MockExprSchema { nullable: bool, data_type: DataType, diff --git a/datafusion/expr/src/field_util.rs b/datafusion/expr/src/field_util.rs index 985e92d437cf..8f5d6a6e34ff 100644 --- a/datafusion/expr/src/field_util.rs +++ b/datafusion/expr/src/field_util.rs @@ -51,9 +51,8 @@ pub fn get_indexed_field(data_type: &DataType, key: &ScalarValue) -> Result Err(DataFusionError::Plan( "Only ints are valid as an indexed field in a list".to_string(), )), - _ => Err(DataFusionError::Plan( - "The expression to get an indexed field is only valid for `List` types" - .to_string(), + (other, _) => Err(DataFusionError::Plan( + format!("The expression to get an indexed field is only valid for `List` or `Struct` types, got {other}") )), } }