@@ -40,7 +40,6 @@ use datafusion_physical_expr_adapter::{
4040} ;
4141use std:: collections:: HashMap ;
4242use std:: sync:: Arc ;
43-
4443// ============================================================================
4544// New PhysicalExprAdapter Implementation (Recommended)
4645// ============================================================================
@@ -119,6 +118,8 @@ impl PhysicalExprAdapter for SparkPhysicalExprAdapter {
119118 // Step 1: Handle default values for missing columns
120119 let expr = self . replace_missing_with_defaults ( expr) ?;
121120
121+ let expr = self . cast_datafusion_unsupported_expr ( expr) ?;
122+
122123 // Step 2: Delegate to default adapter for standard handling
123124 // This handles: missing columns → nulls, type mismatches → CastColumnExpr
124125 let expr = self . default_adapter . rewrite ( expr) ?;
@@ -160,6 +161,22 @@ impl SparkPhysicalExprAdapter {
160161 Ok ( Transformed :: no ( expr) )
161162 }
162163
164+ // Cast expressions that currently not supported in DF
165+ fn cast_datafusion_unsupported_expr (
166+ & self ,
167+ expr : Arc < dyn PhysicalExpr > ,
168+ ) -> DataFusionResult < Arc < dyn PhysicalExpr > > {
169+ // expr.transform(|expr| {
170+ // if let Some(col) = expr.as_any().downcast_ref::<Column>() {
171+ // dbg!(col.data_type(&self.logical_file_schema));
172+ // }
173+ // Ok(Transformed::no(expr))
174+ // })
175+ // .data()
176+
177+ Ok ( expr)
178+ }
179+
163180 /// Replace references to missing columns with default values.
164181 fn replace_missing_with_defaults (
165182 & self ,
0 commit comments