OIiveirra commented on code in PR #69032:
URL: https://github.com/apache/doris/pull/69032#discussion_r4367993157


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/MultiDistinctCount.java:
##########
@@ -64,6 +64,18 @@ protected MultiDistinctCount(AggregateFunctionParams 
functionParams) {
         super(functionParams);
     }
 
+    @Override
+    public void checkLegalityBeforeTypeCoercion() {
+        if (getArgumentType(0).isSpatialType()) {

Review Comment:
   Fixed in 405efbdb59e. MULTI_DISTINCT_COUNT now rejects spatial leaves 
recursively before coercion and after rewrite. Added both-kind, nested-array, 
nullable/typed-NULL and ordinary-array coverage. Targeted FE tests and Iceberg 
regression passed; nondistinct ordinary-key spatial values remain supported.



##########
fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/BindExpressionTest.java:
##########
@@ -295,6 +305,67 @@ void testRowLevelMergeOutputIsCoercedByPosition() {
         Assertions.assertTrue(exception.getMessage().contains("not aligned"), 
exception.getMessage());
     }
 
+    @Test
+    void testDeleteOnlyMergeDoesNotValidateNestedSpatialDataWrites() {
+        for (DataType spatial : ImmutableList.of(new GeometryType("OGC:CRS84"),
+                new GeographyType("OGC:CRS84", "spherical"))) {
+            ArrayType array = ArrayType.of(spatial);
+            LogicalOneRowRelation input = new LogicalOneRowRelation(new 
RelationId(1), ImmutableList.of(
+                    new Alias(new NullLiteral(array), "shapes")));
+            LogicalProject<?> source = new LogicalProject<>(ImmutableList.of(
+                    new Alias(new TinyIntLiteral((byte) 1), 
MergeOperation.OPERATION_COLUMN),
+                    new Alias(new StringLiteral("row"), 
Column.ICEBERG_ROWID_COL),
+                    new Alias(input.getOutput().get(0), "shapes")), input);
+            List<Column> columns = ImmutableList.of(new Column("shapes", 
array.toCatalogDataType()));
+            for (boolean writesDataFiles : new boolean[] {false, true}) {
+                LogicalExternalRowLevelMergeSink<?> sink = new 
LogicalExternalRowLevelMergeSink<>(
+                        Mockito.mock(ExternalDatabase.class), 
Mockito.mock(ExternalTable.class),
+                        "schema-1", columns, ImmutableList.of(), 
writesDataFiles, true,
+                        Optional.empty(), Optional.empty(), source);
+                if (writesDataFiles) {
+                    AnalysisException exception = 
Assertions.assertThrows(AnalysisException.class,

Review Comment:
   Updated in 405efbdb59e. Matching nested spatial MERGE writes and delete-only 
binding now assert success; kind/CRS/algorithm mismatches remain rejected. 
Negative fixtures model existing target casts and check the original typed 
slots. Production MERGE logic is unchanged. Targeted FE tests and Iceberg 
regression passed.



-- 
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