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


##########
be/src/format_v2/jni/jni_table_reader.cpp:
##########
@@ -55,6 +47,13 @@ Status JniTableReader::prepare_split(const SplitReadOptions& 
options) {
     if (_is_table_level_count_active()) {
         return Status::OK();
     }
+    // JNI readers do not go through TableReader::open_reader(), where native 
readers prepare
+    // file-local filters. Prepare the fresh per-split snapshot before it 
filters JNI blocks.
+    RowDescriptor row_desc;
+    for (const auto& conjunct : _conjuncts) {

Review Comment:
   Moving this preparation into `prepare_split()` makes the standalone JNI path 
reuse the same `_conjuncts` contexts across splits when 
`SplitReadOptions::conjuncts` is `nullopt`. `TableReader::prepare_split()` 
preserves the initial snapshot in that case, so the second split calls 
`prepare()` again on already-open `VExprContext`s. `VExprContext::prepare()` is 
not idempotent: it walks the root and prepare-time 
`register_function_context()` appends new function contexts, while the 
following `open()` returns immediately once `_opened` is true. That leaves 
newly prepared function state unopened and can make JNI block filtering fail or 
evaluate with stale/mismatched state for predicates containing functions. 
Please either keep the initial JNI conjuncts prepared once, clone a fresh 
per-split snapshot for standalone callers before this loop, or close/reset the 
preserved contexts before re-preparing them.



-- 
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