@@ -442,13 +442,16 @@ fn cast_between_timestamp(from: &DataType, to: &DataType, value: i128) -> Option
442442
443443#[ cfg( test) ]
444444mod tests {
445- use std:: collections:: HashMap ;
446-
447445 use super :: * ;
446+ use std:: collections:: HashMap ;
447+ use std:: sync:: Arc ;
448448
449+ use crate :: simplify_expressions:: ExprSimplifier ;
449450 use arrow:: compute:: { cast_with_options, CastOptions } ;
450451 use arrow:: datatypes:: Field ;
451- use datafusion_common:: tree_node:: TransformedResult ;
452+ use datafusion_common:: { DFSchema , DFSchemaRef } ;
453+ use datafusion_expr:: execution_props:: ExecutionProps ;
454+ use datafusion_expr:: simplify:: SimplifyContext ;
452455 use datafusion_expr:: { cast, col, in_list, try_cast} ;
453456
454457 #[ test]
@@ -735,10 +738,12 @@ mod tests {
735738 }
736739
737740 fn optimize_test ( expr : Expr , schema : & DFSchemaRef ) -> Expr {
738- let mut expr_rewriter = UnwrapCastExprRewriter {
739- schema : Arc :: clone ( schema) ,
740- } ;
741- expr. rewrite ( & mut expr_rewriter) . data ( ) . unwrap ( )
741+ let props = ExecutionProps :: new ( ) ;
742+ let simplifier = ExprSimplifier :: new (
743+ SimplifyContext :: new ( & props) . with_schema ( Arc :: clone ( schema) ) ,
744+ ) ;
745+
746+ simplifier. simplify ( expr) . unwrap ( )
742747 }
743748
744749 fn expr_test_schema ( ) -> DFSchemaRef {
0 commit comments