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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java:
##########
@@ -737,10 +739,29 @@ private static void addColumnValue(
         addColumnValue(analyzer, optimizedRowConstructor, value, targetType, 
rewriteContext, strictCast, null);
     }
 
-    private static void addColumnValue(Optional<ExpressionAnalyzer> analyzer,
+    static void addColumnValue(Optional<ExpressionAnalyzer> analyzer,
             ImmutableList.Builder<NamedExpression> optimizedRowConstructor,
             NamedExpression value, DataType targetType, 
ExpressionRewriteContext rewriteContext,
             boolean strictCast, Column targetColumn) {
+        if (targetColumn != null && 
targetColumn.getType().typeContainsSpatialType()) {
+            // Keep the source identity until binding can validate kind, CRS 
and algorithm.
+            if (!analyzer.isPresent()) {
+                optimizedRowConstructor.add(value);
+                return;
+            }
+            value = (NamedExpression) analyzer.get().analyze(value,
+                    new 
ExpressionRewriteContext(analyzer.get().getCascadesContext()));
+            if (value instanceof Alias && value.child(0) instanceof Cast
+                    && 
ConnectorSpatialWriteNormalizer.isMapOrStructCast(value.child(0).getDataType(), 
targetType)) {

Review Comment:
   Fixed in ba57f0678ee. INSERT VALUES now checks the NULL inside the ARRAY 
cast before validating the write. I verified that both GEOMETRY and GEOGRAPHY 
write and read back as NULL, the plan keeps one rand() call per expression, and 
invalid casts and non-NULL integers are still rejected.



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