-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Handling of column types for Presto, Trino, et al. #28653
fix: Handling of column types for Presto, Trino, et al. #28653
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #28653 +/- ##
===========================================
+ Coverage 60.48% 83.50% +23.01%
===========================================
Files 1931 522 -1409
Lines 76236 37497 -38739
Branches 8568 0 -8568
===========================================
- Hits 46114 31313 -14801
+ Misses 28017 6184 -21833
+ Partials 2105 0 -2105
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
assert result is not None | ||
actual = result.compile( | ||
dialect=PrestoDialect(), compile_kwargs={"literal_binds": True} | ||
assert ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same logic as before just condensed.
@gooroodev review |
1. Summary of ChangesThe pull request addresses the handling of column types for Presto and Trino engines in the Superset project. The key changes include:
2. Issues, Bugs, or TyposIssue 1:
Issue 2:
3. General Review of Code Quality and Style
Additional Suggestions
Overall, the pull request is well-implemented and addresses the problem effectively. The suggested improvements are minor and aim to further enhance the code quality. Yours, Gooroo.dev. To receive reviews automatically, install Github App |
6a35459
to
f4ec019
Compare
(cherry picked from commit 4ff1740)
SUMMARY
This is a rehash of @brouberol's #26782 which was later reverted in #28613 as it was problematic with Trino, given both the
PrestoEngineSpec
andTrinoEngineSpec
derive from thePrestoBaseEngineSpec
.The TL;DR is typically most SQLAlchemy dialects (including Trino) use native SQLAlchemy types for encoding column types, whereas PyHive is unconventional and uses
str
. I asked a similar question years ago and you can see here how these types are materialized.I hypothesize that part of the confusion when @brouberol's was authoring their PR was that the
ResultSetColumnType
TypedDict
was incorrect, alluding to the fact that thetype
field wasOptional[str]
as opposed toOptional[Union[str, TypeEngine, type[TypeEngine]]
. This PR simply ensures that in thePrestoBaseEngineSpec
class—which handles Hive, Presto, and Trino—that we only try to coercestr
types to a SQLAlchemy type (if available).BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Added unit tests.
ADDITIONAL INFORMATION