jayzhan211 commented on code in PR #8946:
URL: https://github.com/apache/arrow-datafusion/pull/8946#discussion_r1469018020


##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -753,18 +753,49 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 operator: JsonOperator::Colon,
                 right,
             } => {
-                let start = Box::new(self.sql_expr_to_logical_expr(
-                    *left,
-                    schema,
-                    planner_context,
-                )?);
-                let stop = Box::new(self.sql_expr_to_logical_expr(
-                    *right,
+                // the last value could represent stop or stride

Review Comment:
   nit:
   ```rust
                   let (start, stop, stride) = if let SQLExpr::JsonAccess { 
left: l, operator: JsonOperator::Colon, right: r } = *left {
                       let start = Box::new(self.sql_expr_to_logical_expr(*l, 
schema, planner_context)?);
                       let stop = Box::new(self.sql_expr_to_logical_expr(*r, 
schema, planner_context)?);
                       let stride = 
Box::new(self.sql_expr_to_logical_expr(*right, schema, planner_context)?);
                       (start, stop, stride)
                   } else {
                       let start = 
Box::new(self.sql_expr_to_logical_expr(*left, schema, planner_context)?);
                       let stop = 
Box::new(self.sql_expr_to_logical_expr(*right, schema, planner_context)?);
                       let stride = 
Box::new(Expr::Literal(ScalarValue::Int64(Some(1))));
                       (start, stop, stride)
                   };
                   GetFieldAccess {
                       start,
                       stop,
                       stride
                   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to