[#10957] fix(catalog-postgresql): Map serial types to integer types in PostgreSqlTypeConverter#10970
Open
sachinnn99 wants to merge 1 commit into
Open
Conversation
…ypes in PostgreSqlTypeConverter PostgreSQL serial/smallserial/bigserial types were falling through to ExternalType, causing Trino queries to fail with "Unsupported gravitino datatype: external(serial)".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Add type mappings for PostgreSQL's
serial,smallserial, andbigserialtype aliases (and their shorthand formsserial2,serial4,serial8) inPostgreSqlTypeConverter.toGravitino().Why are the changes needed?
When the JDBC driver reports
serial/smallserial/bigserialas the TYPE_NAME, the converter falls through toExternalType.of("serial"). The Trino connector has no mapping forEXTERNALtypes, causing queries to fail with:These types are aliases for
int2/int4/int8with an auto-increment sequence, so they should map toShortType/IntegerType/LongTyperespectively.Fixes #10957
Does this PR introduce any user-facing change?
No API changes. PostgreSQL tables with serial columns can now be queried through Trino without errors.
How was this patch tested?
Added unit test assertions for all 6 serial type variants in
TestPostgreSqlTypeConverter.testToGravitinoType().