You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/07/07 23:40:22 UTC

(superset) branch fix/issue-30282-var-string-type-mapping created (now f342aebe2aa)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a change to branch fix/issue-30282-var-string-type-mapping
in repository https://gitbox.apache.org/repos/asf/superset.git


      at f342aebe2aa fix(db_engine_specs): map var_string to STRING for MySQL/StarRocks

This branch includes the following new commits:

     new f342aebe2aa fix(db_engine_specs): map var_string to STRING for MySQL/StarRocks

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: fix(db_engine_specs): map var_string to STRING for MySQL/StarRocks

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch fix/issue-30282-var-string-type-mapping
in repository https://gitbox.apache.org/repos/asf/superset.git

commit f342aebe2aa9007f5fc3a06e01c1ac23bdb66a6a
Author: Evan <ev...@preset.io>
AuthorDate: Tue Jul 7 16:39:05 2026 -0700

    fix(db_engine_specs): map var_string to STRING for MySQL/StarRocks
    
    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 <no...@anthropic.com>
---
 superset/db_engine_specs/mysql.py                  | 5 +++++
 superset/db_engine_specs/starrocks.py              | 5 +++++
 tests/unit_tests/db_engine_specs/test_mysql.py     | 1 +
 tests/unit_tests/db_engine_specs/test_starrocks.py | 1 +
 4 files changed, 12 insertions(+)

diff --git a/superset/db_engine_specs/mysql.py b/superset/db_engine_specs/mysql.py
index c46e182e075..91f13bd55b7 100644
--- a/superset/db_engine_specs/mysql.py
+++ b/superset/db_engine_specs/mysql.py
@@ -238,6 +238,11 @@ class MySQLEngineSpec(BasicParametersMixin, BaseEngineSpec):
             LONGTEXT(),
             GenericDataType.STRING,
         ),
+        (
+            re.compile(r"^var_string", re.IGNORECASE),
+            types.VARCHAR(),
+            GenericDataType.STRING,
+        ),
     )
     column_type_mutators: dict[types.TypeEngine, Callable[[Any], Any]] = {
         DECIMAL: lambda val: Decimal(val) if isinstance(val, str) else val
diff --git a/superset/db_engine_specs/starrocks.py b/superset/db_engine_specs/starrocks.py
index 35278a4688b..8a3a400d0f5 100644
--- a/superset/db_engine_specs/starrocks.py
+++ b/superset/db_engine_specs/starrocks.py
@@ -238,6 +238,11 @@ class StarRocksEngineSpec(MySQLEngineSpec):
         (re.compile(r"^array.*", re.IGNORECASE), ARRAY(), GenericDataType.STRING),
         (re.compile(r"^map.*", re.IGNORECASE), MAP(), GenericDataType.STRING),
         (re.compile(r"^struct.*", re.IGNORECASE), STRUCT(), GenericDataType.STRING),
+        (
+            re.compile(r"^var_string", re.IGNORECASE),
+            types.VARCHAR(),
+            GenericDataType.STRING,
+        ),
     )
 
     custom_errors: dict[Pattern[str], tuple[str, SupersetErrorType, dict[str, Any]]] = {
diff --git a/tests/unit_tests/db_engine_specs/test_mysql.py b/tests/unit_tests/db_engine_specs/test_mysql.py
index 8c117b1cca1..64de9d479af 100644
--- a/tests/unit_tests/db_engine_specs/test_mysql.py
+++ b/tests/unit_tests/db_engine_specs/test_mysql.py
@@ -65,6 +65,7 @@ from tests.unit_tests.fixtures.common import dttm  # noqa: F401
         ("TINYTEXT", TINYTEXT, None, GenericDataType.STRING, False),
         ("MEDIUMTEXT", MEDIUMTEXT, None, GenericDataType.STRING, False),
         ("LONGTEXT", LONGTEXT, None, GenericDataType.STRING, False),
+        ("var_string", types.VARCHAR, None, GenericDataType.STRING, False),
         # Temporal
         ("DATE", types.Date, None, GenericDataType.TEMPORAL, True),
         ("DATETIME", types.DateTime, None, GenericDataType.TEMPORAL, True),
diff --git a/tests/unit_tests/db_engine_specs/test_starrocks.py b/tests/unit_tests/db_engine_specs/test_starrocks.py
index e3ef836f36d..d949a803f37 100644
--- a/tests/unit_tests/db_engine_specs/test_starrocks.py
+++ b/tests/unit_tests/db_engine_specs/test_starrocks.py
@@ -50,6 +50,7 @@ from tests.unit_tests.db_engine_specs.utils import assert_column_spec
         ("char(10)", types.CHAR, None, GenericDataType.STRING, False),
         ("varchar(65533)", types.VARCHAR, None, GenericDataType.STRING, False),
         ("binary", types.String, None, GenericDataType.STRING, False),
+        ("var_string", types.VARCHAR, None, GenericDataType.STRING, False),
         # Complex type
         ("array<varchar(65533)>", ARRAY, None, GenericDataType.STRING, False),
         ("map<string,int>", MAP, None, GenericDataType.STRING, False),