Skip to content

[FLINK-35726][table] Honor @DataTypeHint on POJO fields in type conve…#28288

Open
Au-Miner wants to merge 1 commit into
apache:masterfrom
Au-Miner:FLINK-35726
Open

[FLINK-35726][table] Honor @DataTypeHint on POJO fields in type conve…#28288
Au-Miner wants to merge 1 commit into
apache:masterfrom
Au-Miner:FLINK-35726

Conversation

@Au-Miner
Copy link
Copy Markdown
Contributor

@Au-Miner Au-Miner commented Jun 1, 2026

What is the purpose of the change

Fix a regression where @DataTypeHint placed on a POJO field is silently ignored when a TypeInformation is converted to a DataType (e.g., via tableEnv.toDataStream(table, MyPojo.class).map(...) followed by fromDataStream), causing fields like Map<String, byte[]> annotated MAP<STRING, BYTES> to fall back to RAW.

Brief change log

  • Add DataTypeExtractor#extractFromField(DataTypeFactory, Field) that resolves a field's DataType from its reflective @DataTypeHint, falling back to default extraction when no hint is present.
  • In TypeInfoDataTypeConverter#convertToStructuredType, detect POJO fields that carry @DataTypeHint and delegate them to DataTypeExtractor#extractFromField instead of the TypeInformation-driven path; skip the subsequent primitive-bridging pass for those fields since the extractor already finalizes them.

Verifying this change

Added a PojoWithHintedMapField test POJO and a parameterized case in TypeInfoDataTypeConverterTest that asserts a HashMap<String, byte[]> field annotated @DataTypeHint("MAP<STRING, BYTES>") resolves to MAP<STRING, BYTES> bridged to HashMap instead of RAW('java.util.HashMap', ...).

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@flinkbot
Copy link
Copy Markdown
Collaborator

flinkbot commented Jun 1, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants