github-actions[bot] commented on code in PR #67955:
URL: https://github.com/apache/doris/pull/67955#discussion_r4012242958
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/VariantSubPathPruning.java:
##########
@@ -792,14 +791,13 @@ protected static Pair<SlotReference, List<String>>
extractSlotToSubPathPair(Elem
if (!(elementAt.left() instanceof ElementAt || elementAt.left()
instanceof SlotReference)) {
return null;
}
+ // Storage sub-paths address object keys only. An integer index
selects an array element of the
+ // VARIANT value, so the sub-path stops before it and the index is
applied to the extracted value.
Expression key = elementAt.right();
- if (key instanceof StringLikeLiteral) {
- subPath.add(((StringLikeLiteral) key).getStringValue());
- } else if (key instanceof Literal &&
key.getDataType().isIntegerLikeType()) {
- subPath.add(((Literal) key).getStringValue());
- } else {
+ if (!(key instanceof StringLikeLiteral)) {
Review Comment:
[P2] Preserve the rewritten prefix across project aliases
A project boundary can undo the pruning introduced here. A reduced producer
shape, reachable through UNION ALL or a materialized/multi-use CTE, is:
```text
Project(x['k'])
UNION ALL
Project(v['items'][1] AS x)
Scan(v)
```
This return-null path makes the lower project call
`pushDownToProject(context, projection)`. Although its ordinary `x` projection
is rewritten to `element_at(items_slot, 1)`, `pushDownToProject` reads the
original `projection.child(0)` and builds the requested `x['k']` helper as
`v['items'][1]['k']`. The helper therefore keeps the full root `v` slot live,
so large documents are read in full even though the scan also exposes
`items_slot`. Later column/operative-slot passes retain that explicit root
input. Please build the helper from the recursively replaced child, or replace
the constructed expression through `elementAtToSlotMap`, and add a UNION/CTE
alias-boundary plan assertion that the root VARIANT scan slot is absent.
--
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]