-
Notifications
You must be signed in to change notification settings - Fork 603
Consolidate representation of function calls, remove AggregateExpressionWithFilter
, ArraySubquery
, ListAgg
and ArrayAgg
#1247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pull Request Test Coverage Report for Build 8943406713Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AggregateExpressionWithFilter
, ArraySubquery
, ListAgg
and ArrayAgg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 -- thank you @jmhain -- this is really nice. While it will be a non trivial change for some downstream crates I think it will be for the better.
Also, thank you for the reviews @iffyio and @universalmind303
🚀
special: false, | ||
order_by: vec![], | ||
}), | ||
call("safe_offset", [Expr::Value(number("2"))]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
|
||
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments are really lovely. Thank you @jmhain
pub over: Option<WindowType>, | ||
/// aggregate functions may specify eg `COUNT(DISTINCT x)` | ||
pub distinct: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I get this property now then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see DuplicateTreatment
now. But it can cause downstream to restructure the handling code to adjust these structural changes.
Trying it out ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us know if there is something wrong that can't be handled -- I can make another release with a fix if necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to upgrade sqlparser to 0.46.0 in datafusion this morning but found that except my breaking changes on Insert and Delete struct, it includes others like this one and the JsonAccess refactor. So I stop the work until I can have time to understand the changes :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if there's any way I can help...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmhain Thanks for offering the help. I just created apache/datafusion#10392 that you can pull locally and run cargo build to see the compilation failure and see if you have the idea to fix it up.
Welcome to leave a comment on that PR or create a PR target to that PR. I'm actively responding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I've got so far that I'm reasonably sure is correct without more context on DataFusion: apache/datafusion@261f346
Out of time for now but I'll try to take a second look later tonight at the remaining JSON access changes needed
…sionWithFilter`, `ArraySubquery`, `ListAgg` and `ArrayAgg` (apache#1247) Co-authored-by: Andrew Lamb <[email protected]>
This addresses a handful of issues and redundancies related to our representation of function calls.
FunctionArguments
enum with three options:CURRENT_TIMESTAMP
. This is better than thespecial
bit we had because the latter allows for many invalid AST states.ArraySubquery
expression variant.WITHIN GROUP
support toFunction
, which makes functions likepercentile_cont(...) within group (...)
on Postgres work.ListAgg
andArrayAgg
expression variants and subsumed them intoFunction
AggregateExpressionWithFilter
expression variant. This was only needed before because ofArrayAgg
/ListAgg
being separate expression nodes.ARRAY_CONCAT_AGG
andSTRING_AGG
support the same set of options asARRAY_AGG
, and we can parse those now.ALL
inSELECT COUNT(ALL column)
is now preserved in roundtrips.This lays the groundwork for adding additional special function argument clauses like bigquery's
ANY_VALUE(foo HAVING MIN value)
.