[FLINK-35726][table] Honor @DataTypeHint on POJO fields in type conve…#28288
Open
Au-Miner wants to merge 1 commit into
Open
[FLINK-35726][table] Honor @DataTypeHint on POJO fields in type conve…#28288Au-Miner wants to merge 1 commit into
Au-Miner wants to merge 1 commit into
Conversation
Collaborator
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 is the purpose of the change
Fix a regression where
@DataTypeHintplaced on a POJO field is silently ignored when aTypeInformationis converted to aDataType(e.g., viatableEnv.toDataStream(table, MyPojo.class).map(...)followed byfromDataStream), causing fields likeMap<String, byte[]>annotatedMAP<STRING, BYTES>to fall back toRAW.Brief change log
DataTypeExtractor#extractFromField(DataTypeFactory, Field)that resolves a field'sDataTypefrom its reflective@DataTypeHint, falling back to default extraction when no hint is present.TypeInfoDataTypeConverter#convertToStructuredType, detect POJO fields that carry@DataTypeHintand delegate them toDataTypeExtractor#extractFromFieldinstead of theTypeInformation-driven path; skip the subsequent primitive-bridging pass for those fields since the extractor already finalizes them.Verifying this change
Added a
PojoWithHintedMapFieldtest POJO and a parameterized case inTypeInfoDataTypeConverterTestthat asserts aHashMap<String, byte[]>field annotated@DataTypeHint("MAP<STRING, BYTES>")resolves toMAP<STRING, BYTES>bridged toHashMapinstead ofRAW('java.util.HashMap', ...).Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation