rusackas opened a new issue, #7786:
URL: https://github.com/apache/kyuubi/issues/7786

   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   
   ### Search before asking
   
   - [x] I have searched in the 
[issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no 
similar issues.
   
   ### Describe the bug
   
   `python/pyhive/sqlalchemy_hive.py`'s `HiveDialect` never defines its own 
`colspecs`, so it inherits `sqlalchemy.engine.default.DefaultDialect.colspecs` 
directly, the exact same dict object, not a copy:
   
   ```python
   >>> from sqlalchemy.engine.default import DefaultDialect
   >>> from pyhive.sqlalchemy_hive import HiveDialect
   >>> HiveDialect.colspecs is DefaultDialect.colspecs
   True
   ```
   
   Every SQLAlchemy built-in dialect (`postgresql`, `mysql`, etc.) defines its 
own `colspecs` dict, even when there's nothing to override yet, specifically to 
avoid this. Mutating a dialect's `colspecs` in place 
(`HiveDialect.colspecs[SomeType] = ...`) is a completely normal way to 
customize how a type renders for one dialect. Without its own dict, that 
mutation silently corrupts type handling for every other dialect in the same 
process that also hasn't defined its own `colspecs`, not just Hive.
   
   This isn't hypothetical: Apache Superset's Databricks engine spec subclasses 
`HiveDialect` for Databricks support and patches 
`HiveDialect.colspecs[types.String] = ...` to customize string-type handling. 
Because of the shared object, that one line broke type compilation for ~38 
unrelated third-party dialects loaded in the same process, until Superset 
worked around it on its own side (apache/superset#44707).
   
   Filed the same fix upstream at dropbox/PyHive#490 before noticing this 
module had already been donated here; confirmed the bug is present in this copy 
too.
   
   ### Affects Version(s)
   
   master
   
   ### Kyuubi Server Log Output
   
   _No response_
   
   ### Kyuubi Engine Log Output
   
   _No response_
   
   ### Kyuubi Server Configurations
   
   _No response_
   
   ### Kyuubi Engine Configurations
   
   _No response_
   
   ### Additional context
   
   Have a one-line fix ready (`colspecs = {}` on the class, matching every 
other SQLAlchemy dialect) and will open a PR referencing this issue.
   
   ### Are you willing to submit PR?
   
   - [x] Yes. I would be willing to submit a PR with guidance from the Kyuubi 
community to fix.
   


-- 
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]

Reply via email to