github-actions[bot] commented on code in PR #64440:
URL: https://github.com/apache/doris/pull/64440#discussion_r3422374755
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java:
##########
@@ -380,20 +380,50 @@ private static boolean
isFunctionNullCheckPath(List<String> suffixPath) {
@Override
public Void visitMapContainsKey(MapContainsKey mapContainsKey,
CollectorContext context) {
+ // MAP_CONTAINS_KEY(<map>, <key>)
+ // Map argument: only the key sub-column is needed.
context.accessPathBuilder.addPrefix(AccessPathInfo.ACCESS_MAP_KEYS);
- return continueCollectAccessPath(mapContainsKey.getArgument(0),
context);
+ continueCollectAccessPath(mapContainsKey.getArgument(0), context);
+ // Key argument: visit with a fresh context to register its data
access paths.
+ // The key may reference nested sub-columns (e.g. element_at(s, 'a'))
whose
+ // full-data paths must be collected; otherwise an IS NULL / OFFSET
path on
+ // the same slot would cause NestedColumnPruning to prune to
metadata-only.
+ Expression keyArg = mapContainsKey.getArgument(1);
+ if (keyArg != null) {
+ CollectorContext keyCtx = new
CollectorContext(context.statementContext, context.bottomFilter);
Review Comment:
When this visitor is reached from `visitIsNull`, `context.accessPathBuilder`
can carry the NULL-only suffix because these functions are nullable only when
the map argument is nullable. For example, `SELECT map_contains_key(m,
element_at(s, 'a')) IS NULL FROM ...` does not need `s.a` to determine the
function result nullness, but this new fresh context still records a full data
path for `s.a`. The same applies to `map_contains_value` and the two search
arguments of `map_contains_entry`.
Please handle the NULL-only context before collecting search arguments,
similar to how `visitMapKeys` / `visitMapValues` route `... IS NULL` to the
parent map null path, and add regression coverage for `map_contains_* (...) IS
NULL` / `IS NOT NULL` cases.
--
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]