From b7ad8dba89efbd674c2fa20659dfab0e1723c2aa Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 27 Jun 2025 00:22:29 -0700 Subject: [PATCH] fix(dremio): apply same fix as for drill to solve alias ambiguity (#33939) --- superset/db_engine_specs/dremio.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/superset/db_engine_specs/dremio.py b/superset/db_engine_specs/dremio.py index 1f4338830bb..39fe48be635 100644 --- a/superset/db_engine_specs/dremio.py +++ b/superset/db_engine_specs/dremio.py @@ -25,6 +25,7 @@ from sqlalchemy import types from superset.constants import TimeGrain from superset.db_engine_specs.base import BaseEngineSpec +from superset.utils.hashing import md5_sha_from_str if TYPE_CHECKING: from superset.models.core import Database @@ -93,3 +94,14 @@ class DremioEngineSpec(BaseEngineSpec): dttm_formatted = dttm.isoformat(sep=" ", timespec="milliseconds") return f"""TO_TIMESTAMP('{dttm_formatted}', 'YYYY-MM-DD HH24:MI:SS.FFF')""" return None + + @staticmethod + def _mutate_label(label: str) -> str: + """ + Suffix with the first six characters from the md5 of the label to avoid + collisions with original column names + + :param label: Expected expression label + :return: Conditionally mutated label + """ + return f"{label}_{md5_sha_from_str(label)[:6]}"