github-actions[bot] commented on code in PR #63192:
URL: https://github.com/apache/doris/pull/63192#discussion_r3253948963
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java:
##########
@@ -233,7 +245,10 @@ public Void visitLogicalProject(LogicalProject<? extends
Plan> project, Statemen
for (NamedExpression output : project.getProjects()) {
// e.g. select struct_element(s, 'city') from (select s from tbl)a;
// we will not treat the inner `s` access all path
- if (output instanceof Slot &&
allSlotToAccessPaths.containsKey(output.getExprId().asInt())) {
+ if (collectWholeVariantOutputEnabled && output instanceof Slot
+ && collectWholeVariantOutput((Slot) output)) {
+ continue;
+ } else if (output instanceof Slot &&
allSlotToAccessPaths.containsKey(output.getExprId().asInt())) {
continue;
} else if (output instanceof Alias && output.child(0) instanceof
Slot
&&
allSlotToAccessPaths.containsKey(output.getExprId().asInt())) {
Review Comment:
This branch drops the full-output requirement when the alias slot is also
referenced by an upper nested access. For example, `SELECT v AS a FROM
variant_tbl ORDER BY a['k']` records `[a, k]` from the sort. The project then
enters this branch for `a = v`, propagates only `[v, k]`, and skips the later
`collectWholeVariantOutput(v)` branch even though `a` is still returned as the
query result. The scan can therefore prune `v` to just `k`, so the returned `a`
is missing the rest of the VARIANT value. Please also preserve a root `[v]`
demand whenever a projected VARIANT alias is part of the output, even if
`allSlotToAccessPaths` already contains subpaths for the alias, and add
coverage with a whole alias projection plus `ORDER BY`/predicate on `a['...']`.
This is distinct from the existing generator, CTE, and dynamic-subscript
threads because the lost root demand occurs in the direct `Alias(Slot)` project
propagation branch.
--
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]