Kimishu opened a new issue, #2056:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2056
Working on my custom sql validation, I needed somehow to check, does user
provide group_by/limit+offset/sort_by clauses.
I got smth like this and found `.group_by` field as non-optional. Is it
right?
```rust
let wrong_query = "SELECT * FROM example_table GROUP BY example_field";
//Parser returns success(!) below
if let Statement::Query(q) = Parser::parse_sql(&GenericDialect {},
&query)?.first().unwrap() {
if q.limit_clause.is_none() {...}
if q.order_by.is_none() {...}
let select_query = query.body.as_select().unwrap();
//And I expected smth like this:
if select_query.group_by.is_none() {...}
}
```
Maybe I'm doing smth wrong and there is a proper and faster way for that?
Also I noticed a `parse_optional_group_by` fn but I didn't get how to use
it., there is no info nor examples in docs about it. Looks like it's inner fn?
--
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]