github-actions[bot] commented on code in PR #63192:
URL: https://github.com/apache/doris/pull/63192#discussion_r3254240654


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/IcebergMergeCommand.java:
##########
@@ -462,11 +462,25 @@ private LogicalPlan buildMergePlan(ConnectContext ctx, 
IcebergExternalTable iceb
                 icebergTable.getBaseSchema(true),
                 outputExprs,
                 deleteCtx,
+                writesDataFiles(matchedClauses, notMatchedClauses),
                 Optional.empty(),

Review Comment:
   Passing `writesDataFiles=false` only disables the sink-side VARIANT write 
validation; it does not stop the delete-only plan from reading every visible 
target column. `buildDeleteProjection()` still appends all visible columns, so 
a delete-only MERGE whose join/predicate uses only non-VARIANT columns will 
still materialize a VARIANT column. On an ORC Iceberg table this reaches 
`IcebergScanNode.validateVariantReadSupported()` and fails with the 
Parquet-only VARIANT read error even though the delete only needs row-id/delete 
metadata, and on Parquet it performs unnecessary VARIANT reads. This is 
distinct from the earlier write-validation thread: the remaining failure is 
introduced by the read/projection side after the new flag is passed. Please 
make delete-only MERGE project only the operation, row id, lineage/delete 
columns, and columns required by the join/predicate, or otherwise avoid 
scanning unused VARIANT columns; add coverage for delete-only MERGE on a table 
with an unused VARI
 ANT column, including a non-Parquet table if possible.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java:
##########
@@ -265,39 +299,86 @@ public Void visitAlias(Alias alias, CollectorContext 
context) {
 
     @Override
     public Void visitCast(Cast cast, CollectorContext context) {
+        Expression child = cast.child(0);
+        if (child.getDataType() instanceof VariantType && 
context.accessPathBuilder.isEmpty()) {
+            CollectorContext variantRootContext = context.copy();
+            variantRootContext.setCollectVariantRoot(true);
+            return continueCollectAccessPath(child, variantRootContext);
+        }
         if (!context.accessPathBuilder.isEmpty()
                 && cast.getDataType() instanceof NestedColumnPrunable

Review Comment:
   This cast handling still drops a non-empty VARIANT access suffix whenever 
the cast child is `VariantType`, because `VariantType` is not 
`NestedColumnPrunable` and the method falls through to visiting the child with 
a fresh empty context. For example, `SELECT cast(v AS variant)['a'] FROM 
variant_tbl WHERE v['k'] IS NOT NULL` reaches `visitCast()` with suffix `a`; 
the suffix is discarded here, the sibling predicate can leave only `[v, k]` at 
the scan, and the projection then evaluates `['a']` against a pruned VARIANT. 
The same pattern applies to casts from a VARIANT subpath into complex types, 
e.g. selecting a field from `cast(v['obj'] AS struct<...>)`. Please propagate 
the access builder through VARIANT-preserving / VARIANT-to-complex casts where 
the suffix still refers to the child value, and add coverage combining such a 
casted subpath projection with a sibling VARIANT predicate.



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