-
Notifications
You must be signed in to change notification settings - Fork 13
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
generic expression aggregation check all children are -> any child is #482
Conversation
changes the generic logic checking if an expression is an aggregation to just checking if there is any child which aggregates rather than all children aggregating
Hmm what about something like:
That wouldn't be an aggregation, but it would still pass this check right? |
@shangyian is that a valid query? If not then is it reasonable to rely on the underlying query engine to catch that? |
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.
@samredai It's not a valid query, but then we'd be storing an invalid query in a Metric node that's marked as "valid". Not sure if this is an issue though, since arguably we don't have to check for aggregations at all.
Hmm, good point... |
@shangyian I made another change now and reverted the original. This needed to be the case anyways, but now values are aggregations. That should work right? So, rather than |
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.
That makes sense to me! Thanks @CircArgs
@shangyian I may be missing your point, but isn't this a completely separate problem? Meaning "whether the query is valid SQL" from "whether any given expression is an aggregate expression" ? |
@agorajek this was exactly my original thought but I think the update @CircArgs made is an even clearer approach that also solves the problem @shangyian raised. The updated check is more robust in that it gets to the core of the requirement which is that all elements resolve to some scalar value that can co-exist in a single expression. |
…DataJunction#482) * generic expression aggregation check all children are -> any child is changes the generic logic checking if an expression is an aggregation to just checking if there is any child which aggregates rather than all children aggregating * values are aggregations * fix make check * remove now incorrect test * cov * fix check * trying to fix parse error
Summary
changes the generic logic checking if an expression is an aggregation to just checking if there is any child which aggregates rather than all children aggregating
this would be a problem because of the binop default
is_aggregation
:which would succeed after this change. Now,
2.0 * count(repair_order_id)
is identified as an aggregationTest Plan
make check
passesmake test
shows 100% unit test coverage