@@ -53,7 +53,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
5353 // so we need to process `SELECT` and `ORDER BY` together.
5454 let oby_exprs = to_order_by_exprs ( query. order_by ) ?;
5555 let plan = self . select_to_plan ( * select, oby_exprs, planner_context) ?;
56- let plan = self . limit ( plan, query. offset , query. limit ) ?;
56+ let plan =
57+ self . limit ( plan, query. offset , query. limit , planner_context) ?;
5758 // Process the `SELECT INTO` after `LIMIT`.
5859 self . select_into ( plan, select_into)
5960 }
@@ -68,7 +69,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
6869 None ,
6970 ) ?;
7071 let plan = self . order_by ( plan, order_by_rex) ?;
71- self . limit ( plan, query. offset , query. limit )
72+ self . limit ( plan, query. offset , query. limit , planner_context )
7273 }
7374 }
7475 }
@@ -79,6 +80,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
7980 input : LogicalPlan ,
8081 skip : Option < SQLOffset > ,
8182 fetch : Option < SQLExpr > ,
83+ planner_context : & mut PlannerContext ,
8284 ) -> Result < LogicalPlan > {
8385 if skip. is_none ( ) && fetch. is_none ( ) {
8486 return Ok ( input) ;
@@ -88,10 +90,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
8890 let empty_schema = DFSchema :: empty ( ) ;
8991
9092 let skip = skip
91- . map ( |o| self . sql_to_expr ( o. value , & empty_schema, & mut PlannerContext :: new ( ) ) )
93+ . map ( |o| self . sql_to_expr ( o. value , & empty_schema, planner_context ) )
9294 . transpose ( ) ?;
9395 let fetch = fetch
94- . map ( |e| self . sql_to_expr ( e, & empty_schema, & mut PlannerContext :: new ( ) ) )
96+ . map ( |e| self . sql_to_expr ( e, & empty_schema, planner_context ) )
9597 . transpose ( ) ?;
9698 LogicalPlanBuilder :: from ( input)
9799 . limit_by_expr ( skip, fetch) ?
0 commit comments