-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[BEAM-9840] Support for Parameterized Types when converting from HCat… #11569
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
[BEAM-9840] Support for Parameterized Types when converting from HCat… #11569
Conversation
…Records to Rows in HCatalogIO
|
retest this please |
|
@akedin isn't very involved with Beam anymore. I think I can help review this instead |
TheNeuralBit
left a comment
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.
Thanks @rahul8383!
I think ideally these parameterized types should map to standard logical types. What do you think about adding some as part of this PR? If you'd rather not, we could probably merge it as-is, but file a jira to follow-up with logical type mappings.
| Schema.builder() | ||
| .addNullableField("parameterizedChar", Schema.FieldType.STRING) | ||
| .addNullableField("parameterizedVarchar", Schema.FieldType.STRING) | ||
| .addNullableField("parameterizedDecimal", Schema.FieldType.DECIMAL) |
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.
I think these should map to logical types instead of to primitives so we don't lose the information from the parameter. Unfortunately we don't (yet) have good logical types in schemas.logicaltypes to map them to, but maybe we will after your other PR, #11581 (or you could just add the relevant ones here).
char(10) looks like it could map to a FixedLengthString logical type, varchar(100) probably deserves its own type, maybe just called Varchar? and I've been meaning to add a logical type for DECIMAL parameterized by precision and scale as part of BEAM-7554 (and deprecate the primitive one).
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.
Thanks @TheNeuralBit for the review.
I am adding logical types in schemas.logicaltypes called VariableLengthBytes, FixedLengthString, VariableLengthString, LogicalDecimal as part of #11581 .
I will take up the task of mapping these to logical types once my other PR gets merged. I also hope that #11272 get merged by then, so that I can use SqlTypes.DATE logical type. Can you please create a JIRA ticket and assign it to me.
|
@TheNeuralBit if it is okay with you that I handle converting the parameterized types to necessary logical types in a separate PR, and if there are no comments, can we merge this PR? |
|
Yep! sorry about that meant to do this yesterday |
|
Filed BEAM-9909 to track the logical type change |
…Records to Rows in HCatalogIO (apache#11569)
…Records to Rows in HCatalogIO
char and varchar types in HcatRecord requires the length of the character sequence to be provided as a parameter.
serdeConstants only specifies the base name of the type. So, serdeConstants cannot be used to convert "char(10)" and "varchar(100)" to Beam Fieldtype.STRING.
This PR converts the FieldSchema to HCatFieldSchema and the Type enum defined in HCatFieldSchema is used to convert the FieldSchema to Beam Schema.
Decimal type can optionally be provided with precision and scale as parameters while defining the type. Using HCatFieldSchema will take care of converting "decimal(30,16)" type to FieldType.DECIMAL type.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.