github-actions[bot] commented on code in PR #69761:
URL: https://github.com/apache/doris/pull/69761#discussion_r4430638442
##########
be/src/storage/tablet/tablet_schema.cpp:
##########
@@ -57,6 +57,7 @@
#include "storage/types.h"
#include "storage/utils.h"
#include "util/json/path_in_data.h"
+#include "util/string_util.h"
Review Comment:
[P1] Keep ordinary VARIANT indexes available to direct-root SEARCH
`RewriteSearchToSlots` and `OlapTable.getInvertedIndex(column, null)` still
accept an ordinary parent index such as `idx_var2(v)` for generic `SEARCH`. At
scan setup, however, this new branch removes every non-values index from
`inverted_indexs(const TabletColumn&)`, and `SegmentIterator` uses that lookup
for a direct VARIANT column. The resulting `VSearchExpr` has no iterator for
`v` and `FieldReaderResolver` returns `INVERTED_INDEX_FILE_NOT_FOUND`; SEARCH
has no row-evaluation fallback, so a previously valid direct-root SEARCH fails.
Preserve ordinary parent indexes for SEARCH/index lifecycle lookups and
restrict values-only filtering to direct-root MATCH binding.
##########
be/src/exec/common/variant_util.cpp:
##########
@@ -1152,19 +1152,50 @@ void
VariantCompactionUtil::get_compaction_subcolumns_from_data_types(
append_empty_key_subcolumn_from_stats(paths_set_info, parent_column,
output_schema);
}
+bool VariantCompactionUtil::has_values_index(const TabletSchema& schema) {
+ return std::ranges::any_of(schema.inverted_indexes(), [](const
TabletIndex* index) {
+ return index->is_variant_values_index();
+ });
+}
+
+Status VariantCompactionUtil::plan_values_index_compaction(
+ const std::vector<RowsetSharedPtr>& rowsets, bool expand_subcolumns,
+ const std::set<std::pair<int32_t, int64_t>>& native_indexes,
TabletSchemaSPtr& schema,
+ VariantCompactionPathsSPtr* paths) {
+ std::set<int32_t> rebuild_roots;
+ for (const auto* index : schema->inverted_indexes()) {
+ if (index->is_variant_values_index() &&
+ !native_indexes.contains({index->col_unique_ids().front(),
index->index_id()})) {
Review Comment:
[P2] Guard empty column IDs before values-index planning
`plan_values_index_compaction()` calls `index->col_unique_ids().front()`
twice for every values-scope index. Existing compaction code deliberately
treats empty column-UID metadata as recoverable and skips/rebuilds it, and
`test_col_unique_ids_empty` covers that compatibility path. A replayed
malformed index carrying `variant_index_scope=values` now reaches this new
planner through `has_values_index()` and crashes before the existing guard.
Check for an empty UID list (or return a clear status) before dereferencing it.
--
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]