From 9c580bdcedbf483ecd5e59716a41430900a347c4 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Fri, 2 Oct 2026 13:51:34 -0700 Subject: [PATCH] fix: give HiveDialect its own colspecs dict HiveDialect didn't define colspecs, so it inherited sqlalchemy.engine.default.DefaultDialect.colspecs directly -- the exact same dict object, not a copy. Every SQLAlchemy built-in dialect (postgresql, mysql, etc.) defines its own colspecs for this reason: a mutation like HiveDialect.colspecs[SomeType] = ... -- a normal way to customize type rendering per dialect -- otherwise corrupts type handling for every other dialect sharing the inherited default, for the rest of the process. This is a real downstream hit, not a hypothetical: apache/superset's Databricks engine spec patches colspecs on HiveDialect (PyHive's Databricks support subclasses it) and the shared-object aliasing broke type compilation for ~38 unrelated dialects loaded in the same process until Superset worked around it on its own side (apache/superset#44707). Verified directly: >>> HiveDialect.colspecs is DefaultDialect.colspecs True # before this fix False # after Zero behavior change otherwise -- colspecs was and remains empty for this dialect, it's just no longer the same object as the default's. Co-Authored-By: Evan Rusackas Co-Authored-By: Claude Sonnet 5 --- pyhive/sqlalchemy_hive.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pyhive/sqlalchemy_hive.py b/pyhive/sqlalchemy_hive.py index e2244525..6aa04144 100644 --- a/pyhive/sqlalchemy_hive.py +++ b/pyhive/sqlalchemy_hive.py @@ -258,6 +258,17 @@ class HiveDialect(default.DefaultDialect): supports_multivalues_insert = True type_compiler = HiveTypeCompiler supports_sane_rowcount = False + # Give this dialect its own colspecs dict rather than inheriting + # DefaultDialect's directly. Every SQLAlchemy built-in dialect + # (postgresql, mysql, etc.) defines its own colspecs for the same + # reason: without one, HiveDialect.colspecs IS + # sqlalchemy.engine.default.DefaultDialect.colspecs (same object), so + # any code that does HiveDialect.colspecs[SomeType] = ... -- a common + # pattern for customizing type rendering on a per-dialect basis -- + # silently corrupts type handling for every other dialect in the + # process that also hasn't defined its own colspecs. See + # apache/superset#44707 for a real downstream project that hit this. + colspecs = {} supports_statement_cache = False @classmethod