airborne12 commented on code in PR #71022:
URL: https://github.com/apache/doris/pull/71022#discussion_r4749915409
##########
be/src/exprs/vmatch_predicate.cpp:
##########
@@ -204,6 +210,44 @@ Status
VMatchPredicate::evaluate_inverted_index(VExprContext* context, uint32_t
return status;
}
+// A MATCH on a VARIANT path that this segment does not store is NULL on every
row, which the
+// index can answer exactly. Without that answer the MATCH falls back to row
evaluation, and
+// score() then rejects an AND/OR whose other branches were scored. For
example, in a segment
+// written from {"title":"apple archive"}, `v['content'] MATCH 'search'` is
answered here, so
+// `v['title'] MATCH 'apple' OR v['content'] MATCH 'search'` can still score
the title branch.
+Status VMatchPredicate::_evaluate_absent_variant_path(IndexExecContext&
index_context,
+ uint32_t
segment_num_rows) {
+ // The planner reads `v['content']` as a path slot, usually under a cast
to the MATCH type.
+ // Without a segment there is no VARIANT metadata to prove the path absent
from.
+ const auto input = expr_without_cast(get_child(0));
+ if (!input->is_slot_ref() || index_context.segment() == nullptr) {
+ return Status::OK();
+ }
+ // A path with an index iterator has already been answered or declined by
its index, and
+ // only an extracted VARIANT path can be absent from a segment.
+ const int column_id = assert_cast<const
VSlotRef*>(input.get())->column_id();
+ const auto& column = *index_context.read_schema()->column(column_id);
+ if (index_context.get_inverted_index_iterator(column_id) != nullptr ||
+ !column.is_extracted_column()) {
+ return Status::OK();
+ }
+ bool absent = false;
+ RETURN_IF_ERROR(index_context.is_variant_path_absent(
+ column_id, column.path_info_ptr()->copy_pop_front(), &absent));
Review Comment:
Confirmed and fixed in fd5f5add671, narrowed in e22e4da1a28.
`IndexExecContext::is_variant_path_absent` now treats a path as stored when
the segment's path encoding is legacy (0) and a prefix exists under either FE's
component (`['a.b']`) or the split path (`a -> b`), the same normalization the
read plan applies. So a stored `a.b.c` keeps `v['a.b']` on row evaluation
instead of being proved absent. The normalization lives only in the absence
proof; `VariantColumnReader`'s read paths are unchanged.
Tests: BE UT
`VariantColumnWriterReaderTest.test_match_reads_rows_for_legacy_dotted_variant_path`
(inline-metadata V2 segment, fails without the fix) and regression
`search/test_search_score_boolean_branches` case `variant_dotted_path` (no rows
before, row 1 after, matching row evaluation).
--
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]