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


##########
be/src/format_v2/table_reader.h:
##########
@@ -423,12 +424,20 @@ class TableReader {
         DORIS_CHECK(can_filter_all != nullptr);
         *can_filter_all = false;
         for (const auto& table_filter : _table_filters) {
-            if (table_filter.conjunct == nullptr ||
-                // RuntimeFilterExpr does not implement execute_column_impl(); 
it is evaluated by
-                // the row-level filter path through execute_filter(). 
Constant split pruning uses
-                // VExprContext::execute() on a one-row synthetic block, so 
runtime filters must not
-                // be pre-executed here even when their referenced slot maps 
to a constant value.
-                table_filter.conjunct->root()->is_rf_wrapper() ||
+            if (table_filter.conjunct == nullptr) {
+                continue;
+            }
+            // Constant pruning must preserve a safe prefix of the row-level 
conjunct order. Once
+            // an unsafe predicate is reached, evaluating any later constant 
predicate could hide
+            // its error or other row-level behavior by pruning the split 
first.
+            if (!_is_safe_to_pre_execute(table_filter.conjunct)) {

Review Comment:
   The safe-prefix check here is still driven by `_table_filters`, so it can 
miss earlier unsafe conjuncts that do not reference any table slot. 
`build_table_filters_from_conjunct()` only creates entries when 
`collect_global_indices()` finds at least one `GlobalIndex`; a no-slot unsafe 
expression such as `random()`/`uuid()` remains in the scanner's row-level 
conjunct list but is absent from this loop. If such a conjunct appears before a 
later partition/default-column predicate that maps to constants, this method 
can prune the split and return before `Scanner::_filter_output_block()` ever 
evaluates the unsafe conjunct on the non-empty split. Please preserve the 
barrier from the original `_conjuncts` order, or carry slotless unsafe 
conjuncts as non-executable barriers in `_table_filters`, and add a regression 
test for an unsafe no-slot predicate before a false constant/partition 
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