-
Notifications
You must be signed in to change notification settings - Fork 63
Enable definition of aggregation functions in the Catalog #1760
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
CROSS-ENGINE-REPORT ❌
Testing Details
Result Details
Now FAILING Tests ❌The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. Now IGNORED Tests ❌The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. Now Passing Tests179 test(s) were previously failing in BASE (LEGACY-V0.14.8) but now pass in TARGET (EVAL-D506C7C). Before merging, confirm they are intended to pass. The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. CROSS-COMMIT-REPORT ❌
Testing DetailsResult Details
Now FAILING Tests ❌The following 8 test(s) were previously PASSING in BASE but are now FAILING in TARGET: Click here to see
Now Passing TestsThe following 8 test(s) were previously FAILING in BASE but are now PASSING in TARGET. Before merging, confirm they are intended to pass: Click here to see
|
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.
implementation looks good. glad that we could finally get rid of the hard-coded aggregates. left a couple minor comments
partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt
Show resolved
Hide resolved
partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt
Outdated
Show resolved
Hide resolved
), | ||
) | ||
assertEquals(0, Datum.comparator().compare(expected, datum)) | ||
} |
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.
wonder if we could also test a few other scenarios:
- aggregate UDF has same name as a builtin scalar (e.g. UPPER)
- scalar UDF has same name as a builtin aggregate (e.g. COUNT)
- scalar UDF and aggregate UDF have same name
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 added the above tests. I also had to add logic to the planning to assert on name collisions between then scalar and aggregate overloads.
The current catalog interface, unfortunately, makes it difficult to introspect the functions/aggregates at build time. Otherwise, I'd have made the check during construction.
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.
Reference for the current catalog interface -- https://github.com/partiql/partiql-lang-kotlin/blob/9f3ec3d318f39c8fb46b41c433dbd2a9a0ccfd30/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt.
6350bd5
to
9f3ec3d
Compare
), | ||
) | ||
assertEquals(0, Datum.comparator().compare(expected, datum)) | ||
} |
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.
Reference for the current catalog interface -- https://github.com/partiql/partiql-lang-kotlin/blob/9f3ec3d318f39c8fb46b41c433dbd2a9a0ccfd30/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt.
Relevant Issues
Description
Previously, the list of aggregation functions known to planning was hard-coded. This PR looks up aggregation functions in the catalog, allowing planning to find both built-ins and catalog-defined functions.
Other Information
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.