github-actions[bot] commented on code in PR #62304:
URL: https://github.com/apache/doris/pull/62304#discussion_r3097854572
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NestedColumnPruning.java:
##########
@@ -286,6 +340,10 @@ private static Map<Integer, AccessPathInfo> pruneDataType(
});
Review Comment:
`stripNullSuffixPaths()` breaks mixed projection/filter cases. BE readers
use `all_access_paths` to decide which nested children are materialized, and
`predicate_access_paths` is only forwarded after that child has already been
selected. For example, `select struct_element(s, 'data') from tbl where
struct_element(s, 'city') is null` now becomes `all=[s.data]` and
`predicate=[s.city.NULL]`; `StructFileColumnIterator::set_access_paths()` will
skip `city` entirely and the filter will run on default-filled data. Please
keep the NULL path in `allAccessPaths` for mixed-access cases, or teach the BE
readers to treat predicate-only subpaths as readable.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java:
##########
@@ -72,7 +72,8 @@ public Map<Slot, List<CollectAccessPathResult>> collect(Plan
root, StatementCont
private boolean shouldCollectAccessPath(Slot slot) {
return slot.getDataType() instanceof NestedColumnPrunable
|| slot.getDataType().isVariantType()
- || slot.getDataType().isStringLikeType();
+ || slot.getDataType().isStringLikeType()
+ || slot.nullable();
Review Comment:
This broadens the optimization to every nullable scalar, but the BE scalar
reader path still does not honor `[col, NULL]`. For OLAP scans we eventually
land in `FileColumnIterator::set_access_paths()`, and that default
implementation ignores `all_access_paths` completely, so `INT/DATE/... IS NULL`
still reads full data pages. The new explain-only cases for `int_col.NULL`
therefore look optimized even though no I/O is saved. Please either keep this
scoped to readers with actual `NULL_MAP_ONLY` support, or add the missing BE
scalar-reader handling in the same PR.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NestedColumnPruning.java:
##########
@@ -472,6 +556,17 @@ public boolean hasStringOffsetOnlyAccess() {
return type.isStringLikeType() && isStringOffsetOnly && !accessAll;
}
+ /** True when the column is accessed ONLY via IS NULL / IS NOT NULL,
+ * meaning the BE only needs to read the null flag, not the actual
data. */
+ public boolean hasNullCheckOnlyAccess() {
+ if (isRoot) {
+ DataTypeAccessTree child = children.values().iterator().next();
+ return child.isNullCheckOnly && !child.accessAll
+ && !child.isStringOffsetOnly &&
!child.accessPartialChild;
+ }
+ return isNullCheckOnly && !accessAll && !isStringOffsetOnly &&
!accessPartialChild;
+ }
+
/** pruneCastType */
Review Comment:
For a top-level string predicate like `str_col IS NULL`, this never becomes
`hasNullCheckOnlyAccess() == true`. By the time we hit this branch,
`accessPartialChild` has already been set in the method prologue, so the root
check at lines 561-567 still returns false. Because string slots take the
dedicated branch earlier in `pruneDataType()` and `continue`, FE ends up
attaching no access path at all, so the optimization does not trigger for
top-level string columns. Could we avoid setting `accessPartialChild` for
terminal `NULL` markers, or relax `hasNullCheckOnlyAccess()` for leaf nodes?
--
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]