-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](inverted index) normal process query for null condition when in… #33663
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -159,7 +159,8 @@ Status InvertedIndexReader::read_null_bitmap(InvertedIndexQueryCacheHandle* cach | |||||
| if (cache->lookup(cache_key, cache_handle)) { | ||||||
| return Status::OK(); | ||||||
| } | ||||||
| std::unique_ptr<InvertedIndexFileReader> multi_compound_reader; | ||||||
|
|
||||||
| RETURN_IF_ERROR(check_file_exist(index_file_key)); | ||||||
|
|
||||||
| if (!dir) { | ||||||
| // TODO: ugly code here, try to refact. | ||||||
|
|
@@ -209,13 +210,7 @@ Status InvertedIndexReader::handle_searcher_cache( | |||||
| auto mem_tracker = std::make_unique<MemTracker>("InvertedIndexSearcherCacheWithRead"); | ||||||
| SCOPED_RAW_TIMER(&stats->inverted_index_searcher_open_timer); | ||||||
| IndexSearcherPtr searcher; | ||||||
| bool exists = false; | ||||||
| RETURN_IF_ERROR(_inverted_index_file_reader->index_file_exist(&_index_meta, &exists)); | ||||||
| if (!exists) { | ||||||
| LOG(WARNING) << "inverted index: " << index_file_key << " not exist."; | ||||||
| return Status::Error<ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND>( | ||||||
| "inverted index input file {} not found", index_file_key); | ||||||
| } | ||||||
| RETURN_IF_ERROR(check_file_exist(index_file_key)); | ||||||
| auto dir = DORIS_TRY(_inverted_index_file_reader->open(&_index_meta)); | ||||||
| // try to reuse index_searcher's directory to read null_bitmap to cache | ||||||
| // to avoid open directory additionally for null_bitmap | ||||||
|
|
@@ -247,6 +242,17 @@ Status InvertedIndexReader::create_index_searcher(lucene::store::Directory* dir, | |||||
| return Status::OK(); | ||||||
| }; | ||||||
|
|
||||||
| Status InvertedIndexReader::check_file_exist(const std::string& index_file_key) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: method 'check_file_exist' can be made static [readability-convert-member-functions-to-static]
Suggested change
|
||||||
| bool exists = false; | ||||||
| RETURN_IF_ERROR(_inverted_index_file_reader->index_file_exist(&_index_meta, &exists)); | ||||||
| if (!exists) { | ||||||
| LOG(WARNING) << "inverted index: " << index_file_key << " not exist."; | ||||||
| return Status::Error<ErrorCode::INVERTED_INDEX_FILE_NOT_FOUND>( | ||||||
| "inverted index input file {} not found", index_file_key); | ||||||
| } | ||||||
| return Status::OK(); | ||||||
| } | ||||||
|
|
||||||
| Status FullTextIndexReader::new_iterator(OlapReaderStatistics* stats, RuntimeState* runtime_state, | ||||||
| std::unique_ptr<InvertedIndexIterator>* iterator) { | ||||||
| *iterator = InvertedIndexIterator::create_unique(stats, runtime_state, shared_from_this()); | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
regression-test/data/fault_injection_p0/test_no_index_null_fault_injection.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- This file is automatically generated. You should know what you did if you want to edit this | ||
| -- !sql -- | ||
| 2 | ||
|
|
||
| -- !sql -- | ||
| 3 | ||
|
|
65 changes: 65 additions & 0 deletions
65
regression-test/suites/fault_injection_p0/test_no_index_null_fault_injection.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
|
|
||
| suite("test_no_index_null", "nonConcurrent") { | ||
| // define a sql table | ||
| def testTable = "test_no_index_null" | ||
|
|
||
| def create_httplogs_unique_table = {testTablex -> | ||
| // multi-line sql | ||
| def result = sql """ | ||
| CREATE TABLE ${testTablex} ( | ||
| `@timestamp` INT NULL, | ||
| `clientip` VARCHAR(20) NULL, | ||
| `request` TEXT NULL, | ||
| `status` INT NULL, | ||
| `size` INT NULL, | ||
| INDEX request_idx (`request`) USING INVERTED PROPERTIES("parser" = "unicode", "support_phrase" = "true", "lower_case" = "true") COMMENT '''' | ||
| ) ENGINE=OLAP | ||
| DUPLICATE KEY(`@timestamp`) | ||
| COMMENT 'OLAP' | ||
| DISTRIBUTED BY RANDOM BUCKETS 1 | ||
| PROPERTIES ( | ||
| "replication_allocation" = "tag.location.default: 1", | ||
| "disable_auto_compaction" = "true" | ||
| ); | ||
| """ | ||
| } | ||
|
|
||
| try { | ||
| sql "DROP TABLE IF EXISTS ${testTable}" | ||
| create_httplogs_unique_table.call(testTable) | ||
|
|
||
| try { | ||
| GetDebugPoint().enableDebugPointForAllBEs("column_writer.init") | ||
|
|
||
| sql """ INSERT INTO ${testTable} VALUES (1, '40.135.0.0', 'GET /images/hm_bg.jpg HTTP/1.0', 200, 24736); """ | ||
| sql """ INSERT INTO ${testTable} VALUES (1, '40.135.0.0', 'GET /images/hm_bg.jpg HTTP/1.0', 200, 24736); """ | ||
| sql """ INSERT INTO ${testTable} VALUES (1, '40.135.0.0', NULL, 200, 24736); """ | ||
| sql """ INSERT INTO ${testTable} VALUES (1, '40.135.0.0', 'GET /images/hm_bg.jpg HTTP/1.0', 200, 24736); """ | ||
| sql """ INSERT INTO ${testTable} VALUES (1, '40.135.0.0', NULL, 200, 24736); """ | ||
| sql 'sync' | ||
|
|
||
| qt_sql """ select count() from ${testTable} where request IS NULL; """ | ||
| qt_sql """ select count() from ${testTable} where request IS NOT NULL; """ | ||
| } finally { | ||
| GetDebugPoint().disableDebugPointForAllBEs("column_writer.init") | ||
| } | ||
| } finally { | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'add_values' can be made static [readability-convert-member-functions-to-static]
Additional context
be/src/util/debug_points.h:39: expanded from macro 'DBUG_EXECUTE_IF'
code; \ ^