Skip to content

Commit da76fce

Browse files
committed
[opt](inverted index) Add null document interface to optimize empty string indexing (apache#28661)
1 parent c5ee025 commit da76fce

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

be/src/olap/rowset/segment_v2/inverted_index_writer.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,17 @@ class InvertedIndexColumnWriterImpl : public InvertedIndexColumnWriter {
229229
return Status::OK();
230230
}
231231

232+
Status add_null_document() {
233+
try {
234+
_index_writer->addNullDocument(_doc.get());
235+
} catch (const CLuceneError& e) {
236+
_dir->deleteDirectory();
237+
return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
238+
"CLuceneError add_null_document: {}", e.what());
239+
}
240+
return Status::OK();
241+
}
242+
232243
Status add_nulls(uint32_t count) override {
233244
_null_bitmap.addRange(_rid, _rid + count);
234245
_rid += count;
@@ -241,7 +252,7 @@ class InvertedIndexColumnWriterImpl : public InvertedIndexColumnWriter {
241252

242253
for (int i = 0; i < count; ++i) {
243254
new_fulltext_field(empty_value.c_str(), 0);
244-
RETURN_IF_ERROR(add_document());
255+
RETURN_IF_ERROR(add_null_document());
245256
}
246257
}
247258
return Status::OK();

0 commit comments

Comments
 (0)