Repository navigation
feat: support MySQL SET columns - #23936
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end support for the MySQL SET column type by representing SET as a uint64 bitmap plus persisted member metadata, and threading that metadata through planning/binding, DDL/DML, SHOW/INFORMATION_SCHEMA, and LOAD DATA.
Changes:
- Add
SETparsing/normalization inpkg/container/typesand expose planner/runtime cast functions for value↔bitmap conversions. - Preserve
SETmetadata across casts and planner operations (ORDER BY, DISTINCT/window ORDER BY handling, CTAS, ALTER/MODIFY, UPDATE/INSERT paths). - Extend sysviews and distributed tests/resources to validate
SETbehavior (including charset and LOAD DATA coverage).
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/distributed/resources/load_data/set_bad.csv | Adds invalid SET CSV row used for LOAD DATA error-path coverage. |
| test/distributed/resources/load_data/set.csv | Adds valid SET CSV rows for LOAD DATA coverage. |
| test/distributed/cases/zz_accesscontrol/account_restricted.result | Updates expected INFORMATION_SCHEMA.COLUMNS view definition output for enum/set-aware display. |
| test/distributed/cases/dtype/set.sql | New distributed SQL suite covering SET DDL/DML, ORDER BY/DISTINCT/GROUP BY, ALTER MODIFY, CTAS, and LOAD DATA. |
| test/distributed/cases/dtype/set.result | Expected results for the new SET distributed suite. |
| test/distributed/cases/dml/show/show.result | Updates expected INFORMATION_SCHEMA.COLUMNS view definition output for enum/set-aware display. |
| test/distributed/cases/charset_collation/charset_collation_advanced.result | Updates charset advanced expected output and adds coverage where SET with utf8mb4 is now supported. |
| pkg/util/sysview/predefined.go | Updates INFORMATION_SCHEMA.COLUMNS view SQL to show ENUM/SET types via attr_enum + mo_show_visible_bin_enum. |
| pkg/sql/plan/tools.go | Adds internal function-name constants for SET cast helpers. |
| pkg/sql/plan/query_builder.go | Extends ORDER BY “unwrap” logic to also cover SET (and avoids project-append when DISTINCT is active). |
| pkg/sql/plan/projection_binder.go | Unwraps enum/set cast_index_to_* for window ORDER BY to sort by underlying stored value. |
| pkg/sql/plan/mysql_special_types.go | New helper module to identify ENUM/SET plan types and centralize wrapping/cast function selection. |
| pkg/sql/plan/make.go | Adds SET cast support; tightens isSameColumnType to include Enumvalues for accurate type equality. |
| pkg/sql/plan/function/list_builtIn.go | Registers new builtins: cast_index_to_set_value, cast_set_value_to_index, cast_set_index_value_to_index. |
| pkg/sql/plan/function/function_id_test.go | Updates expected function-id map to include new SET cast function IDs. |
| pkg/sql/plan/function/function_id.go | Adds new function IDs and registers SET cast function names. |
| pkg/sql/plan/function/func_mo.go | Implements runtime execution logic for SET cast functions using types.ParseSet*. |
| pkg/sql/plan/function/func_builtin.go | Extends mo_show_visible_bin_enum to support SET display formatting. |
| pkg/sql/plan/build_util.go | Adds AST type resolution for MYSQL_TYPE_SET, storing member list in Type.Enumvalues on T_uint64. |
| pkg/sql/plan/build_update.go | Extends UPDATE rewrite/cast logic to include SET and refactors enum/set wrapping via shared helpers. |
| pkg/sql/plan/build_show_util.go | Formats SET column types for SHOW/DDL output using Enumvalues metadata. |
| pkg/sql/plan/build_ddl.go | Preserves SET metadata for CTAS/select-derived columns by recognizing SET cast wrapper functions. |
| pkg/sql/plan/build_constraint_util.go | Extends INSERT/value-scan casting paths to handle SET (and avoids premature numeric const handling for enum/set). |
| pkg/sql/plan/build_alter_table.go | Ensures NOT NULL default generation treats SET (stored as uint64) correctly. |
| pkg/sql/plan/build_alter_modify_column.go | Treats SET similarly to ENUM for compatibility checks during ALTER/MODIFY. |
| pkg/sql/plan/build_alter_add_column.go | Blocks SET columns from primary/unique keys (consistent with existing enum restrictions). |
| pkg/sql/plan/bind_update.go | Extends UPDATE binding logic to wrap/cast SET values and reuse shared enum/set wrapping helper. |
| pkg/sql/plan/bind_insert.go | Extends INSERT/REPLACE value casting paths to handle SET. |
| pkg/sql/plan/base_binder.go | Wraps SET column references similarly to ENUM so projection shows the MySQL-visible string form. |
| pkg/sql/colexec/external/external.go | Adds LOAD DATA validation/parsing for SET columns stored as uint64 + member metadata. |
| pkg/container/types/set_test.go | Adds unit tests for set normalization, parsing, bitmap-to-string conversion, and max member limits. |
| pkg/container/types/set.go | Implements SET normalization and parsing/formatting based on uint64 bitmaps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Merge Queue Status
This pull request spent 7 seconds in the queue, with no time running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #23912
Closes #23912
What this PR does / why we need it:
Validation: