diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp index 373cd1230c86a5..1acd0ae71291cc 100644 --- a/be/src/olap/compaction.cpp +++ b/be/src/olap/compaction.cpp @@ -688,6 +688,12 @@ void Compaction::construct_skip_inverted_index(RowsetWriterContext& ctx) { for (const auto& rowset : _input_rowsets) { const auto* tablet_index = rowset->tablet_schema()->get_inverted_index(col_unique_id, ""); + // no inverted index + if (tablet_index == nullptr) { + ctx.skip_inverted_index.insert(col_unique_id); + is_continue = true; + break; + } const auto& properties = tablet_index->properties(); if (!first_properties.has_value()) { first_properties = properties; diff --git a/be/src/olap/rowset/segment_v2/inverted_index_file_writer.h b/be/src/olap/rowset/segment_v2/inverted_index_file_writer.h index 107ddecb949713..9834a6f2dbb165 100644 --- a/be/src/olap/rowset/segment_v2/inverted_index_file_writer.h +++ b/be/src/olap/rowset/segment_v2/inverted_index_file_writer.h @@ -78,6 +78,20 @@ class InvertedIndexFileWriter { void set_file_writer_opts(const io::FileWriterOptions& opts) { _opts = opts; } + std::string debug_string() { + std::stringstream indices_dirs; + for (const auto& [index, dir] : _indices_dirs) { + indices_dirs << "index id is: " << index.first << " , index suffix is: " << index.second + << " , index dir is: " << dir->toString(); + } + return fmt::format( + "inverted index file writer debug string: index storage format is: {}, index path " + "prefix is: {}, rowset id is: {}, seg id is: {}, closed is: {}, total file size " + "is: {}, index dirs is: {}", + _storage_format, _index_path_prefix, _rowset_id, _seg_id, _closed, _total_file_size, + indices_dirs.str()); + } + private: InvertedIndexDirectoryMap _indices_dirs; const io::FileSystemSPtr _fs;