github-actions[bot] commented on code in PR #69032: URL: https://github.com/apache/doris/pull/69032#discussion_r4356823998
########## fe/fe-core/src/main/java/org/apache/doris/nereids/types/GeometryType.java: ########## @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.types; + +import org.apache.doris.catalog.ScalarType; +import org.apache.doris.catalog.Type; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.types.coercion.PrimitiveType; + +import java.util.Objects; +import java.util.Optional; + +/** Parameterized Iceberg geometry type. */ +public final class GeometryType extends PrimitiveType { Review Comment: [P2] Guard spatial inputs to COUNT_AT_MIN and COUNT_AT_MAX The new spatial primitives also match the `CustomSignature` of `COUNT_AT_MIN/MAX`. For an imported `t(geom GEOMETRY)`, `SELECT count_at_min(geom), count_at_max(geom) FROM t` passes analysis and reaches the separate `create_aggregate_function_count_at_extreme` factory, which has no `GEOMETRY/GEOGRAPHY` cases and returns `nullptr`; `AggFnEvaluator` then fails with "Agg Function ... is not implemented". Geography and nullable columns take the same path. This is a different factory and admission path from the already guarded `MIN/MAX` and `MIN/MAX_BY` calls. Reject spatial arguments during FE legality checks, including rewritten/state paths, and cover both kinds plus ordinary-type controls. ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CheckAnalysis.java: ########## @@ -224,9 +227,23 @@ private void checkGroupingScalarFunction(Plan plan) { } private void checkAggregateFunction(Plan plan) { + if (plan instanceof LogicalSetOperation) { + LogicalSetOperation set = (LogicalSetOperation) plan; + if (!(set instanceof LogicalUnion) || set.getQualifier() != Qualifier.ALL) { + for (NamedExpression output : set.getOutputs()) { + checkSpatialGroupingType(output); + } + } + } + if (plan instanceof LogicalProject && ((LogicalProject<?>) plan).isDistinct()) { + for (NamedExpression expression : ((LogicalProject<?>) plan).getProjects()) { + checkSpatialGroupingType(expression); + } + } if (plan instanceof Aggregate) { Aggregate<?> aggregate = (Aggregate<?>) plan; for (Expression expr : aggregate.getGroupByExpressions()) { + checkSpatialGroupingType(expr); Review Comment: [P2] Reject spatial window partition keys during analysis `Window[count(*) partition=[geom]] -> Sort[geom] -> IcebergScan` still passes analysis: this guard only visits `Aggregate` keys, and window partition keys have no corresponding check. For two imported rows whose WKB encodes the same `POINT(1 2)` in little- and big-endian order, `SELECT id, count(*) OVER (PARTITION BY geom) FROM t` consequently forms two count-1 partitions: `AnalyticSinkLocalState::_get_partition_by_end` calls `find_first_not_equal`, which reaches the raw-byte `ColumnSpatial::compare_at`. Geography follows the same path. This is a separate analytic equality consumer from the repaired direct GROUP BY and set/list DISTINCT paths. Reject spatial partition keys (including nested spatial leaves) before window lowering, with both-kind/endian-equivalent coverage, while retaining spatial window values with ordinary partition keys. -- 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]
