BenSatori opened a new pull request, #3090:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/3090

   Dialects: Oracle
   
   `WITH t(n) AS (SELECT 7 FROM dual UNION ALL SELECT 7 FROM dual) SELECT 
COUNT(UNIQUE n) FROM t` currently fails with:
   `Expected: ), found: n at Line: 1, Column: 84`
   
   Oracle accepts `UNIQUE` as a synonym of `DISTINCT` in aggregate argument 
lists, e.g. `COUNT(UNIQUE n)`, `AVG(UNIQUE n)`, `COLLECT(UNIQUE n ORDER BY n 
DESC)`, `LISTAGG(UNIQUE n, ',') WITHIN GROUP (ORDER BY n)`, and analytic 
`COUNT(UNIQUE n) OVER (...)`. Syntax reference:
   
https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Aggregate-Functions.html
   
   This is the function-argument counterpart of #3089 (`SELECT UNIQUE`). It 
adds `Dialect::supports_unique_in_function_args()` (default `false`, `true` for 
`OracleDialect`), and `parse_duplicate_treatment` accepts `UNIQUE` in the 
`DISTINCT` slot. It parses as `DuplicateTreatment::Distinct` and displays as 
`DISTINCT`; no AST changes. `ALL UNIQUE` hits the existing "Cannot specify both 
ALL and DISTINCT" error, and `unique` remains an ordinary argument in other 
dialects.
   
   Fuzzed with `fuzz_parse_sql` and `fuzz_parse_roundtrip` for 60 seconds each, 
no panics from this change. Seed: 
`fuzz/fuzz_seeds/oracle_unique_in_function_args.sql`.
   
   This PR was written with AI assistance (Claude Code). I reviewed every line 
and can explain each change.
   
   🤖 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