Disallow aggregation function as UNNEST parameter#17988
Disallow aggregation function as UNNEST parameter#17988kokosing merged 1 commit intotrinodb:masterfrom
UNNEST parameter#17988Conversation
8c197af to
ad637f7
Compare
ad637f7 to
4f31a38
Compare
There was a problem hiding this comment.
We need unit tests for that and this is an SQL error so we need a proper UX error.
There was a problem hiding this comment.
On my eye it is not SQL error. It is kind of invariant that should be satisfied here. We have similar here:
ad637f7#diff-bd8fefc1e4638b7f65e377b75c16b46a2c541a24a64993860663507351917230R106
I can add test but I am not sure that we test invariants in other places. This invariant is to help detect such problem immediately in the future. But, the end user should not observe this (if there is no bug in code).
There was a problem hiding this comment.
This should already be handled during SQL analysis by io.trino.sql.analyzer.Analyzer#verifyNoAggregateWindowOrGroupingFunctions as the newly added test shows.
There was a problem hiding this comment.
Yes, this case is handled by StatementAnalyzer now. This is why I've put assertions, as the last ressort. [The first PR did not include verifyNoAggregateWindowOrGroupingFunctions so it was true then that it was exposed to the end user].
4f31a38 to
c5472d7
Compare
UNNEST parameter
core/trino-main/src/main/java/io/trino/metadata/InternalFunctionBundle.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/analyzer/TestAnalyzer.java
Outdated
Show resolved
Hide resolved
c5472d7 to
a46d9dc
Compare
Description
Disallow aggregation function as UNNEST parameter and add similar check as here: ad637f7#diff-bd8fefc1e4638b7f65e377b75c16b46a2c541a24a64993860663507351917230R106
Release notes
General