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


##########
be/src/exec/common/variant_util.cpp:
##########
@@ -1152,19 +1156,55 @@ 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() && 
!index->col_unique_ids().empty();
+    });
+}
+
+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()) {
+        // Replayed indexes without column IDs are skipped by index compaction 
as well.
+        if (index->col_unique_ids().empty()) {
+            continue;
+        }
+        if (index->is_variant_values_index() &&
+            !native_indexes.contains({index->col_unique_ids().front(), 
index->index_id()})) {

Review Comment:
   [P1] Preserve ordinary VARIANT path indexes during values-index compaction
   
   When a table has `values_idx(v)` plus an ordinary path index such as 
`path_idx(v)`, `plan_values_index_compaction()` either calls 
`copy_without_variant_extracted_columns()` when vertical expansion is disabled 
or skips a root whose values index must be rebuilt. The output root's 
`TabletSchema::inverted_indexs(const TabletColumn&)` now filters out 
`path_idx`, and `VerticalSegmentWriter` only recovers path indexes from 
extracted columns or the variant path plan. If path selection omits an 
index-bearing path, compaction can write the values index without rebuilding 
`path_idx`; later `v['s'] MATCH...` or `SEARCH` cannot use the declared path 
index. Keep ordinary path-index metadata/layout in the rebuild plan and cover 
values+path compaction with vertical expansion both on and off.



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