This is an automated email from the ASF dual-hosted git repository.
airborne pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 585759ad756 [fix](build index)Fix build index empty index file on
renamed column (#43336)
585759ad756 is described below
commit 585759ad756631165f9cb6442632cffcf2619ee8
Author: qiye <[email protected]>
AuthorDate: Thu Nov 7 11:29:34 2024 +0800
[fix](build index)Fix build index empty index file on renamed column
(#43336)
### What problem does this PR solve?
This PR is a followup repair on the basis of #42882.
Building index on renamed column will produce an empty index file, when
`column_idx` is not found.
The query is successful because match without inverted index.
Move test_match_without_index to fault_injection folder and make it
non-concurrent to avoid concurrency issues.
---
be/src/olap/task/index_builder.cpp | 27 ++++++++++++++++------
...est_match_without_index_fault_injection.groovy} | 4 ++--
.../test_index_change_on_renamed_column.groovy | 2 +-
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/be/src/olap/task/index_builder.cpp
b/be/src/olap/task/index_builder.cpp
index 4d1be1e5934..5e44f049f47 100644
--- a/be/src/olap/task/index_builder.cpp
+++ b/be/src/olap/task/index_builder.cpp
@@ -94,10 +94,16 @@ Status IndexBuilder::update_inverted_index_info() {
auto column_name = t_inverted_index.columns[0];
auto column_idx =
output_rs_tablet_schema->field_index(column_name);
if (column_idx < 0) {
- LOG(WARNING) << "referenced column was missing. "
- << "[column=" << column_name << "
referenced_column=" << column_idx
- << "]";
- continue;
+ if (!t_inverted_index.column_unique_ids.empty()) {
+ auto column_unique_id =
t_inverted_index.column_unique_ids[0];
+ column_idx =
output_rs_tablet_schema->field_index(column_unique_id);
+ }
+ if (column_idx < 0) {
+ LOG(WARNING) << "referenced column was missing. "
+ << "[column=" << column_name
+ << " referenced_column=" << column_idx <<
"]";
+ continue;
+ }
}
auto column = output_rs_tablet_schema->column(column_idx);
const auto* index_meta =
output_rs_tablet_schema->inverted_index(column);
@@ -511,9 +517,16 @@ Status
IndexBuilder::_write_inverted_index_data(TabletSchemaSPtr tablet_schema,
auto column_name = inverted_index.columns[0];
auto column_idx = tablet_schema->field_index(column_name);
if (column_idx < 0) {
- LOG(WARNING) << "referenced column was missing. "
- << "[column=" << column_name << " referenced_column="
<< column_idx << "]";
- continue;
+ if (!inverted_index.column_unique_ids.empty()) {
+ auto column_unique_id = inverted_index.column_unique_ids[0];
+ column_idx = tablet_schema->field_index(column_unique_id);
+ }
+ if (column_idx < 0) {
+ LOG(WARNING) << "referenced column was missing. "
+ << "[column=" << column_name << "
referenced_column=" << column_idx
+ << "]";
+ continue;
+ }
}
auto column = tablet_schema->column(column_idx);
auto writer_sign = std::make_pair(segment_idx, index_id);
diff --git
a/regression-test/suites/inverted_index_p0/test_match_without_index.groovy
b/regression-test/suites/fault_injection_p0/test_match_without_index_fault_injection.groovy
similarity index 96%
rename from
regression-test/suites/inverted_index_p0/test_match_without_index.groovy
rename to
regression-test/suites/fault_injection_p0/test_match_without_index_fault_injection.groovy
index a008cf703d8..db03b75bee6 100644
--- a/regression-test/suites/inverted_index_p0/test_match_without_index.groovy
+++
b/regression-test/suites/fault_injection_p0/test_match_without_index_fault_injection.groovy
@@ -16,9 +16,9 @@
// under the License.
-suite("test_match_without_index", "p0") {
+suite("test_match_without_index_fault_injection", "nonConcurrent") {
- def testTable = "test_match_without_index"
+ def testTable = "test_match_without_index_fault_injection"
sql "DROP TABLE IF EXISTS ${testTable}"
sql """
CREATE TABLE ${testTable} (
diff --git
a/regression-test/suites/inverted_index_p0/index_change/test_index_change_on_renamed_column.groovy
b/regression-test/suites/inverted_index_p0/index_change/test_index_change_on_renamed_column.groovy
index 6c8b8c4e0d8..2d92c560cf1 100644
---
a/regression-test/suites/inverted_index_p0/index_change/test_index_change_on_renamed_column.groovy
+++
b/regression-test/suites/inverted_index_p0/index_change/test_index_change_on_renamed_column.groovy
@@ -103,7 +103,7 @@ suite("test_index_change_on_renamed_column") {
assertEquals(show_result[0][2], "idx_s")
qt_select2 """ SELECT * FROM ${tableName} order by id; """
- qt_select3 """ SELECT * FROM ${tableName} where s1 match 'welcome'; """
+ qt_select3 """ SELECT /*+ SET_VAR(enable_inverted_index_query = true) */ *
FROM ${tableName} where s1 match 'welcome'; """
def tablets = sql_return_maparray """ show tablets from ${tableName}; """
String tablet_id = tablets[0].TabletId
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]