Au-Miner opened a new pull request, #28288:
URL: https://github.com/apache/flink/pull/28288
## 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]