suxiaogang223 opened a new pull request, #69465:
URL: https://github.com/apache/doris/pull/69465

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Related PR: #67141 (different V2 condition-cache seek path)
   
   Problem Summary:
   
   The legacy ORC reader performs RowID seekToRow before the exception handlers 
around nextBatch. A seek can read a missing or unreadable file and throw 
orc::ParseError, which escapes the external row-fetch worker because its Doris 
exception boundary does not catch std::exception. Catch seek exceptions before 
dispatching either lazy or non-lazy reads and return an error with the file and 
cause. Keep the existing clean-EOF convention only for a stopped reader 
throwing "stop"; report other I/O failures even if cancellation races with 
them. Set the row count to zero when no requested RowIDs remain.
   
   The deterministic failure hook is reached only for a non-empty RowID read, 
so the end-to-end regression exercises phase-two seeking rather than failing 
the initial file open. FileScannerV2 and the worker scheduler are unchanged.
   
   ### Release note
   
   Fix BE termination when an ORC RowID seek fails during external TopN late 
materialization.
   
   ### Check List (For Author)
   
   - Test:
   - Passed: BE build-hygiene gates, clang-format 16 formatting/check, git diff 
--check, and Groovy syntax compilation.
   - Added 16 parameterized BE regression cases across lazy/non-lazy modes: 
missing-file seek failure, cancellation during seek, uncancelled stop, I/O 
error racing with cancellation, exhausted RowIDs, normal sequential seeks, 
cancellation before seek, and preservation of Doris exception codes. The input 
stream fails only after the real ORC reader is initialized, and tests check 
that seek actually attempts I/O.
   - Extended the existing Hive TopN suite: force V1, verify the Materialize 
plan, inject an ORC exception only during RowID seek, require a query error, 
remove the fault, and materialize the query again. Session settings are 
restored; existing golden-result checks are unchanged.
   - Runtime validation is NOT complete. ./build.sh --be -j 4 reached 
third-party rebuilding, which requires LLVM 20 not installed on this macOS 
host. run-be-ut.sh was stopped during the apache-orc submodule download before 
creating a test executable. The regression runner failed before executing any 
suite because Maven 3.10 rejects existing duplicate Gson dependencies. 
clang-tidy could not run without a compilation database. BE compilation, 
UT/ASAN and external regression execution remain for CI.
   - Behavior changed: Yes. ORC RowID seek exceptions become query errors 
instead of escaping the worker. Cancelled stop reads retain their existing EOF 
behavior.
   - Does this need documentation: No.
   
   <details>
   <summary>Self-review checkpoints</summary>
   
   - Goal: protect the previously uncovered seek I/O boundary; unit and 
end-to-end regression cases added, runtime execution pending.
   - Scope: one legacy reader boundary, its fault hook, and tests in existing 
suites; no reader migration.
   - Concurrency/locks: no new shared state, locks or scheduling. Returned 
failures follow the existing worker status-before-completion path; its permit 
release remains unchanged.
   - Lifecycle/static initialization: no new static objects; the seek test 
stream is owned by the ORC reader and its profile/IO context outlive it.
   - Configuration: no production setting added; regression changes only the 
scanner/cache settings needed to hit the affected path and restores them in 
finally.
   - Compatibility: no wire, storage, public API or FE changes.
   - Parallel paths: seek precedes both legacy lazy/non-lazy branches, so both 
are covered. V2 condition-cache cancellation already has a separate boundary 
(#67141).
   - Conditions: only the established should_stop plus exact "stop" combination 
returns clean EOF; other exceptions remain failures. Doris exceptions are 
rethrown to preserve the existing worker error-code mapping.
   - Coverage: real seek I/O, negative/cancellation cases, EOF and normal 
seeks; SQL-level worker propagation and post-failure query added.
   - Expected results: no golden output handwritten or changed; fixed 
status/count/RowID expectations live in BE unit tests, SQL failure uses 
test/sql/exception.
   - Observability: error includes the ORC file and underlying exception text, 
without per-row logging.
   - Transactions/persistence: none involved.
   - Data writes/atomicity: no production write path changed; read failures are 
not converted to successful EOF.
   - FE/BE variables: none added.
   - Performance: successful seeking keeps the same I/O and row-id consumption. 
Exception text is allocated only on failure; the debug point uses the standard 
disabled fast path.
   - Other issues: no additional source-level finding; runtime, sanitizer and 
CI verification remain outstanding.
   
   </details>
   


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