Skip to content

Commit 98971d8

Browse files
meegooclaude
andcommitted
[BugFix] Reject bloom_filter_columns on a column with an ngram index in the lake fast path
A column may carry at most one of {plain bloom filter, ngram bloom filter}. The regular schema-change path enforces this via IndexAnalyzer.analyseBfWithNgramBf, but the lake bloom_filter_columns fast path (tryBuildLakeAddBloomFilterJob) did not — so 'SET ("bloom_filter_columns"="c")' on a column that already has an NGRAMBF index was silently accepted instead of erroring 'should only have one bloom filter index or ngram bloom filter index'. Run the same validation before taking the fast path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: meegoo <meegoo.sr@gmail.com>
1 parent 54f6412 commit 98971d8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

fe/fe-core/src/main/java/com/starrocks/alter/SchemaChangeHandler.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,6 +2374,20 @@ public AlterJobV2 analyzeAndCreateJob(List<AlterClause> alterClauses, Database d
23742374
if (bfDelta != null) {
23752375
AlterJobV2 fastPathJob = null;
23762376
if (bfDelta.isPureAdd()) {
2377+
// A column may carry at most one of {plain bloom filter, ngram
2378+
// bloom filter}. The regular schema-change path enforces this
2379+
// via IndexAnalyzer.analyseBfWithNgramBf; the fast path must
2380+
// too, otherwise SET ("bloom_filter_columns"=...) on a column
2381+
// that already has an NGRAMBF index is silently accepted.
2382+
Set<ColumnId> addedBfColumnIds = Sets.newTreeSet(ColumnId.CASE_INSENSITIVE_ORDER);
2383+
for (String columnName : bfDelta.added) {
2384+
Column bfColumn = olapTable.getColumn(columnName);
2385+
if (bfColumn != null) {
2386+
addedBfColumnIds.add(bfColumn.getColumnId());
2387+
}
2388+
}
2389+
IndexAnalyzer.analyseBfWithNgramBf(olapTable, new HashSet<>(olapTable.getIndexes()),
2390+
addedBfColumnIds);
23772391
fastPathJob = tryBuildLakeAddBloomFilterJob(db, olapTable, bfDelta.added);
23782392
} else if (bfDelta.isPureDrop()) {
23792393
fastPathJob = tryBuildLakeDropBloomFilterJob(db, olapTable, bfDelta.dropped);

0 commit comments

Comments
 (0)