Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions be/src/olap/rowset/segment_v2/inverted_index_file_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ Status InvertedIndexFileReader::_init_from(int32_t read_buffer_size, const io::I
if (err.number() == CL_ERR_FileNotFound) {
return Status::Error<ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND>(
"inverted index file {} is not found.", index_file_full_path);
} else if (err.number() == CL_ERR_EmptyIndexSegment) {
return Status::Error<ErrorCode::INVERTED_INDEX_BYPASS>(
"inverted index file {} is empty.", index_file_full_path);
}
return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
"CLuceneError occur when open idx file {}, error msg: {}", index_file_full_path,
Expand Down
4 changes: 4 additions & 0 deletions be/src/olap/rowset/segment_v2/inverted_index_fs_directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ bool DorisFSDirectory::FSIndexInput::open(const io::FileSystemSPtr& fs, const ch
if (h->_reader->size() == 0) {
// may be an empty file
LOG(INFO) << "Opened inverted index file is empty, file is " << path;
// need to return false to avoid the error of CLucene
error.set(CL_ERR_EmptyIndexSegment,
fmt::format("File is empty, file is {}", path).data());
return false;
}
//Store the file length
h->_length = h->_reader->size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ suite("test_variant_empty_index_file", "p0") {
if (!isCloudMode()) {
def (code, out, err) = http_client("GET", String.format("http://%s:%s/api/show_nested_index_file?tablet_id=%s", ip, port, tablet_id))
logger.info("Run show_nested_index_file_on_tablet: code=" + code + ", out=" + out + ", err=" + err)
assertEquals("E-6002", parseJson(out.trim()).status)
assertEquals("E-6004", parseJson(out.trim()).status)
assertTrue(out.contains(" is empty"))
}

qt_sql """ select * from ${tableName} where v match 'abcd'"""
try {
sql """ select /*+ SET_VAR(enable_match_without_inverted_index = 0) */ * from ${tableName} where v match 'abcd'; """
} catch (Exception e) {
log.info(e.getMessage());
assertTrue(e.getMessage().contains("match_any not support execute_match"))
}
}
Loading