[FLINK-39789] AvroSchemaConverter updates for local-timestamp-* and timestamp-nanos logical types#28274
Open
Shekharrajak wants to merge 4 commits into
Open
Conversation
Collaborator
…for local-timestamp
be77e45 to
dc5e6de
Compare
Contributor
Author
|
@flinkbot run azure |
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.
Fix FLINK-39789.
What is the purpose of the change
AvroSchemaConverter.convertToDataType(String)andconvertToTypeInfo(String)— the only public Avro→Flink type-mapping entry points — silently dropped the logical type forlocal-timestamp-millisandlocal-timestamp-microsand returnedBIGINT/Long, producing a FlinkRowTypethat is incompatible withTimestampDataat runtime.The internal two-arg overloads contained branches for
local-timestamp-*, but only on thelegacyTimestampMapping=falsearm. The single-arg public APIs hard-codelegacyTimestampMapping=true, so those branches were unreachable from any public API.Brief change log
Verifying this change
AvroSchemaConverter.convertToDataType(Schema, boolean)— hoistlocalTimestampMillis/localTimestampMicroschecks above thelegacyMappingswitch so they are honoured in both modes.AvroSchemaConverter.convertToTypeInfo(Schema, boolean)— identical hoist, mapping toTypes.LOCAL_DATE_TIME.AvroSchemaConverterLocalTimestampBehaviorTest— 13 tests covering the single-arg public API, the two-arg overloads in both modes, theconvertToTypeInfomirror, the JIRA's exact runtimeClassCastExceptionreproducer, and a round-trip sanity check.AvroSchemaConverterTest.validateLegacyTimestampsSchema(...)helpers — they previously hard-codedTypes.LONG/BIGINTforlocal_timestamp_*(asserting the bug); now assert the spec-correctTypes.LOCAL_DATE_TIME/TIMESTAMP(p).Does this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no)noDocumentation
Was generative AI tooling used to co-author this PR?