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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/connector/converter/ConnectorSpatialWriteNormalizer.java:
##########
@@ -0,0 +1,790 @@
+// 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.datasource.connector.converter;
+
+import org.apache.doris.catalog.Column;
+import org.apache.doris.nereids.CTEContext;
+import org.apache.doris.nereids.analyzer.UnboundFunction;
+import org.apache.doris.nereids.properties.OrderKey;
+import org.apache.doris.nereids.rules.analysis.ExpressionAnalyzer;
+import org.apache.doris.nereids.rules.rewrite.PushProjectThroughUnion;
+import org.apache.doris.nereids.trees.expressions.Alias;
+import org.apache.doris.nereids.trees.expressions.CTEId;
+import org.apache.doris.nereids.trees.expressions.Cast;
+import org.apache.doris.nereids.trees.expressions.ExprId;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.NamedExpression;
+import org.apache.doris.nereids.trees.expressions.Slot;
+import org.apache.doris.nereids.trees.expressions.SlotReference;
+import org.apache.doris.nereids.trees.expressions.StatementScopeIdGenerator;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Array;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Cardinality;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.CreateMap;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.CreateNamedStruct;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.CreateStruct;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.MapContainsKey;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.MapKeys;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.MapSize;
+import org.apache.doris.nereids.trees.expressions.literal.ArrayLiteral;
+import org.apache.doris.nereids.trees.expressions.literal.Literal;
+import org.apache.doris.nereids.trees.expressions.literal.MapLiteral;
+import org.apache.doris.nereids.trees.expressions.literal.NullLiteral;
+import org.apache.doris.nereids.trees.expressions.literal.StringLikeLiteral;
+import org.apache.doris.nereids.trees.expressions.literal.StructLiteral;
+import org.apache.doris.nereids.trees.plans.Plan;
+import org.apache.doris.nereids.trees.plans.algebra.SetOperation.Qualifier;
+import org.apache.doris.nereids.trees.plans.logical.LogicalCTE;
+import org.apache.doris.nereids.trees.plans.logical.LogicalCTEAnchor;
+import org.apache.doris.nereids.trees.plans.logical.LogicalCTEConsumer;
+import org.apache.doris.nereids.trees.plans.logical.LogicalCTEProducer;
+import org.apache.doris.nereids.trees.plans.logical.LogicalFilter;
+import org.apache.doris.nereids.trees.plans.logical.LogicalLimit;
+import org.apache.doris.nereids.trees.plans.logical.LogicalOneRowRelation;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
+import org.apache.doris.nereids.trees.plans.logical.LogicalProject;
+import org.apache.doris.nereids.trees.plans.logical.LogicalSetOperation;
+import org.apache.doris.nereids.trees.plans.logical.LogicalSort;
+import org.apache.doris.nereids.trees.plans.logical.LogicalSubQueryAlias;
+import org.apache.doris.nereids.trees.plans.logical.LogicalUnion;
+import org.apache.doris.nereids.trees.plans.logical.ProjectProcessor;
+import org.apache.doris.nereids.types.ArrayType;
+import org.apache.doris.nereids.types.DataType;
+import org.apache.doris.nereids.types.GeographyType;
+import org.apache.doris.nereids.types.GeometryType;
+import org.apache.doris.nereids.types.MapType;
+import org.apache.doris.nereids.types.StructType;
+import org.apache.doris.nereids.util.ExpressionUtils;
+import org.apache.doris.nereids.util.TypeCoercionUtils;
+
+import com.google.common.collect.ImmutableList;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.IntStream;
+
+/** Restores proven NULL producer values before spatial sink coercion. */
+public final class ConnectorSpatialWriteNormalizer {
+    private ConnectorSpatialWriteNormalizer() {
+    }
+
+    public static LogicalPlan normalize(List<Column> targets, LogicalPlan 
source, CTEContext cteContext) {
+        return normalize(targets, source, IntStream.range(0, 
targets.size()).boxed()
+                .collect(ImmutableList.toImmutableList()), cteContext);
+    }
+
+    /** Aligns data targets with source positions when a row-level sink also 
carries routing columns. */
+    public static LogicalPlan normalize(List<Column> targets, LogicalPlan 
source,
+            List<Integer> sourceOrdinals, CTEContext cteContext) {
+        if (targets.stream().noneMatch(column -> 
column.getType().typeContainsSpatialType())) {
+            return source;
+        }
+        if (source instanceof LogicalUnion && ((LogicalUnion) 
source).getQualifier() == Qualifier.ALL) {
+            return normalizeUnionAll(targets, (LogicalUnion) source, 
sourceOrdinals, cteContext);
+        }
+        if (source instanceof LogicalSubQueryAlias) {
+            LogicalPlan child = (LogicalPlan) source.child(0);
+            LogicalPlan normalized = normalize(targets, child, sourceOrdinals, 
cteContext);
+            return normalized == child ? source : (LogicalPlan) 
source.withChildren(ImmutableList.of(normalized));
+        }
+        if (source instanceof LogicalProject && 
isForwardingProject((LogicalProject<?>) source)) {
+            Plan input = source.child(0);
+            while (input instanceof LogicalSubQueryAlias) {
+                input = input.child(0);
+            }
+            Plan boundary = input;
+            while (boundary instanceof LogicalSubQueryAlias
+                    || (boundary instanceof LogicalProject && 
isForwardingProject((LogicalProject<?>) boundary))) {
+                boundary = boundary.child(0);
+            }
+            if (boundary instanceof LogicalUnion && ((LogicalUnion) 
boundary).getQualifier() == Qualifier.ALL) {
+                // Reuse the existing safe forwarding/cast projection rule, 
including its ExprId handling.
+                Optional<Plan> pushed = ProjectProcessor.tryProcessProject(
+                        ((LogicalProject<?>) source).getProjects(), input);
+                // Forwarding aliases can also repeat or prune outputs without 
moving calculations.
+                if (!pushed.isPresent() && input instanceof LogicalUnion
+                        && ((LogicalProject<?>) source).getProjects().stream()
+                        .allMatch(project -> project instanceof Slot
+                                || (project instanceof Alias && 
project.child(0) instanceof Slot))) {
+                    pushed = Optional.of(PushProjectThroughUnion.doPushProject(
+                            ((LogicalProject<?>) source).getProjects(), 
(LogicalUnion) input));
+                }
+                if (pushed.isPresent()) {
+                    return normalize(targets, (LogicalPlan) pushed.get(), 
sourceOrdinals, cteContext);
+                }
+            }
+        }
+        Resolver resolver = new Resolver(source, cteContext);
+        List<NamedExpression> outputs = new ArrayList<>(source.getOutput());
+        List<LogicalPlan> wrappers = new ArrayList<>();
+        Set<ExprId> sortInputs = new HashSet<>();
+        LogicalPlan producerInput = source;
+        while (producerInput instanceof LogicalSort || producerInput 
instanceof LogicalLimit) {
+            wrappers.add(producerInput);
+            for (Expression expression : producerInput.getExpressions()) {
+                collectSortInputs(expression, sortInputs);
+            }
+            producerInput = (LogicalPlan) producerInput.child(0);
+        }
+        LogicalProject<?> producer = producerInput instanceof LogicalProject
+                && !((LogicalProject<?>) producerInput).isDistinct() ? 
(LogicalProject<?>) producerInput : null;
+        List<NamedExpression> producerOutputs = null;
+        Map<ExprId, Slot> replacedSlots = new HashMap<>();
+        boolean changed = false;
+        for (int i = 0; i < targets.size(); i++) {
+            Column target = targets.get(i);
+            if (!target.getType().typeContainsSpatialType()) {
+                continue;
+            }
+            int sourceOrdinal = sourceOrdinals.get(i);
+            Slot slot = source.getOutput().get(sourceOrdinal);
+            Expression value = resolver.resolve(slot, source);
+            DataType targetType = DataType.fromCatalogType(target.getType());
+            boolean literal = isLiteralConstruction(value) || 
canRetargetSpatialNulls(value, targetType);
+            // SELECT/UPDATE reach the bound sink with CAST(ARRAY(NULL) AS 
ARRAY<INT>).
+            // Reuse MERGE's NULL-only proof before validation, without 
lifting arbitrary producers.
+            if (literal) {
+                value = normalizeSpatialNullsBeforeBinding(value, targetType);
+            }
+            if (!literal && producer != null && 
!sortInputs.contains(slot.getExprId())
+                    && sourceOrdinals.indexOf(sourceOrdinal) == 
sourceOrdinals.lastIndexOf(sourceOrdinal)) {
+                // Retag a constructor where it is computed, so its dynamic 
ordinary siblings
+                // still use the same inputs and are evaluated only once. Do 
not follow slots
+                // through joins, other producers, or a DISTINCT projection.
+                NamedExpression project = 
producer.getProjects().get(sourceOrdinal);
+                if (project instanceof Alias && 
canRetargetSpatialNulls(project.child(0), targetType, true)) {
+                    Expression normalized = 
normalizeSpatialNullsBeforeBinding(project.child(0), targetType, true);
+                    if (!normalized.getDataType().equals(slot.getDataType())) {
+                        value = normalized;
+                        if (producerOutputs == null) {
+                            producerOutputs = new 
ArrayList<>(producer.getProjects());
+                        }
+                        Alias replacement = new Alias(normalized, 
slot.getName());
+                        producerOutputs.set(sourceOrdinal, replacement);
+                        Slot replacementSlot = replacement.toSlot();
+                        outputs.set(sourceOrdinal, replacementSlot);
+                        replacedSlots.put(slot.getExprId(), replacementSlot);
+                    }
+                }
+            }
+            ConnectorSpatialWriteValidator.validate(target, value);
+            // Never lift arbitrary producer expressions above their input 
scope, or
+            // replace outer-join NULL padding with a non-NULL container 
constant.
+            if (literal) {
+                Expression normalized = normalizeSpatialNulls(value, 
targetType);
+                if (!normalized.getDataType().equals(slot.getDataType())) {
+                    // SELECT v,v can feed an ordinary BIGINT and a spatial 
NULL. Sharing
+                    // v's ExprId would let project merging replace the 
ordinary cast's input.
+                    outputs.set(sourceOrdinal, new Alias(normalized, 
slot.getName()));
+                    changed = true;
+                }
+            }
+        }
+        LogicalPlan normalizedSource = source;
+        if (producerOutputs != null) {
+            normalizedSource = producer.withProjects(producerOutputs);
+            for (int i = wrappers.size() - 1; i >= 0; i--) {
+                LogicalPlan wrapper = wrappers.get(i);
+                if (wrapper instanceof LogicalSort) {
+                    LogicalSort<?> sort = (LogicalSort<?>) wrapper;
+                    List<OrderKey> keys = sort.getOrderKeys().stream().map(key 
-> {
+                        // Rebind inside ordinary ancestors too, e.g. 
CARDINALITY(m)+1.
+                        // Analysis rebuilds the function signature with the 
retagged MAP argument.
+                        Expression rebound = 
key.getExpr().rewriteDownShortCircuit(expression -> {
+                            if (expression instanceof Slot) {
+                                Slot replacement = replacedSlots.get(((Slot) 
expression).getExprId());
+                                return replacement == null ? expression : 
replacement;
+                            }
+                            return expression;
+                        });
+                        return rebound == key.getExpr() ? key : 
key.withExpression(rebound);
+                    }).collect(ImmutableList.toImmutableList());
+                    normalizedSource = sort.withOrderKeysAndChild(keys, 
normalizedSource);
+                } else {
+                    normalizedSource = (LogicalPlan) 
wrapper.withChildren(ImmutableList.of(normalizedSource));
+                }
+            }
+        }
+        return changed ? new LogicalProject<>(outputs, normalizedSource) : 
normalizedSource;
+    }
+
+    private static void collectSortInputs(Expression expression, Set<ExprId> 
inputs) {
+        if (expression instanceof Slot) {
+            inputs.add(((Slot) expression).getExprId());
+            return;
+        }
+        // Retagging NULL values preserves keys and entry counts. Recognize 
these observations
+        // inside ordinary expressions as well as at the root. Other MAP 
observations still block.
+        boolean keysOrCount = (expression instanceof Cardinality || expression 
instanceof MapSize
+                || expression instanceof MapKeys || expression instanceof 
MapContainsKey)
+                && expression.child(0) instanceof Slot && 
expression.child(0).getDataType() instanceof MapType;
+        // MAP_CONTAINS_KEY's lookup can have its own MAP dependency; only its 
first input is safe.
+        for (int i = keysOrCount ? 1 : 0; i < expression.arity(); i++) {
+            collectSortInputs(expression.child(i), inputs);
+        }
+    }
+
+    private static boolean isForwardingProject(LogicalProject<?> project) {
+        return !project.isDistinct() && 
project.getProjects().stream().allMatch(output -> output instanceof Slot
+                || (output instanceof Alias && 
ExpressionUtils.getExpressionCoveredByCast(output.child(0))
+                        instanceof Slot));
+    }
+
+    private static LogicalPlan normalizeUnionAll(List<Column> targets, 
LogicalUnion source,
+            List<Integer> sourceOrdinals, CTEContext context) {
+        List<Plan> children = new ArrayList<>();
+        List<List<SlotReference>> childOutputs = new ArrayList<>();
+        boolean changed = !source.getConstantExprsList().isEmpty();
+        for (int i = 0; i < source.arity(); i++) {
+            LogicalPlan child = (LogicalPlan) source.child(i);
+            List<SlotReference> outputs = source.getRegularChildOutput(i);
+            LogicalPlan input = child.getOutput().equals(outputs)
+                    ? child : new 
LogicalProject<>(ImmutableList.<NamedExpression>copyOf(outputs), child);
+            LogicalPlan normalized = normalize(targets, input, sourceOrdinals, 
context);
+            children.add(normalized);
+            
childOutputs.add(normalized.getOutput().stream().map(SlotReference.class::cast)
+                    .collect(ImmutableList.toImmutableList()));
+            changed |= normalized != child;
+        }
+        // Constant rows use the same proof and CAST validation as ordinary 
branches.
+        // Keep them as separate rows; never replace an entire UNION output 
with one constant.
+        for (List<NamedExpression> row : source.getConstantExprsList()) {
+            LogicalPlan normalized = normalize(targets,
+                    new 
LogicalOneRowRelation(StatementScopeIdGenerator.newRelationId(), row),
+                    sourceOrdinals, context);
+            children.add(normalized);
+            
childOutputs.add(normalized.getOutput().stream().map(SlotReference.class::cast)
+                    .collect(ImmutableList.toImmutableList()));
+        }
+        if (!changed) {
+            return source;
+        }
+        // A whole STRUCT NULL can adopt the sink's ordinary field types while 
a constructed
+        // STRUCT only retags its spatial leaves. Reconcile the branches 
before exposing UNION outputs.
+        List<DataType> commonTypes = new ArrayList<>();
+        for (int i = 0; i < source.getOutput().size(); i++) {
+            DataType common = childOutputs.get(0).get(i).getDataType();
+            for (int j = 1; j < childOutputs.size(); j++) {
+                common = LogicalSetOperation.getAssignmentCompatibleType(
+                        common, childOutputs.get(j).get(i).getDataType());
+            }
+            commonTypes.add(common);
+        }
+        for (int i = 0; i < children.size(); i++) {
+            List<SlotReference> slots = childOutputs.get(i);
+            List<NamedExpression> projects = new ArrayList<>();
+            boolean castNeeded = false;
+            for (int j = 0; j < slots.size(); j++) {
+                SlotReference slot = slots.get(j);
+                Expression cast = 
TypeCoercionUtils.castForCommonTypeWithExactTarget(slot, commonTypes.get(j));
+                projects.add(cast == slot ? slot : new Alias(cast, 
slot.getName()));
+                castNeeded |= cast != slot;
+            }
+            if (castNeeded) {
+                LogicalProject<?> project = new LogicalProject<>(projects, 
children.get(i));
+                children.set(i, project);
+                childOutputs.set(i, 
project.getOutput().stream().map(SlotReference.class::cast)
+                        .collect(ImmutableList.toImmutableList()));
+            }
+        }
+
+        List<NamedExpression> outputs = new ArrayList<>();
+        for (int i = 0; i < source.getOutput().size(); i++) {
+            SlotReference slot = (SlotReference) source.getOutput().get(i);
+            DataType type = commonTypes.get(i);
+            int ordinal = i;
+            boolean nullable = slot.nullable() || 
childOutputs.stream().anyMatch(row -> row.get(ordinal).nullable());
+            // A forwarding project can repeat one slot for ordinary and 
spatial targets.
+            // Retagged outputs need distinct identities, just like the scalar 
projection path.
+            outputs.add(slot.getDataType().equals(type) ? 
slot.withNullable(nullable) : slot
+                    
.withExprId(StatementScopeIdGenerator.newExprId()).withNullableAndDataType(nullable,
 type));
+        }
+        return source.withNewOutputsChildrenAndConstExprsList(outputs, 
children, childOutputs, ImmutableList.of());
+    }
+
+    private static boolean isLiteralConstruction(Expression value) {
+        // Only proven NULL-only casts can be retargeted; actual values and 
invalid source
+        // array-depth conversions must retain their original identity and 
errors.
+        return value instanceof Literal || (value.getClass() == Cast.class && 
nullArrayDepth(value) >= 0)
+                || ((value instanceof Array || value instanceof CreateMap
+                || value instanceof CreateStruct || value instanceof 
CreateNamedStruct)
+                && 
value.children().stream().allMatch(ConnectorSpatialWriteNormalizer::isLiteralConstruction));
+    }
+
+    private static final class Resolver {
+        private final CTEContext context;
+        private final Map<CTEId, Plan> producers = new HashMap<>();
+        private final Set<CTEId> activeCtes = new HashSet<>();
+        private final Map<Plan, Map<ExprId, Expression>> resolvedSlots = new 
IdentityHashMap<>();
+
+        private Resolver(Plan source, CTEContext context) {
+            this.context = context;
+            collectProducers(source);
+        }
+
+        private void collectProducers(Plan source) {
+            if (source instanceof LogicalCTEProducer) {
+                LogicalCTEProducer<?> producer = (LogicalCTEProducer<?>) 
source;
+                producers.put(producer.getCteId(), producer.child());
+            }
+            source.children().forEach(this::collectProducers);
+        }
+
+        private Expression resolve(Expression value, Plan source) {
+            if (value instanceof Alias) {
+                return resolve(value.child(0), source);
+            }
+            if (value instanceof Slot) {
+                return resolveSlot((Slot) value, source);
+            }
+            // Only restore constant NULL construction. Expanding arbitrary 
IF(g, g)
+            // producer chains duplicates shared CTE lineage exponentially.
+            if (!(value instanceof Cast || value instanceof Array || value 
instanceof CreateMap
+                    || value instanceof CreateStruct || value instanceof 
CreateNamedStruct)) {
+                return value;
+            }
+            List<Expression> children = value.children().stream()
+                    .map(child -> resolve(child, source))
+                    .collect(ImmutableList.toImmutableList());
+            // SELECT reaches sink binding before constant folding: CAST(NULL 
AS INT)
+            // and CAST(NULL AS GEOMETRY('EPSG:3857')) are still 
value-independent NULLs.
+            if (value instanceof Cast && children.get(0).isNullLiteral()) {
+                // A bound SELECT/UPDATE can still contain GEOGRAPHY -> INT. 
Retain its
+                // analysis error before NULL retagging and project merging 
erase the cast.
+                validateNullCastChain(value);
+                return new NullLiteral(value.getDataType());
+            }
+            return children.equals(value.children()) ? value : 
value.withChildren(children);
+        }
+
+        private Expression resolveSlot(Slot slot, Plan source) {
+            Map<ExprId, Expression> cached = 
resolvedSlots.computeIfAbsent(source, ignored -> new HashMap<>());
+            Expression result = cached.get(slot.getExprId());
+            if (result == null) {
+                result = traceSlot(slot, source);
+                cached.put(slot.getExprId(), result);
+            }
+            return result;
+        }
+
+        private Expression traceSlot(Slot slot, Plan source) {
+            if (source instanceof LogicalProject || source instanceof 
LogicalOneRowRelation) {
+                List<NamedExpression> projects = source instanceof 
LogicalProject
+                        ? ((LogicalProject<?>) source).getProjects() : 
((LogicalOneRowRelation) source).getProjects();
+                for (NamedExpression project : projects) {
+                    if (project.getExprId().equals(slot.getExprId())) {
+                        Plan input = source instanceof LogicalProject ? 
source.child(0) : source;
+                        // A one-row correlated slot has no producer 
definition here.
+                        return project instanceof Slot && input == source
+                                ? slot : resolve(project, input);
+                    }
+                }
+            } else if (source instanceof LogicalCTEConsumer) {
+                LogicalCTEConsumer consumer = (LogicalCTEConsumer) source;
+                Optional<Plan> producer = 
Optional.ofNullable(producers.get(consumer.getCteId()));
+                if (!producer.isPresent()) {
+                    producer = context.findCTEContext(consumer.getName())
+                            .filter(cte -> 
cte.getCteId().equals(consumer.getCteId()))
+                            .flatMap(cte -> 
cte.getAnalyzedCTEPlan(consumer.getName())).map(Plan.class::cast);
+                }
+                // Recursive CTEs do not prove constant provenance through 
their cycle.
+                if (producer.isPresent() && 
activeCtes.add(consumer.getCteId())) {
+                    try {
+                        // An analyzed outer CTE can own an inner WITH whose 
producers
+                        // are absent from the sink's context and initial 
source tree.
+                        collectProducers(producer.get());
+                        return resolve(consumer.getProducerSlot(slot), 
producer.get());
+                    } finally {
+                        activeCtes.remove(consumer.getCteId());
+                    }
+                }
+            } else if (source instanceof LogicalCTEAnchor) {
+                return resolveSlot(slot, source.child(1));
+            } else if (source instanceof LogicalSubQueryAlias || source 
instanceof LogicalFilter
+                    || source instanceof LogicalLimit || source instanceof 
LogicalSort
+                    || source instanceof LogicalCTE) {
+                return resolveSlot(slot, source.child(0));
+            }
+            // Joins, grouping sets and set operations may add NULLs or 
combine values;
+            // their output type alone is not evidence of a constant value.
+            return slot;
+        }
+    }
+
+    public static Expression normalizeSpatialNullsBeforeBinding(Expression 
input, DataType target) {
+        return normalizeSpatialNullsBeforeBinding(input, target, false);
+    }
+
+    /** Retags proven NULLs in a bound write value while retaining its 
ordinary children. */
+    public static Expression normalizeBoundSpatialNulls(Expression input, 
DataType target) {
+        return canRetargetSpatialNulls(input, target, true)
+                ? normalizeSpatialNullsBeforeBinding(input, target, true) : 
input;
+    }
+
+    /** Casts a MERGE branch in place so only the selected branch is 
evaluated. */
+    public static Expression castSpatialMergeBranch(Expression input, DataType 
target) {
+        Expression normalized = normalizeSpatialNullsBeforeBinding(input, 
target);
+        if (normalized == input && input.getClass() == Cast.class
+                && isMapOrStructCast(input.getDataType(), target) && 
!input.getDataType().equals(target)

Review Comment:
   Fixed in 8cdfbfbfca2. MERGE now binds the ARRAY cast before checking the 
spatial NULL, so the ordinary field can still use the source row. 
mergeSqlRetagsArrayStructNullsWithRuntimeOrdinaryFields covers both matched and 
unmatched branches.



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