@@ -72,7 +72,7 @@ use crate::parquet::parquet_support::prepare_object_store_with_configs;
7272use datafusion:: common:: scalar:: ScalarStructBuilder ;
7373use datafusion:: common:: {
7474 tree_node:: { Transformed , TransformedResult , TreeNode , TreeNodeRecursion , TreeNodeRewriter } ,
75- JoinType as DFJoinType , ScalarValue ,
75+ JoinType as DFJoinType , NullEquality , ScalarValue ,
7676} ;
7777use datafusion:: datasource:: listing:: PartitionedFile ;
7878use datafusion:: logical_expr:: type_coercion:: other:: get_coerce_type_for_case_expression;
@@ -594,6 +594,14 @@ impl PhysicalPlanner {
594594 true ,
595595 false ,
596596 ) ) ) ,
597+ // DataFusion 49 hardcodes return type for MD5 built in function as UTF8View
598+ // which is not yet supported in Comet
599+ // Converting forcibly to UTF8. To be removed after UTF8View supported
600+ "md5" => Ok ( Arc :: new ( Cast :: new (
601+ func?,
602+ DataType :: Utf8 ,
603+ SparkCastOptions :: new_without_timezone ( EvalMode :: Try , true ) ,
604+ ) ) ) ,
597605 _ => func,
598606 }
599607 }
@@ -1153,7 +1161,7 @@ impl PhysicalPlanner {
11531161 let child_copied = Self :: wrap_in_copy_exec ( Arc :: clone ( & child. native_plan ) ) ;
11541162
11551163 let sort = Arc :: new (
1156- SortExec :: new ( LexOrdering :: new ( exprs?) , Arc :: clone ( & child_copied) )
1164+ SortExec :: new ( LexOrdering :: new ( exprs?) . unwrap ( ) , Arc :: clone ( & child_copied) )
11571165 . with_fetch ( fetch) ,
11581166 ) ;
11591167
@@ -1429,7 +1437,7 @@ impl PhysicalPlanner {
14291437 sort_options,
14301438 // null doesn't equal to null in Spark join key. If the join key is
14311439 // `EqualNullSafe`, Spark will rewrite it during planning.
1432- false ,
1440+ NullEquality :: NullEqualsNothing ,
14331441 ) ?) ;
14341442
14351443 if join. filter . is_some ( ) {
@@ -1497,7 +1505,7 @@ impl PhysicalPlanner {
14971505 PartitionMode :: Partitioned ,
14981506 // null doesn't equal to null in Spark join key. If the join key is
14991507 // `EqualNullSafe`, Spark will rewrite it during planning.
1500- false ,
1508+ NullEquality :: NullEqualsNothing ,
15011509 ) ?) ;
15021510
15031511 // If the hash join is build right, we need to swap the left and right
@@ -2193,13 +2201,15 @@ impl PhysicalPlanner {
21932201 } ;
21942202
21952203 let window_frame = WindowFrame :: new_bounds ( units, lower_bound, upper_bound) ;
2204+ let lex_orderings = LexOrdering :: new ( sort_exprs. to_vec ( ) ) ;
2205+ let sort_phy_exprs = lex_orderings. as_deref ( ) . unwrap_or ( & [ ] ) ;
21962206
21972207 datafusion:: physical_plan:: windows:: create_window_expr (
21982208 & window_func,
21992209 window_func_name,
22002210 & window_args,
22012211 partition_by,
2202- & LexOrdering :: new ( sort_exprs . to_vec ( ) ) ,
2212+ sort_phy_exprs ,
22032213 window_frame. into ( ) ,
22042214 input_schema. as_ref ( ) ,
22052215 false , // TODO: Ignore nulls
@@ -2280,7 +2290,7 @@ impl PhysicalPlanner {
22802290 . iter ( )
22812291 . map ( |expr| self . create_sort_expr ( expr, Arc :: clone ( & input_schema) ) )
22822292 . collect ( ) ;
2283- let lex_ordering = LexOrdering :: from ( exprs?) ;
2293+ let lex_ordering = LexOrdering :: new ( exprs?) . unwrap ( ) ;
22842294 Ok ( CometPartitioning :: RangePartitioning (
22852295 lex_ordering,
22862296 range_partition. num_partitions as usize ,
0 commit comments