hello-stephen commented on code in PR #69032:
URL: https://github.com/apache/doris/pull/69032#discussion_r4734709872


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/GeographyType.java:
##########
@@ -0,0 +1,73 @@
+// 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 org.apache.doris.qe.SqlModeHelper;
+
+import java.util.Objects;
+import java.util.Optional;
+
+/** Parameterized Iceberg geography type. */
+public final class GeographyType extends PrimitiveType {

Review Comment:
   [P2] Reject spatial ordering in ARRAY_SORTED_MERGE
   
   The new spatial types inherit `DataType.allowsKeyUse()` returning true, so 
`ArraySortedMerge`'s `checkKeyUse(ORDERING)` admits this reduced plan (Geometry 
is affected too):
   
   ```text
   Project[array_sorted_merge((a,b)->CAST(NULL AS GEOGRAPHY), ARRAY(g), 
ARRAY(h), TRUE)]
     Scan[g:GEOGRAPHY, h:GEOGRAPHY]
   ```
   
   A NULL lambda result reaches `ArraySortedMergeFunction`'s `compare_at`, 
which orders the raw WKB bytes. With singleton arrays `g=POINT(1 2)` and 
`h=POINT(3 4)`, both little-endian return `h` first; encoding only `g` as 
equivalent big-endian WKB returns `g` first. Thus `ST_X(element_at(result,1))` 
changes from 3 to 1 solely because of encoding, although both inputs satisfy 
the sorted-input precondition. Override key capabilities on both spatial types, 
or recursively reject spatial elements in this function, with 
nonconstant/opposite-endian 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]

Reply via email to