@@ -75,8 +75,7 @@ impl Binder {
7575 expr : & Expr ,
7676 child : SExpr ,
7777 ) -> Result < ( SExpr , ScalarExpr ) > {
78- let last_expr_context = bind_context. expr_context . clone ( ) ;
79- bind_context. set_expr_context ( ExprContext :: WhereClause ) ;
78+ let last_expr_context = bind_context. replace_expr_context ( ExprContext :: WhereClause ) ;
8079
8180 let mut scalar_binder = ScalarBinder :: new (
8281 bind_context,
@@ -103,7 +102,7 @@ impl Binder {
103102 predicates : split_conjunctions ( & scalar) ,
104103 } ;
105104 let new_expr = SExpr :: create_unary ( Arc :: new ( filter_plan. into ( ) ) , Arc :: new ( child) ) ;
106- bind_context. set_expr_context ( last_expr_context) ;
105+ bind_context. expr_context = last_expr_context;
107106
108107 Ok ( ( new_expr, scalar) )
109108 }
@@ -308,8 +307,7 @@ impl Binder {
308307 if distinct {
309308 let mut select_info =
310309 SelectInfo :: from_columns ( new_bind_context. all_column_bindings ( ) . to_vec ( ) ) ;
311- new_expr =
312- self . bind_distinct ( left_span, & mut new_bind_context, & mut select_info, new_expr) ?;
310+ new_expr = self . bind_distinct ( left_span, & mut select_info, new_expr) ?;
313311 }
314312
315313 Ok ( ( new_expr, new_bind_context) )
@@ -381,7 +379,7 @@ impl Binder {
381379
382380 // then apply distinct
383381 let mut select_info = SelectInfo :: from_columns ( left_context. all_column_bindings ( ) . to_vec ( ) ) ;
384- let s_expr = self . bind_distinct ( left_span, & mut left_context , & mut select_info, s_expr) ?;
382+ let s_expr = self . bind_distinct ( left_span, & mut select_info, s_expr) ?;
385383 Ok ( ( s_expr, left_context) )
386384 }
387385
0 commit comments