fix(db_engine_specs): map var_string to STRING for MySQL/StarRocks#41868
fix(db_engine_specs): map var_string to STRING for MySQL/StarRocks#41868rusackas wants to merge 1 commit into
Conversation
The MySQL and StarRocks column type mappings did not recognize the `var_string` native type (returned for varchar-backed columns), so these columns fell through unmatched and were not classified as GenericDataType.STRING. As a result, controls that gate on column type (e.g. the "Force categorical" / y-axis sort control) were incorrectly hidden for such columns. Add a `^var_string` regex mapping resolving to GenericDataType.STRING in both engine specs, matching the workaround confirmed by the issue reporter, plus regression cases in the parameterized column-spec tests. Fixes #30282 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Code Review Agent Run #0a05ddActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41868 +/- ##
==========================================
- Coverage 64.70% 64.70% -0.01%
==========================================
Files 2701 2701
Lines 149867 149867
Branches 34508 34508
==========================================
- Hits 96972 96965 -7
- Misses 51120 51124 +4
- Partials 1775 1778 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SUMMARY
MySQL and StarRocks return
var_stringas the native type for varchar-backed columns (e.g. StarRocksVARCHAR). Neither engine spec'scolumn_type_mappingsmatchedvar_string(the existing^varcharpattern doesn't matchvar_string), so such columns fell through unmatched and were not classified asGenericDataType.STRING.Because several Explore controls gate on column type, this caused the "Force categorical" / y-axis sort control to be incorrectly hidden for these columns — the user had to cast the axis to a numeric type just to make the control appear, which doesn't make sense for a categorical axis.
This adds a
^var_stringregex mapping resolving toGenericDataType.STRINGin bothmysql.pyandstarrocks.py(StarRocks defines its own full override tuple). This matches the workaround confirmed by the issue reporter in the thread.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend type-classification change.
TESTING INSTRUCTIONS
pytest tests/unit_tests/db_engine_specs/test_mysql.py::test_get_column_spec tests/unit_tests/db_engine_specs/test_starrocks.py::test_get_column_spec— new parameterized cases assertvar_stringresolves toGenericDataType.STRING.ADDITIONAL INFORMATION