You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jackwener (via GitHub)" <gi...@apache.org> on 2023/10/30 15:43:48 UTC

[PR] chore: Update sqlparser requirement from 0.38.0 to 0.39.0 [arrow-datafusion]

jackwener opened a new pull request, #7983:
URL: https://github.com/apache/arrow-datafusion/pull/7983

   ## Which issue does this PR close?
   
   Closes #7980.
   
   ## Rationale for this change
   
   Update sqlparser requirement from 0.38.0 to 0.39.0
   
   ## What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update sqlparser requirement from 0.38.0 to 0.39.0 [arrow-datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #7983:
URL: https://github.com/apache/arrow-datafusion/pull/7983


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update sqlparser requirement from 0.38.0 to 0.39.0 [arrow-datafusion]

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #7983:
URL: https://github.com/apache/arrow-datafusion/pull/7983#discussion_r1376520787


##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -477,10 +482,36 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 self.parse_array_agg(array_agg, schema, planner_context)
             }
 
+            SQLExpr::Struct { values, fields } => {
+                self.parse_struct(values, fields, schema, planner_context)
+            }
+
             _ => not_impl_err!("Unsupported ast node in sqltorel: {sql:?}"),
         }
     }
 
+    fn parse_struct(

Review Comment:
   We also need to remove original code that parse `struct` as function.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: Update sqlparser requirement from 0.38.0 to 0.39.0 [arrow-datafusion]

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on PR #7983:
URL: https://github.com/apache/arrow-datafusion/pull/7983#issuecomment-1785562946

   sqlparser-0.39 parse `struct` as `EXPR`, but sqlparser-0.39 parse `struct` as `Function`.
   So datafusion parse `struct` need to refactor.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: Update sqlparser requirement from 0.38.0 to 0.39.0 [arrow-datafusion]

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #7983:
URL: https://github.com/apache/arrow-datafusion/pull/7983#discussion_r1376520787


##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -477,10 +482,36 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 self.parse_array_agg(array_agg, schema, planner_context)
             }
 
+            SQLExpr::Struct { values, fields } => {
+                self.parse_struct(values, fields, schema, planner_context)
+            }
+
             _ => not_impl_err!("Unsupported ast node in sqltorel: {sql:?}"),
         }
     }
 
+    fn parse_struct(

Review Comment:
   We also need to remove original code that parse `struct` as function.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: Update sqlparser requirement from 0.38.0 to 0.39.0 [arrow-datafusion]

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on PR #7983:
URL: https://github.com/apache/arrow-datafusion/pull/7983#issuecomment-1786319201

   Now there's a problem that parse hive-dialect `filter (XX)`.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: Update sqlparser requirement from 0.38.0 to 0.39.0 [arrow-datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #7983:
URL: https://github.com/apache/arrow-datafusion/pull/7983#issuecomment-1786031413

   I pushed a fix for clippy -- but there is still something wrong with FILTER aggregates.
   
   Likely related to https://github.com/sqlparser-rs/sqlparser-rs/pull/1007


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update sqlparser requirement from 0.38.0 to 0.39.0 [arrow-datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #7983:
URL: https://github.com/apache/arrow-datafusion/pull/7983#discussion_r1377309585


##########
datafusion/sql/src/expr/function.rs:
##########
@@ -146,9 +146,14 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 let order_by = (!order_by.is_empty()).then_some(order_by);
                 let args =
                     self.function_args_to_expr(function.args, schema, planner_context)?;
+                let filter: Option<Box<Expr>> = function
+                    .filter
+                    .map(|e| self.sql_expr_to_logical_expr(*e, schema, planner_context))
+                    .transpose()?
+                    .map(Box::new);
 
                 return Ok(Expr::AggregateFunction(expr::AggregateFunction::new(
-                    fun, args, distinct, None, order_by,
+                    fun, args, distinct, filter, order_by,

Review Comment:
   👍 



##########
datafusion/sql/src/expr/function.rs:
##########
@@ -146,9 +146,14 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 let order_by = (!order_by.is_empty()).then_some(order_by);
                 let args =
                     self.function_args_to_expr(function.args, schema, planner_context)?;
+                let filter: Option<Box<Expr>> = function
+                    .filter
+                    .map(|e| self.sql_expr_to_logical_expr(*e, schema, planner_context))
+                    .transpose()?
+                    .map(Box::new);
 
                 return Ok(Expr::AggregateFunction(expr::AggregateFunction::new(
-                    fun, args, distinct, None, order_by,
+                    fun, args, distinct, filter, order_by,

Review Comment:
   👍 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org