yoabot-droid opened a new pull request, #2231:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2231

   ## Summary
   
   Adds support for Snowflake's `HASH(* EXCLUDE(col, ...))` syntax — a wildcard 
with column exclusions used as a function argument.
   
   ## Motivation
   
   The following Snowflake SQL pattern was not parseable:
   
   ```sql
   SELECT * FROM (
       SELECT *, HASH(*) HASH
       FROM (
           SELECT created_at::TIMESTAMP_NTZ AS created_at,
                  updated_at::TIMESTAMP_NTZ AS updated_at,
                  * EXCLUDE(load_date, created_at, updated_at)
           FROM mydb.public.events
       )
   ) S
   FULL JOIN (
       SELECT *, HASH(* EXCLUDE(load_date)) HASH
       FROM mydb.archive.events_20260101
   ) T USING(HASH)
   WHERE T.HASH IS NULL;
   ```
   
   ## Changes
   
   - **`src/ast/mod.rs`**: Added 
`FunctionArgExpr::WildcardWithOptions(WildcardAdditionalOptions)` variant to 
represent `* EXCLUDE(...)` as a function argument expression.
   - **`src/ast/spans.rs`**: Added span handling for the new variant (returns 
empty span, same as plain `Wildcard`).
   - **`src/parser/mod.rs`**: In `parse_function_args`, after parsing a 
wildcard expression, if the dialect supports `* EXCLUDE` (e.g. Snowflake), 
attempt to parse wildcard additional options. If any options are present, wrap 
in `WildcardWithOptions`.
   - **`tests/sqlparser_common.rs`**: New `test_wildcard_func_arg` test 
covering `HASH(* EXCLUDE(col))` for dialects that support wildcard EXCLUDE.
   
   ## Notes
   
   - `HASH(*)` already worked before this change; only `HASH(* EXCLUDE(...))` 
was broken.
   - The canonical form normalizes `EXCLUDE(cols)` → `EXCLUDE (cols)` (space 
before parenthesis), matching the existing `ExcludeSelectItem::Multiple` 
display format.
   - Verified against [Snowflake HASH 
docs](https://docs.snowflake.com/en/sql-reference/functions/hash) — `EXCLUDE` 
and `ILIKE` qualifiers inside `HASH(*)` are officially documented.
   - All existing tests pass.


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