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

Formalize AVG Typing Output #1659

Open
1 task
johnedquinn opened this issue Nov 26, 2024 · 0 comments
Open
1 task

Formalize AVG Typing Output #1659

johnedquinn opened this issue Nov 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@johnedquinn
Copy link
Member

Description

What is the output static type of:

  • AVG(tinyint)
  • AVG(smallint)
  • AVG(int)
  • AVG(bigint)
  • AVG(numeric(p, s))
  • AVG(decimal(p, s))
  • AVG(real)
  • AVG(double precision)
  • AVG(dynamic)

And, a follow up: If the input at compile-time was dynamic, what is the output value's type of all of the above (excluding the last case)?

For now, from a discussion with @jpschorr, we've decided that for the exact numeric types, since AVG = SUM / COUNT and COUNT returns a BIGINT (which has a precision of 19), then for the integral types, the output of average will be DECIMAL(38, 19). We need to think about this more and formalize this.

DoD

  • This needs to be clarified and implemented.
@johnedquinn johnedquinn added the enhancement New feature or request label Nov 26, 2024
johnedquinn added a commit to johnedquinn/partiql-lang-jvm that referenced this issue Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant