Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Summary
GROUP BY / DISTINCT on a CHAR(1) latin1 column returns the wrong representative byte through the ColumnStore Select Handler. Counts (collation-aware) are correct, the byte shown to the client is not.
Repro (standalone)
CREATE TABLE t (c1 CHAR(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci) ENGINE=ColumnStore; |
SET NAMES utf8; |
INSERT INTO t VALUES ('a'),('A'),('ä'),('Ä'),('ã'),('Ã'); |
SELECT c1, HEX(c1), COUNT(*) FROM t GROUP BY c1 ORDER BY c1; |
| handler | result |
|---|---|
| ON (default) | a C3 4, ä C4 2 ← high byte of UTF-8 source, wrong |
| OFF | a 61 4, ä E4 2 ← latin1 byte, correct |
Storage is correct (SELECT c1, HEX(c1) returns 61/41/E4/C4/E3/C3 either way). Only the GROUP BY representative emitted by the handler is wrong.
In the full CI basic suite the symptom is amplified to 4 distinct groups with garbled bytes — same root cause.
Root cause (suspected)
dbcon/mysql/ha_mcs_select_handler*.cpp GROUP BY result-row materialiser: for a fixed-width latin1 CHAR column, the representative byte is taken from the original (utf8mb3) AST literal instead of the latin1 byte from the row.
Workaround
SET SESSION columnstore_select_handler=OFF;
Trigger / status
Pre-existing bug. Was exposed in CI by columnstore commit 09783833b (2026-04-17, which set innodb_queries_use_mcs=ON globally via run_mtr.sh). That approach was reverted in MCOL-6340 / PR #3989, which scopes the variable back to the future suite via suite.opt. As a result:
- basic.ctype_cmp_char1_latin1_swedish_ci is not disabled and passes in CI under the standard suite configuration.
- The bug is still reproducible — either via the standalone repro above, or by re-enabling innodb_queries_use_mcs=ON globally and re-running the MTR test.
Affected MTR test
columnstore/basic.ctype_cmp_char1_latin1_swedish_ci (artifacts attached: ctype_artifacts.tgz).
Attachments
Issue Links
- relates to
-
MCOL-6340 Stabilize tests in columnstore's ci/cd
-
- In Progress
-