Skip to content
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

branch-3.0: [fix](build index)Fix build index empty index file on renamed column #43392

Merged
merged 1 commit into from
Nov 7, 2024
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
27 changes: 20 additions & 7 deletions be/src/olap/task/index_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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->get_inverted_index(column);
Expand Down Expand Up @@ -498,9 +504,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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} (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading