Skip to content

Commit f63e575

Browse files
committed
[vector] fix compile on veector-index branch (apache#49733)
rebase apache#49703 on master rm diskann src code (impl is kept as reference) fix BE comple fix fmt NOTE: compilation of FE still has error. --------- Co-authored-by: chenlinzhong <[email protected]> enable faiss hnsw (apache#49745) ``` CREATE TABLE `vector_table` ( `siteid` int(11) NULL DEFAULT "10" COMMENT "", `embedding` array<float> NOT NULL COMMENT "", `comment` text NULL, INDEX idx_test_ann (`embedding`) USING ANN PROPERTIES( "index_type"="hnsw", "metric_type"="l2", "dim"="8", "max_degree"="100") COMMENT 'test diskann index', INDEX idx_comment (`comment`) USING INVERTED PROPERTIES("support_phrase" = "true", "parser" = "english", "lower_case" = "true") COMMENT 'inverted index for comment' ) ENGINE=OLAP duplicate KEY(`siteid`) COMMENT "OLAP" DISTRIBUTED BY HASH(`siteid`) BUCKETS 1 PROPERTIES ( "replication_num" = "1" ); INSERT INTO `vector_table` (`siteid`, `embedding`,`comment`) VALUES (10, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0,20],"emb1"), (20, [7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0,30],"emb2") -------------- Query OK, 2 rows affected (0.07 sec) {'label':'label_858347013b14baf_b9db5d59b5e30322', 'status':'VISIBLE', 'txnId':'18029'} ``` ``` I20250401 19:18:17.977408 3765348 faiss_vector_index.cpp:86] Faiss index saved to faiss.idx, rows 2 ``` [fetura](vector) Extend the index interface to support vector indexing. (apache#49780) Issue Number: close #xxx Related PR: #xxx Problem Summary: None - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> [feature](index) update phycical plan def for vector index [fix](inverted index) Fix compilation error (apache#50286) add is_virtual_slot (apache#50390) [opt](Nereids) push down virtual column into scan (apache#50521) [fix](vector) column prune is wrong on virtual column (apache#50550) [fix](vector) equals and hashcode are wrong in olap relation (apache#50558) [fix](vector) should retain all virtual columns (apache#50571) [feature](vector) push down ann topn into scan [opt](vector) reopen push down virtual column in filter rule remove all x_ prefix (apache#50995) Issue Number: close #xxx Related PR: #xxx Problem Summary: None - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> [opt](vector) refactor some scan code [feat] VirtualColumn & ANNTopN & AnnRangeSearch (apache#50403) This is the first version with relatively stable behavior: * Pass the TPC-H test without crashes. * Perform range search without crashes. * Perform ANN Top-N search without crashes. * Perform compound search (range + Top-N) without crashes. Some unit tests are unstable; they may be related to the Faiss library. ```text [ FAILED ] 4 tests, listed below: [ FAILED ] VectorSearchTest.AnnTopNDescriptorEvaluateTopN [ FAILED ] VectorSearchTest.CompRangeSearch [ FAILED ] VectorSearchTest.RangeSearchNoSelector1 [ FAILED ] VectorSearchTest.RangeSearchWithSelector1 ``` tpch test has some unstable failure: ```text q13 Error: Failed to execute query q13 (cold run). Output: ERROR 1105 (HY000) at line 18: errCode = 2, detailMessage = (10.16.10.2)[INTERNAL_ERROR]Parameters start = 0, length = 4064, are out of bound in ColumnVector<T>::insert_range_from method (data.size() = 0). ``` fix virtual column expr context (apache#51085) failure of tpchq13 is fixed. [opt](vector) only extract l2_distance from filter fix rebase master [fix] fix unstable test case (apache#51159) Search result of diff faiss index object is not same if we use batch insert mode. So i refactored the test case to make sure we can compare result of native faiss and vector index of doris [vector search] Step forward on stability and functionality (apache#51213) A huge step forward on stability and functionality. 1. Search parameters like `ef_search`, can be passed to index as session variables. This behavior is same with pg-vector and duckdb vector search plug-in. 2. Correct processing for order by desc. Fallback to brute force search when it is necessary. 3. Support using inner product as index metric and order by inner_product. 4. When metrics of sql dismatches with index, fallback to brute force. 1. More unit test 2. Virtual column iterator. 3. According to custom script, result of range search, topn search & compound search is almost same with native faiss. The overlap rate of result is more than 90%. The 10% difference is introduced by batch insert mode of native faiss. [fix] VirtualColumnIterator should do scatter to input column in its prepare function. (apache#51299) step forward on vector search (apache#51374) 1. VirtualColumnIterator seek_to_ordinal should check its _max_ordinal. 2. Fix data race of ann_index_reader load_index. 1. Add l2_distance_approximate & inner_product_approximate. 2. Above xxx_approximate function will be pushed to index, l2_distance/inner_product will do exhaustive search. 1. Rename AnnTopNDescriptor to AnnTopNRuntime Refactor: remove useless tools more functionality on ann index (apache#51524) 1. Add check for index properties when creating index. 2. delete some useless cpp files. Fix multi-threads range search Fix rebase master compile [fix](vector) plan conflict with topn lazy materialization [fix](vector) lost row id slot desc fix conflict with global lazy materialization (apache#52093) 解决跟 TOP N 全局延迟物化实现上的冲突以及一些DDL的增强。 解决冲突: 1. 在 finalizeForNereids 中为每个虚拟列绑定一个 Column,这个 Column 的 unique id 从 INT32_MAX - 1 开始递减 2. 虚拟列绑定的 Column 的 NAME 必须以 `__DORIS_VIRTUAL_COL__` 开头 3. 类型需要与 VirtualSlot 的输出类型一致 4. 上述绑定必须在 finalizeForNereids 阶段而不是 toThrift 的时候做,不然无法处理 DescriptorTable,并且只有这样才能在 explain 的时候能够看到真正的 unique id 5. `toThrift`阶段把虚拟列的 Column 添加到 ColumnDesc 里面 BE 上删除了虚拟列计算 cid 的一些特殊逻辑,按照普通列去处理。 [feature](score) Add score function (apache#52113) fix ann index compaction & inner product plan (apache#52150) DE FIX COMPACTION & INNER_PRODUCT FIX DELETE PREDICATE RM USLESS ann with fulltext third party
1 parent 8192445 commit f63e575

File tree

247 files changed

+14621
-4389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+14621
-4389
lines changed

be/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ endif()
177177

178178
set(GPERFTOOLS_HOME "${THIRDPARTY_DIR}/gperftools")
179179

180-
option(BUILD_FAISS "Link doris with faiss for vector similarity search" OFF)
180+
option(BUILD_FAISS "Link doris with faiss for vector similarity search" ON)
181181
message(STATUS "build faiss: ${BUILD_FAISS}")
182182

183183
include (cmake/thirdparty.cmake)
@@ -283,6 +283,7 @@ add_compile_options(-g
283283

284284
add_compile_options(-Wno-unused-parameter
285285
-Wno-deprecated-declarations
286+
-Wno-self-assign-field
286287
-Wno-sign-compare)
287288

288289
if (COMPILER_GCC)
@@ -382,6 +383,10 @@ if (USE_DWARF)
382383
add_compile_options(-gdwarf-5)
383384
endif()
384385

386+
if (BUILD_FAISS)
387+
add_definitions(-DBUILD_FAISS)
388+
endif()
389+
385390
# For CMAKE_BUILD_TYPE=Debug
386391
if (OS_MACOSX AND ARCH_ARM)
387392
# Using -O0 may meet ARM64 branch out of range errors when linking with tcmalloc.
@@ -519,6 +524,7 @@ set(DORIS_LINK_LIBS
519524
Cloud
520525
${WL_END_GROUP}
521526
CommonCPP
527+
vector
522528
)
523529

524530
set(absl_DIR ${THIRDPARTY_DIR}/lib/cmake/absl)
@@ -760,6 +766,7 @@ function(pch_reuse target)
760766
endif()
761767
endfunction(pch_reuse target)
762768

769+
763770
add_subdirectory(${SRC_DIR}/agent)
764771
add_subdirectory(${SRC_DIR}/common)
765772
add_subdirectory(${SRC_DIR}/exec)
@@ -775,6 +782,8 @@ add_subdirectory(${SRC_DIR}/runtime_filter)
775782
add_subdirectory(${SRC_DIR}/service) # this include doris_be
776783
add_subdirectory(${SRC_DIR}/udf)
777784
add_subdirectory(${SRC_DIR}/cloud)
785+
add_subdirectory(${SRC_DIR}/vector)
786+
778787

779788
option(BUILD_META_TOOL "Build meta tool" OFF)
780789
if (BUILD_META_TOOL)

be/src/cloud/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
1819
# where to put generated libraries
1920
set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/cloud")
2021

be/src/clucene

be/src/common/consts.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const std::string GLOBAL_ROWID_COL = "__DORIS_GLOBAL_ROWID_COL__";
3131
const std::string ROW_STORE_COL = "__DORIS_ROW_STORE_COL__";
3232
const std::string DYNAMIC_COLUMN_NAME = "__DORIS_DYNAMIC_COL__";
3333
const std::string PARTIAL_UPDATE_AUTO_INC_COL = "__PARTIAL_UPDATE_AUTO_INC_COLUMN__";
34+
const std::string VIRTUAL_COLUMN_PREFIX = "__DORIS_VIRTUAL_COL__";
3435

3536
/// The maximum precision representable by a 4-byte decimal (Decimal4Value)
3637
constexpr int MAX_DECIMAL32_PRECISION = 9;

be/src/common/status.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ namespace ErrorCode {
278278
E(SEGCOMPACTION_FAILED, -3119, false); \
279279
E(ROWSET_ADD_TO_BINLOG_FAILED, -3122, true); \
280280
E(ROWSET_BINLOG_NOT_ONLY_ONE_VERSION, -3123, true); \
281-
E(INVERTED_INDEX_INVALID_PARAMETERS, -6000, false); \
281+
E(INDEX_INVALID_PARAMETERS, -6000, false); \
282282
E(INVERTED_INDEX_NOT_SUPPORTED, -6001, false); \
283283
E(INVERTED_INDEX_CLUCENE_ERROR, -6002, false); \
284284
E(INVERTED_INDEX_FILE_NOT_FOUND, -6003, false); \

be/src/index-tools/index_tool.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@
4141
#pragma clang diagnostic pop
4242
#endif
4343
#include "io/fs/local_file_system.h"
44+
#include "olap/rowset/segment_v2/index_file_reader.h"
45+
#include "olap/rowset/segment_v2/index_file_writer.h"
4446
#include "olap/rowset/segment_v2/inverted_index/query/conjunction_query.h"
4547
#include "olap/rowset/segment_v2/inverted_index_compound_reader.h"
4648
#include "olap/rowset/segment_v2/inverted_index_desc.h"
47-
#include "olap/rowset/segment_v2/inverted_index_file_reader.h"
48-
#include "olap/rowset/segment_v2/inverted_index_file_writer.h"
4949
#include "olap/rowset/segment_v2/inverted_index_fs_directory.h"
5050
#include "olap/tablet_schema.h"
5151

5252
using doris::segment_v2::DorisCompoundReader;
5353
using doris::segment_v2::DorisFSDirectoryFactory;
54-
using doris::segment_v2::InvertedIndexFileWriter;
54+
using doris::segment_v2::IndexFileWriter;
5555
using doris::segment_v2::InvertedIndexDescriptor;
56-
using doris::segment_v2::InvertedIndexFileReader;
56+
using doris::segment_v2::IndexFileReader;
5757
using doris::io::FileInfo;
5858
using doris::TabletIndex;
5959
using namespace doris::segment_v2;
@@ -550,14 +550,14 @@ int main(int argc, char** argv) {
550550
}
551551

552552
auto fs = doris::io::global_local_filesystem();
553-
auto index_file_writer = std::make_unique<InvertedIndexFileWriter>(
553+
auto index_file_writer = std::make_unique<IndexFileWriter>(
554554
fs,
555555
std::string {InvertedIndexDescriptor::get_index_file_path_prefix(
556556
doris::local_segment_path(file_dir, rowset_id, seg_id))},
557557
rowset_id, seg_id, doris::InvertedIndexStorageFormatPB::V2);
558558
auto st = index_file_writer->open(&index_meta);
559559
if (!st.has_value()) {
560-
std::cerr << "InvertedIndexFileWriter init error:" << st.error() << std::endl;
560+
std::cerr << "IndexFileWriter init error:" << st.error() << std::endl;
561561
return -1;
562562
}
563563
using T = std::decay_t<decltype(st)>;
@@ -601,7 +601,7 @@ int main(int argc, char** argv) {
601601

602602
auto ret = index_file_writer->close();
603603
if (!ret.ok()) {
604-
std::cerr << "InvertedIndexFileWriter close error:" << ret.msg() << std::endl;
604+
std::cerr << "IndexFileWriter close error:" << ret.msg() << std::endl;
605605
return -1;
606606
}
607607
} else if (FLAGS_operation == "show_nested_files_v2") {
@@ -613,11 +613,11 @@ int main(int argc, char** argv) {
613613
google::protobuf::StripSuffixString(FLAGS_idx_file_path, ".idx");
614614
auto fs = doris::io::global_local_filesystem();
615615
try {
616-
auto index_file_reader = std::make_unique<InvertedIndexFileReader>(
616+
auto index_file_reader = std::make_unique<IndexFileReader>(
617617
fs, index_path_prefix, doris::InvertedIndexStorageFormatPB::V2);
618618
auto st = index_file_reader->init(4096);
619619
if (!st.ok()) {
620-
std::cerr << "InvertedIndexFileReader init error:" << st.msg() << std::endl;
620+
std::cerr << "IndexFileReader init error:" << st.msg() << std::endl;
621621
return -1;
622622
}
623623
std::cout << "Nested files for " << index_path_prefix << std::endl;
@@ -638,7 +638,7 @@ int main(int argc, char** argv) {
638638
CLuceneError err;
639639
auto ret = index_file_reader->open(&index_meta);
640640
if (!ret.has_value()) {
641-
std::cerr << "InvertedIndexFileReader open error:" << ret.error() << std::endl;
641+
std::cerr << "IndexFileReader open error:" << ret.error() << std::endl;
642642
return -1;
643643
}
644644
using T = std::decay_t<decltype(ret)>;
@@ -660,11 +660,11 @@ int main(int argc, char** argv) {
660660
google::protobuf::StripSuffixString(FLAGS_idx_file_path, ".idx");
661661
auto fs = doris::io::global_local_filesystem();
662662
try {
663-
auto index_file_reader = std::make_unique<InvertedIndexFileReader>(
663+
auto index_file_reader = std::make_unique<IndexFileReader>(
664664
fs, index_path_prefix, doris::InvertedIndexStorageFormatPB::V2);
665665
auto st = index_file_reader->init(4096);
666666
if (!st.ok()) {
667-
std::cerr << "InvertedIndexFileReader init error:" << st.msg() << std::endl;
667+
std::cerr << "IndexFileReader init error:" << st.msg() << std::endl;
668668
return -1;
669669
}
670670
std::vector<std::string> files;
@@ -677,7 +677,7 @@ int main(int argc, char** argv) {
677677
index_meta.init_from_pb(index_pb);
678678
auto ret = index_file_reader->open(&index_meta);
679679
if (!ret.has_value()) {
680-
std::cerr << "InvertedIndexFileReader open error:" << ret.error() << std::endl;
680+
std::cerr << "IndexFileReader open error:" << ret.error() << std::endl;
681681
return -1;
682682
}
683683
using T = std::decay_t<decltype(ret)>;

be/src/olap/accept_null_predicate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AcceptNullPredicate : public ColumnPredicate {
5151
}
5252

5353
Status evaluate(const vectorized::IndexFieldNameAndTypePair& name_with_type,
54-
InvertedIndexIterator* iterator, uint32_t num_rows,
54+
IndexIterator* iterator, uint32_t num_rows,
5555
roaring::Roaring* bitmap) const override {
5656
return _nested->evaluate(name_with_type, iterator, num_rows, bitmap);
5757
}

be/src/olap/column_predicate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "common/exception.h"
2424
#include "olap/rowset/segment_v2/bitmap_index_reader.h"
2525
#include "olap/rowset/segment_v2/bloom_filter.h"
26-
#include "olap/rowset/segment_v2/inverted_index_reader.h"
26+
#include "olap/rowset/segment_v2/inverted_index_iterator.h"
2727
#include "runtime/define_primitive_type.h"
2828
#include "util/runtime_profile.h"
2929
#include "vec/columns/column.h"
@@ -170,7 +170,7 @@ class ColumnPredicate {
170170

171171
//evaluate predicate on inverted
172172
virtual Status evaluate(const vectorized::IndexFieldNameAndTypePair& name_with_type,
173-
InvertedIndexIterator* iterator, uint32_t num_rows,
173+
IndexIterator* iterator, uint32_t num_rows,
174174
roaring::Roaring* bitmap) const {
175175
return Status::NotSupported(
176176
"Not Implemented evaluate with inverted index, please check the predicate");

be/src/olap/compaction.cpp

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@
6060
#include "olap/rowset/rowset_meta.h"
6161
#include "olap/rowset/rowset_writer.h"
6262
#include "olap/rowset/rowset_writer_context.h"
63+
#include "olap/rowset/segment_v2/index_file_reader.h"
64+
#include "olap/rowset/segment_v2/index_file_writer.h"
6365
#include "olap/rowset/segment_v2/inverted_index_compaction.h"
6466
#include "olap/rowset/segment_v2/inverted_index_desc.h"
65-
#include "olap/rowset/segment_v2/inverted_index_file_reader.h"
66-
#include "olap/rowset/segment_v2/inverted_index_file_writer.h"
6767
#include "olap/rowset/segment_v2/inverted_index_fs_directory.h"
68+
#include "olap/rowset/segment_v2/tmp_file_dirs.h"
6869
#include "olap/storage_engine.h"
6970
#include "olap/storage_policy.h"
7071
#include "olap/tablet.h"
@@ -671,8 +672,7 @@ Status Compaction::do_inverted_index_compaction() {
671672
}
672673

673674
// src index dirs
674-
std::vector<std::unique_ptr<InvertedIndexFileReader>> inverted_index_file_readers(
675-
src_segment_num);
675+
std::vector<std::unique_ptr<IndexFileReader>> index_file_readers(src_segment_num);
676676
for (const auto& m : src_seg_to_id_map) {
677677
const auto& [rowset_id, seg_id] = m.first;
678678

@@ -713,12 +713,12 @@ Status Compaction::do_inverted_index_compaction() {
713713
"get segment path failed. tablet_id={} rowset_id={} seg_id={}",
714714
_tablet->tablet_id(), rowset_id.to_string(), seg_id);
715715
}
716-
auto inverted_index_file_reader = std::make_unique<InvertedIndexFileReader>(
716+
auto index_file_reader = std::make_unique<IndexFileReader>(
717717
fs,
718718
std::string {InvertedIndexDescriptor::get_index_file_path_prefix(seg_path.value())},
719719
_cur_tablet_schema->get_inverted_index_storage_format(),
720720
rowset->rowset_meta()->inverted_index_file_info(seg_id));
721-
auto st = inverted_index_file_reader->init(config::inverted_index_read_buffer_size);
721+
auto st = index_file_reader->init(config::inverted_index_read_buffer_size);
722722
DBUG_EXECUTE_IF("Compaction::do_inverted_index_compaction_init_inverted_index_file_reader",
723723
{
724724
st = Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
@@ -736,26 +736,24 @@ Status Compaction::do_inverted_index_compaction() {
736736
"init inverted index file reader failed. tablet_id={} rowset_id={} seg_id={}",
737737
_tablet->tablet_id(), rowset_id.to_string(), seg_id);
738738
}
739-
inverted_index_file_readers[m.second] = std::move(inverted_index_file_reader);
739+
index_file_readers[m.second] = std::move(index_file_reader);
740740
}
741741

742742
// dest index files
743743
// format: rowsetId_segmentId
744-
auto& inverted_index_file_writers = dynamic_cast<BaseBetaRowsetWriter*>(_output_rs_writer.get())
745-
->inverted_index_file_writers();
746-
DBUG_EXECUTE_IF(
747-
"Compaction::do_inverted_index_compaction_inverted_index_file_writers_size_error",
748-
{ inverted_index_file_writers.clear(); })
749-
if (inverted_index_file_writers.size() != dest_segment_num) {
744+
auto& index_file_writers =
745+
dynamic_cast<BaseBetaRowsetWriter*>(_output_rs_writer.get())->index_file_writers();
746+
DBUG_EXECUTE_IF("Compaction::do_inverted_index_compaction_index_file_writers_size_error",
747+
{ index_file_writers.clear(); })
748+
if (index_file_writers.size() != dest_segment_num) {
750749
LOG(WARNING) << "failed to do index compaction, dest segment num not match. tablet_id="
751750
<< _tablet->tablet_id() << " dest_segment_num=" << dest_segment_num
752-
<< " inverted_index_file_writers.size()="
753-
<< inverted_index_file_writers.size();
751+
<< " index_file_writers.size()=" << index_file_writers.size();
754752
mark_skip_index_compaction(ctx, error_handler);
755753
return Status::Error<INVERTED_INDEX_COMPACTION_ERROR>(
756754
"dest segment num not match. tablet_id={} dest_segment_num={} "
757-
"inverted_index_file_writers.size()={}",
758-
_tablet->tablet_id(), dest_segment_num, inverted_index_file_writers.size());
755+
"index_file_writers.size()={}",
756+
_tablet->tablet_id(), dest_segment_num, index_file_writers.size());
759757
}
760758

761759
// use tmp file dir to store index files
@@ -785,7 +783,7 @@ Status Compaction::do_inverted_index_compaction() {
785783
try {
786784
std::vector<std::unique_ptr<DorisCompoundReader>> src_idx_dirs(src_segment_num);
787785
for (int src_segment_id = 0; src_segment_id < src_segment_num; src_segment_id++) {
788-
auto res = inverted_index_file_readers[src_segment_id]->open(index_meta);
786+
auto res = index_file_readers[src_segment_id]->open(index_meta);
789787
DBUG_EXECUTE_IF("Compaction::open_inverted_index_file_reader", {
790788
res = ResultError(Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
791789
"debug point: Compaction::open_index_file_reader error"));
@@ -801,10 +799,10 @@ Status Compaction::do_inverted_index_compaction() {
801799
src_idx_dirs[src_segment_id] = std::move(res.value());
802800
}
803801
for (int dest_segment_id = 0; dest_segment_id < dest_segment_num; dest_segment_id++) {
804-
auto res = inverted_index_file_writers[dest_segment_id]->open(index_meta);
805-
DBUG_EXECUTE_IF("Compaction::open_inverted_index_file_writer", {
802+
auto res = index_file_writers[dest_segment_id]->open(index_meta);
803+
DBUG_EXECUTE_IF("Compaction::open_index_file_writer", {
806804
res = ResultError(Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
807-
"debug point: Compaction::open_inverted_index_file_writer error"));
805+
"debug point: Compaction::open_index_file_writer error"));
808806
})
809807
if (!res.has_value()) {
810808
LOG(WARNING) << "failed to do index compaction, open inverted index file "
@@ -815,7 +813,7 @@ Status Compaction::do_inverted_index_compaction() {
815813
throw Exception(ErrorCode::INVERTED_INDEX_COMPACTION_ERROR, res.error().msg());
816814
}
817815
// Destination directories in dest_index_dirs do not need to be deconstructed,
818-
// but their lifecycle must be managed by inverted_index_file_writers.
816+
// but their lifecycle must be managed by index_file_writers.
819817
dest_index_dirs[dest_segment_id] = res.value().get();
820818
}
821819
auto st = compact_column(index_meta->index_id(), src_idx_dirs, dest_index_dirs,
@@ -953,15 +951,14 @@ void Compaction::construct_index_compaction_columns(RowsetWriterContext& ctx) {
953951

954952
std::string index_file_path;
955953
try {
956-
auto inverted_index_file_reader = std::make_unique<InvertedIndexFileReader>(
954+
auto index_file_reader = std::make_unique<IndexFileReader>(
957955
fs,
958956
std::string {InvertedIndexDescriptor::get_index_file_path_prefix(
959957
seg_path.value())},
960958
_cur_tablet_schema->get_inverted_index_storage_format(),
961959
rowset->rowset_meta()->inverted_index_file_info(i));
962-
auto st = inverted_index_file_reader->init(
963-
config::inverted_index_read_buffer_size);
964-
index_file_path = inverted_index_file_reader->get_index_file_path(index_meta);
960+
auto st = index_file_reader->init(config::inverted_index_read_buffer_size);
961+
index_file_path = index_file_reader->get_index_file_path(index_meta);
965962
DBUG_EXECUTE_IF(
966963
"Compaction::construct_skip_inverted_index_index_file_reader_init_"
967964
"status_not_ok",
@@ -978,7 +975,7 @@ void Compaction::construct_index_compaction_columns(RowsetWriterContext& ctx) {
978975
}
979976

980977
// check index meta
981-
auto result = inverted_index_file_reader->open(index_meta);
978+
auto result = index_file_reader->open(index_meta);
982979
DBUG_EXECUTE_IF(
983980
"Compaction::construct_skip_inverted_index_index_file_reader_open_"
984981
"error",

0 commit comments

Comments
 (0)