moshap-firebolt opened a new pull request, #2772:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2772

   Spark has a higher-order function [`exists(expr, 
pred)`](https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#collection-functions),
 as 
[Databricks](https://docs.databricks.com/aws/en/sql/language-manual/functions/exists)
 does, but only `DatabricksDialect` parsed it:
   
   ```sql
   SELECT exists(array(1, 2), x -> x > 1)
   -- Spark: Expected: SELECT, VALUES, or a subquery in the query body, found: 
array
   ```
   
   The Databricks-only `dialect_of!` check becomes a dialect method, 
`Dialect::supports_exists_function`, enabled for both.
   
   That check took only `SELECT` and `WITH` after the parenthesis as a query, 
so under Databricks `EXISTS (VALUES (1))` parsed as a call to a function named 
`EXISTS`, and `EXISTS (TABLE t)` and `EXISTS (FROM t SELECT a)` failed. 
`TABLE`, `VALUES` and `FROM` now keep the `EXISTS` predicate too.
   
   Tests in `sqlparser_common.rs` cover the function and each query form on the 
dialects with the method, and the unchanged error on the rest; they fail 
without the change.
   
   This PR was prepared with AI assistance (Claude).
   
   Dialects: Spark, Databricks
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to