csun5285 commented on code in PR #68788:
URL: https://github.com/apache/doris/pull/68788#discussion_r4256009309
##########
be/src/storage/segment/segment_iterator.cpp:
##########
@@ -3159,18 +3200,28 @@ Status SegmentIterator::_next_batch_internal(Block*
block) {
if (_count_emit_shortcut) {
return _emit_count_shortcut_batch(block);
}
+ if (_opts.read_limit > 0 && _rows_returned >= _opts.read_limit) {
Review Comment:
master 存在这个问题,先在master修复,然后pick 到 4.2
##########
be/src/exec/operator/olap_scan_operator.cpp:
##########
@@ -436,12 +436,66 @@ Status OlapScanLocalState::_init_profile() {
return Status::OK();
}
+static bool contains_expr_node_type(const VExprSPtr& expr, TExprNodeType::type
node_type) {
+ DORIS_CHECK(expr != nullptr);
+ if (expr->node_type() == node_type) {
+ return true;
+ }
+ if (expr->is_rf_wrapper() && contains_expr_node_type(expr->get_impl(),
node_type)) {
+ return true;
+ }
+ return std::ranges::any_of(expr->children(), [node_type](const auto&
child) {
+ return contains_expr_node_type(child, node_type);
+ });
+}
+
+static Status validate_residual_scan_conjuncts(RuntimeState* state,
+ TPushAggOp::type
push_down_agg_type,
+ const VExprContextSPtrs&
conjuncts) {
+ for (const auto& conjunct : conjuncts) {
+ const auto& root = conjunct->root();
+ if (contains_expr_node_type(root, TExprNodeType::SEARCH_EXPR)) {
+ return Status::InvalidArgument(
+ "SEARCH expression remains as a residual scan predicate. A
valid search() "
+ "must bind at least one indexed field and be evaluated in
SegmentIterator, "
+ "which takes such expressions only when the table is not
merged on read "
+ "(DUPLICATE, or UNIQUE with merge-on-write).
enable_segment_limit_pushdown "
+ "only controls SegmentIterator LIMIT pushdown and cannot
make residual "
+ "SEARCH executable.");
+ }
+ if (!state->query_options().enable_match_without_inverted_index &&
+ contains_expr_node_type(root, TExprNodeType::MATCH_PRED)) {
+ return Status::InvalidArgument(
+ "MATCH expression remains as a residual scan predicate and
would fall back to "
+ "a disabled slow path because
enable_match_without_inverted_index is false. "
+ "SegmentIterator evaluates MATCH only when the table is
not merged on read "
+ "(DUPLICATE, or UNIQUE with merge-on-write).
enable_segment_limit_pushdown "
+ "only controls SegmentIterator LIMIT pushdown and cannot
make residual MATCH "
+ "executable. Set enable_match_without_inverted_index=true
to allow slow MATCH "
+ "execution.");
+ }
+ }
+
+ if (push_down_agg_type == TPushAggOp::COUNT_ON_INDEX &&
!conjuncts.empty()) {
Review Comment:
master 存在这个问题,先在master修复,然后pick 到 4.2
--
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]