Ritesh17rb opened a new issue, #3048:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/3048
With sqlparser 0.63.0 and `SparkSqlDialect`, `SELECT struct();` fails with
`Expected: an expression, found: ) at Line: 1, Column: 15`. Spark 4.2.0 accepts
this syntax and returns an empty struct (`{}`).
Reproduction:
```rust
use sqlparser::{dialect::SparkSqlDialect, parser::Parser};
let result = Parser::parse_sql(&SparkSqlDialect {}, "SELECT struct();");
assert!(result.is_ok(), "{result:?}");
```
`parse_struct_literal` in `src/parser/mod.rs` unconditionally calls
`parse_comma_separated` after consuming `(`, so an immediate `)` cannot produce
`Expr::Struct { values: vec![], fields: vec![] }`. I checked the same code on
current main as well.
Could the Spark dialect accept an empty struct argument list? This is a
syntax request; support for evaluating the resulting empty struct is separate.
Found while addressing the deferred Spark compatibility case in
apache/datafusion-spark#410 (original issue apache/datafusion-spark#364).
--
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]