dosubot[bot] commented on issue #30282:
URL: https://github.com/apache/superset/issues/30282#issuecomment-2351083229
<!-- Answer -->
To ensure that Superset recognizes `var_string` as a string type and enables
the sort control functionality, you need to add a mapping for `var_string` in
the `starrocks.py` file. Here is the updated code snippet:
```python
class StarRocksEngineSpec(MySQLEngineSpec):
engine = "starrocks"
engine_name = "StarRocks"
default_driver = "starrocks"
sqlalchemy_uri_placeholder = (
"starrocks://user:password@host:port/catalog.db[?key=value&key=value...]"
)
column_type_mappings = ( # type: ignore
(
re.compile(r"^tinyint", re.IGNORECASE),
TINYINT(),
GenericDataType.NUMERIC,
),
(
re.compile(r"^largeint", re.IGNORECASE),
LARGEINT(),
GenericDataType.NUMERIC,
),
(
re.compile(r"^decimal.*", re.IGNORECASE),
types.DECIMAL(),
GenericDataType.NUMERIC,
),
(
re.compile(r"^double", re.IGNORECASE),
DOUBLE(),
GenericDataType.NUMERIC,
),
(
re.compile(r"^varchar(\((\d+)\))*$", re.IGNORECASE),
types.VARCHAR(),
GenericDataType.STRING,
),
(
re.compile(r"^char(\((\d+)\))*$", re.IGNORECASE),
types.CHAR(),
GenericDataType.STRING,
),
(
re.compile(r"^json", re.IGNORECASE),
types.JSON(),
GenericDataType.STRING,
),
(
re.compile(r"^binary.*", re.IGNORECASE),
types.String(),
GenericDataType.STRING,
),
(
re.compile(r"^percentile", re.IGNORECASE),
PERCENTILE(),
GenericDataType.STRING,
),
(re.compile(r"^hll", re.IGNORECASE), HLL(), GenericDataType.STRING),
(re.compile(r"^bitmap", re.IGNORECASE), BITMAP(),
GenericDataType.STRING),
(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,
),
)
```
This addition ensures that `var_string` is correctly interpreted as a string
type, enabling the sort control functionality in Superset
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/starrocks.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]