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

[fix](stats) Fix update rows for unique table didn't get updated properly #27337

Merged
merged 1 commit into from
Nov 22, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void update(AnalysisInfo analyzedJob, TableIf tableIf) {
}
jobType = analyzedJob.jobType;
if (tableIf != null && analyzedJob.colToPartitions.keySet()
.containsAll(tableIf.getColumns().stream().map(Column::getName).collect(
.containsAll(tableIf.getBaseSchema().stream().map(Column::getName).collect(
Collectors.toSet()))) {
updatedRows.set(0);
}
Expand Down
26 changes: 26 additions & 0 deletions regression-test/suites/statistics/analyze_stats.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1249,4 +1249,30 @@ PARTITION `p599` VALUES IN (599)
assert all_finished(show_result)


// unique table update rows
sql """
CREATE TABLE unique_tbl_update_rows_test (col1 varchar(11451) not null,
col2 int not null, col3 int not null, col4 int not null)
DUPLICATE KEY(`col1`)
DISTRIBUTED BY HASH(col1)
BUCKETS 3
PROPERTIES(
"replication_num"="1"
);
"""

sql """insert into unique_tbl_update_rows_test values('21',5,1,7); """
sql """ANALYZE TABLE unique_tbl_update_rows_test WITH SYNC"""
sql """insert into unique_tbl_update_rows_test values('21',5,1,7); """
sql """ANALYZE TABLE unique_tbl_update_rows_test WITH SYNC"""
def unique_table_update_rows_result = sql """SHOW TABLE STATS unique_tbl_update_rows_test"""
def check_update_rows = { r ->
for (int i = 0; i < r.size; i++) {
if (r[i][0] == "0") {
return true
}
}
return false
}
check_update_rows(unique_table_update_rows_result)
}
Loading