Skip to content
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

fix: enable schema inference for timestamp/time/date #7737

Merged
merged 4 commits into from Jun 30, 2021

Conversation

jzaralim
Copy link
Contributor

Description

Fixes #7730

Adds logic to the schema converter to convert date/time/timestamp to their logical types rather than just int/bigint.

Testing done

QTT and manually tested.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@jzaralim jzaralim requested a review from spena June 28, 2021 20:24
@jzaralim jzaralim requested a review from a team as a code owner June 28, 2021 20:24
@@ -104,6 +107,24 @@ private static void checkMapKeyType(final Schema.Type type) {
}
}

private static Schema convertInt64Schema(final Schema schema) {
if (schema.name() == Timestamp.LOGICAL_NAME) {
return Timestamp.builder().optional().build();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a constant defined for this. Perhaps OPTIONAL_TIMESTAMP_SCHEMA? Same question for the convertInt32Schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@spena spena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jzaralim jzaralim merged commit 35b1cad into confluentinc:master Jun 30, 2021
@jzaralim jzaralim deleted the inference branch June 30, 2021 21:05
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.

Allow timestamp type to be inferred when using schema inference
2 participants