github-actions[bot] commented on code in PR #69032:
URL: https://github.com/apache/doris/pull/69032#discussion_r4350030231
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CheckAnalysis.java:
##########
@@ -224,9 +224,15 @@ private void checkGroupingScalarFunction(Plan plan) {
}
private void checkAggregateFunction(Plan plan) {
+ if (plan instanceof LogicalProject && ((LogicalProject<?>)
plan).isDistinct()) {
+ for (NamedExpression expression : ((LogicalProject<?>)
plan).getProjects()) {
+ checkSpatialGroupingType(expression);
Review Comment:
[P2] Cover spatial keys introduced by later DISTINCT lowering
The new check only sees existing project/aggregate keys. `UNION DISTINCT(g)`
passes analysis, then `BuildAggForUnion` creates `Aggregate[group=g] -> Union
ALL` after both `CheckAnalysis` passes. Likewise, `Aggregate[group=[],
array_agg(DISTINCT g)]` passes the nested-only `ArrayAgg` guard, and
`SplitAggMultiPhaseWithoutGbyKey` later introduces a physical `GROUP BY g`;
`COLLECT_LIST(DISTINCT g)` has the same path. For two imported rows encoding
the same `POINT(1 2)` in little- and big-endian WKB, `SELECT geom FROM t WHERE
id=1 UNION SELECT geom FROM t WHERE id=2` consequently retains two values, and
`SELECT size(array_agg(DISTINCT geom)) FROM t` yields 2, because
`ColumnSpatial` serializes the original bytes. `INTERSECT`/`EXCEPT` also remain
admitted through their native serialized set operators. These are separate
later-generated/native-set consumers beyond the repaired direct `SELECT
DISTINCT` and `COUNT DISTINCT` gates. Reject spatial keys in these set
operations and DISTINCT ag
gregate arguments before lowering, preserve `UNION ALL` and nondistinct scalar
list aggregation, and add both-kind/endian-equivalent coverage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]