Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.9k
[Refactor](inverted index) refactor inverted index interface in tablet schema#43003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -644,7 +644,7 @@ Status Compaction::do_inverted_index_compaction() { | ||
| Status status = Status::OK(); | ||
| for (auto&& column_uniq_id : ctx.columns_to_do_index_compaction) { | ||
| auto col = _cur_tablet_schema->column_by_uid(column_uniq_id); | ||
| const auto* index_meta = _cur_tablet_schema->get_inverted_index(col); | ||
| const auto* index_meta = _cur_tablet_schema->inverted_index(col); | ||
csun5285 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| std::vector<lucene::store::Directory*> dest_index_dirs(dest_segment_num); | ||
| try { | ||
| @@ -682,15 +682,11 @@ Status Compaction::do_inverted_index_compaction() { | ||
| } | ||
| void Compaction::construct_index_compaction_columns(RowsetWriterContext& ctx) { | ||
| for (const auto& index : _cur_tablet_schema->indexes()) { | ||
| if (index.index_type() != IndexType::INVERTED) { | ||
| continue; | ||
| } | ||
| auto col_unique_ids = index.col_unique_ids(); | ||
| for (const auto& index : _cur_tablet_schema->inverted_indexes()) { | ||
| auto col_unique_ids = index->col_unique_ids(); | ||
| // check if column unique ids is empty to avoid crash | ||
| if (col_unique_ids.empty()) { | ||
| LOG(WARNING) << "tablet[" << _tablet->tablet_id() << "] index[" << index.index_id() | ||
| LOG(WARNING) << "tablet[" << _tablet->tablet_id() << "] index[" << index->index_id() | ||
| << "] has no column unique id, will skip index compaction." | ||
| << " tablet_schema=" << _cur_tablet_schema->dump_full_schema(); | ||
| continue; | ||
| @@ -705,10 +701,9 @@ void Compaction::construct_index_compaction_columns(RowsetWriterContext& ctx) { | ||
| bool is_continue = false; | ||
| std::optional<std::map<std::string, std::string>> first_properties; | ||
| for (const auto& rowset : _input_rowsets) { | ||
| const auto* tablet_index = | ||
| rowset->tablet_schema()->get_inverted_index(col_unique_id, ""); | ||
| const auto* tablet_index = rowset->tablet_schema()->inverted_index(col_unique_id); | ||
| // no inverted index or index id is different from current index id | ||
| if (tablet_index == nullptr || tablet_index->index_id() != index.index_id()) { | ||
| if (tablet_index == nullptr || tablet_index->index_id() != index->index_id()) { | ||
| is_continue = true; | ||
| break; | ||
| } | ||
| @@ -741,7 +736,7 @@ void Compaction::construct_index_compaction_columns(RowsetWriterContext& ctx) { | ||
| return false; | ||
| } | ||
| const auto* index_meta = rowset->tablet_schema()->get_inverted_index(col_unique_id, ""); | ||
| const auto* index_meta = rowset->tablet_schema()->inverted_index(col_unique_id); | ||
| if (index_meta == nullptr) { | ||
| LOG(WARNING) << "tablet[" << _tablet->tablet_id() << "] column_unique_id[" | ||
| << col_unique_id << "] index meta is null, will skip index compaction"; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -63,7 +63,7 @@ struct ColumnWriterOptions { | ||
| bool need_inverted_index = false; | ||
| uint8_t gram_size; | ||
| uint16_t gram_bf_size; | ||
| std::vector<const TabletIndex*> indexes; | ||
| std::vector<const TabletIndex*> indexes; // unused | ||
csun5285 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| const TabletIndex* inverted_index = nullptr; | ||
| InvertedIndexFileWriter* inverted_index_file_writer; | ||
| std::string to_string() const { | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1057,16 +1057,17 @@ Status SegmentIterator::_init_inverted_index_iterators() { | ||
| return Status::OK(); | ||
| } | ||
| for (auto cid : _schema->column_ids()) { | ||
| // Use segment’s own index_meta, for compatibility with future indexing needs to default to lowercase. | ||
| if (_inverted_index_iterators[cid] == nullptr) { | ||
| // Not check type valid, since we need to get inverted index for related variant type when reading the segment. | ||
| // If check type valid, we can not get inverted index for variant type, and result nullptr.The result for calling | ||
| // get_inverted_index with variant suffix should return corresponding inverted index meta. | ||
| bool check_inverted_index_by_type = false; | ||
| // Use segment’s own index_meta, for compatibility with future indexing needs to default to lowercase. | ||
| // In the _opts.tablet_schema, the sub-column type information for the variant is FieldType::OLAP_FIELD_TYPE_VARIANT. | ||
| // This is because the sub-column is created in create_materialized_variant_column. | ||
| // We use this column to locate the metadata for the inverted index, which requires a unique_id and path. | ||
| const auto& column = _opts.tablet_schema->column(cid); | ||
csun5285 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| int32_t col_unique_id = | ||
| column.is_extracted_column() ? column.parent_unique_id() : column.unique_id(); | ||
| RETURN_IF_ERROR(_segment->new_inverted_index_iterator( | ||
| _opts.tablet_schema->column(cid), | ||
| _segment->_tablet_schema->get_inverted_index(_opts.tablet_schema->column(cid), | ||
| check_inverted_index_by_type), | ||
| column, | ||
| _segment->_tablet_schema->inverted_index(col_unique_id, column.suffix_path()), | ||
csun5285 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| _opts, &_inverted_index_iterators[cid])); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.