Skip to content

fix(db_engine_specs): map var_string to STRING for MySQL/StarRocks#41868

Open
rusackas wants to merge 1 commit into
masterfrom
fix/issue-30282-var-string-type-mapping
Open

fix(db_engine_specs): map var_string to STRING for MySQL/StarRocks#41868
rusackas wants to merge 1 commit into
masterfrom
fix/issue-30282-var-string-type-mapping

Conversation

@rusackas

@rusackas rusackas commented Jul 7, 2026

Copy link
Copy Markdown
Member

SUMMARY

MySQL and StarRocks return var_string as the native type for varchar-backed columns (e.g. StarRocks VARCHAR). Neither engine spec's column_type_mappings matched var_string (the existing ^varchar pattern doesn't match var_string), so such columns fell through unmatched and were not classified as GenericDataType.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_string regex mapping resolving to GenericDataType.STRING in both mysql.py and starrocks.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

  • Automated: 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 assert var_string resolves to GenericDataType.STRING.
  • Manual: On a MySQL/StarRocks dataset with a varchar-backed column, create a bar chart using that column as the categorical (x) axis and a numeric measure. The "Force categorical" / y-axis sort control should now be visible without casting the column.

ADDITIONAL INFORMATION

  • Has associated issue: Fixes The Force Categorical Control is wrongly hidden in bar chart. #30282
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

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>
@bito-code-review

bito-code-review Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #0a05dd

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: f342aeb..f342aeb
    • superset/db_engine_specs/mysql.py
    • superset/db_engine_specs/starrocks.py
    • tests/unit_tests/db_engine_specs/test_mysql.py
    • tests/unit_tests/db_engine_specs/test_starrocks.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.70%. Comparing base (8f4c411) to head (f342aeb).
⚠️ Report is 8 commits behind head on master.

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     
Flag Coverage Δ
hive 39.15% <ø> (ø)
mysql 57.67% <ø> (ø)
postgres 57.73% <ø> (-0.01%) ⬇️
presto 40.67% <ø> (ø)
python 59.13% <ø> (-0.01%) ⬇️
sqlite 57.32% <ø> (ø)
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Force Categorical Control is wrongly hidden in bar chart.

1 participant