[core] Reject a conflicting global index over the same primary column - #10274
Open
LuciferYang wants to merge 1 commit into
Open
LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
The read-time scanner groups global index files by primary field and rejects conflicting column sets, but neither the Flink nor the Spark create_global_index procedure checked primary-column uniqueness: creating two indexes with the same primary column and different column sets succeeded, then every filtered query or TopN on the shared column failed deterministically while grouping the index files. Reject at creation time an existing index over the same primary field with a DIFFERENT column set, scanning all index types table-wide to match the read-time grouping; re-running the creation with the same column set remains the refresh flow and stays allowed. Assisted-by: GLM-5.3
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
Creating a global index over a primary-key column that already has a global index with a different column set was accepted at DDL and committed index files. Any later index-backed read then builds
DataEvolutionGlobalIndexScanner, whosegroupIndexFilesthrowsPrimary field %s owns multiple indexes with different columns ..., so an accepted create leaves the table in a state where its index-backed queries are broken until the extra index is dropped by hand.This rejects the conflicting create up front:
GlobalIndexBuilderUtils.checkPrimaryFieldNotIndexedis wired into the Flink and SparkCreateGlobalIndexProcedure, so the DDL boundary rejects exactly what the read path cannot tolerate. A create with the same column set is the refresh flow and stays allowed. The check scans all index types (Filter.alwaysTrue()), matching the read-side grouping byindexFieldId, so a conflicting index of a different type over the same primary column is caught as well.This closes #10273.
Tests
GlobalIndexBuilderUtilsTest#testCheckPrimaryFieldNotIndexedpins the decision: a different column set over the same primary column is rejected, while the same column set (refresh) and an unrelated column are allowed.API and Format
No.
Documentation
No.