Skip to content
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

https://github.com/malloydata/malloy/pull/1325 #1309

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

mtoy-googly-moogly
Copy link
Collaborator

@mtoy-googly-moogly mtoy-googly-moogly commented Aug 21, 2023

Cleaned up and normalized aggregate expressions which hadn't been touched in a while ... this includes some things which will require docs changes ...

source is now a keyword , this is a breaking change.

Will warn when m4warnings are enabled ...

  • COUNT(DISTINCT expression) is gone, will warn and suggestcount(expression)
  • COUNT(*) is gone, will warn and suggest count()
  • SUM/AVG(path) will warn and suggest path.SUM/AVG()
  • SUM/AVG(expr) will warn and suggest source.SUM/AVG()

Here's the full matrix of support ...

Function f() f(expr) source.f() source.f(expr) path.f() path.f(expr)
min/max err ok err ok ok err
sum/avg err warn err ok ok err
count ok ok ok ok ok err

@christopherswenson
Copy link
Contributor

In your matrix, can we clarify path with source_path and field_path? That is, I'm not sure with the current matrix how some_join.avg(some_field) behaves in comparison tosome_join.some_field.avg(). Also, it seems like the grammar doesn't have support for source.stddev(foo), which is a "custom" aggregate function. Should we have that? Maybe that can be a separate PR.

Function f() f(expr) source.f() source.f(expr) srcpath.f() srcpath.f(expr) fldpath.f()
min/max err ok err ok ? ? ?
sum/avg err warn err ok ? ? ?
count ok ok ok ok ? ? ?
stddev ? ? ? ? ? ? ?

@mtoy-googly-moogly
Copy link
Collaborator Author

mtoy-googly-moogly commented Aug 31, 2023

@christopherswenson i don't understand what a "source path" is as opposed to a "field path"

Yes, this totally ignores custom aggregate functions. We can delay fixing this until we have a solution for all things. This was a quick-ish attempt to address something @lloydtabb said was M4 blocking. We can for sure discuss if it makes sense to do this in two parts or wait for it all at once.

@mtoy-googly-moogly
Copy link
Collaborator Author

mtoy-googly-moogly commented Sep 5, 2023

@christopherswenson is doing some new work based on this, closing this PR as his work starts from this branch

@mtoy-googly-moogly
Copy link
Collaborator Author

re-opening just for the checklist

@mtoy-googly-moogly mtoy-googly-moogly changed the title Pathless aggregates illegal in M4 https://github.com/malloydata/malloy/pull/1325 Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants