[python] Reject duplicate columns and unknown or duplicate keys in create_table and alter_table #11028
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 182 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.312
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #11028"
general
weight: 0.35
LuciferYang
Purpose
close #11027
create_tableaccepted a partition or primary key that is not a column, and the persisted table could then no longer be loaded. It also accepted duplicate column names and duplicate keys.SchemaManager.create_tablenow checks, as Java'sSchemadoes when it is built, that column names are unique and that partition and primary keys do not repeat and are columns. The messages use Java's wording.FileSystemCatalogandJdbcCatalogcreate tables through it, so nothing is written for a rejected schema. Existing tables are not checked when they are loaded.alter_tableruns the same checks on the schema it builds, as Java does on every alter. Renaming a primary key twice in one alter (idtomiddle, thenmiddletonew_id) leftprimaryKeys = [middle]in the new schema, and the table could no longer be loaded; that alter is now rejected before the schema is written. On an existing table that already has duplicate columns or keys, an alter that leaves the duplicates in place is rejected.Tests
TestColumnAndKeyValidationinschema_manager_test.py, failing on master: