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


##########
be/src/format_v2/orc/orc_reader.cpp:
##########
@@ -889,9 +889,20 @@ void 
OrcReader::set_condition_cache_context(std::shared_ptr<ConditionCacheContex
     DORIS_CHECK(_state != nullptr);
     _state->condition_cache_ctx = std::move(ctx);
     if (_state->condition_cache_ctx != nullptr &&
-        _state->condition_cache_ctx->filter_result != nullptr) {
+        _state->condition_cache_ctx->filter_result != nullptr &&
+        !_state->condition_cache_ctx->is_hit) {
         _state->condition_cache_ctx->base_granule = static_cast<int64_t>(
                 _state->row_reader_range_first_row / 
ConditionCacheContext::GRANULE_SIZE);
+        const auto end_granule =
+                (_state->row_reader_range_first_row + 
_state->row_reader_range_rows +
+                 ConditionCacheContext::GRANULE_SIZE - 1) /
+                ConditionCacheContext::GRANULE_SIZE;
+        DORIS_CHECK(end_granule > 
static_cast<uint64_t>(_state->condition_cache_ctx->base_granule));

Review Comment:
   This `DORIS_CHECK` can fire when ORC SARG/min-max pruning removes every 
stripe. In that path `open()` returns OK with `_eof = true` before 
`_create_row_reader()` initializes `row_reader_range_rows`; 
`TableReader::_init_reader_condition_cache()` still runs afterwards, and on a 
MISS `get_total_rows()` falls back to the full ORC file row count because no 
row reader exists. It therefore allocates a bitmap and calls this method with 
both `row_reader_range_first_row` and `row_reader_range_rows` still zero, 
making `end_granule == base_granule == 0` and aborting a split that should just 
be EOF. Please skip condition-cache MISS setup/publishing when no ORC 
row-reader range exists, or make ORC report zero total rows after all-stripe 
pruning before this span is computed.



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