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

[Debezium] Adding all Timestamp converters #865

Merged
merged 17 commits into from
Sep 3, 2024

Conversation

Tang8330
Copy link
Contributor

@Tang8330 Tang8330 commented Aug 30, 2024

Changes

Refactoring the following converters:

  • Timestamp
  • KafkaConnectTimestamp
  • MicroTimestamp
  • NanoTimestamp

@Tang8330 Tang8330 marked this pull request as ready for review August 30, 2024 23:11
MicroDuration SupportedDebeziumType = "io.debezium.time.MicroDuration"
DateKafkaConnect SupportedDebeziumType = "org.apache.kafka.connect.data.Date"
Timestamp SupportedDebeziumType = "io.debezium.time.Timestamp"
TimestampKafkaConnect SupportedDebeziumType = "org.apache.kafka.connect.data.Timestamp"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only change here is that I renamed this to TimestampKafkaConnect to be more correct

@Tang8330 Tang8330 requested a review from a team August 30, 2024 23:23
Timestamp SupportedDebeziumType = "io.debezium.time.Timestamp"
MicroTimestamp SupportedDebeziumType = "io.debezium.time.MicroTimestamp"
NanoTimestamp SupportedDebeziumType = "io.debezium.time.NanoTimestamp"
// Dates
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just organized this

@Tang8330 Tang8330 changed the title Adding Timestamp + KafkaConnectTimestamp converter [Debezium] Timestamp converters Sep 1, 2024
@Tang8330 Tang8330 changed the title [Debezium] Timestamp converters [Debezium] Adding Timestamp converters Sep 1, 2024
@Tang8330 Tang8330 changed the title [Debezium] Adding Timestamp converters [Debezium] Adding all Timestamp converters Sep 2, 2024
@@ -85,11 +85,6 @@ func TestField_ToKindDetails(t *testing.T) {
assert.Equal(t, typing.Integer, Field{Type: Int32}.ToKindDetails())
assert.Equal(t, typing.Integer, Field{Type: Int64}.ToKindDetails())
}
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleting this? No, must've happened from the merge. Thanks for the catch

@@ -35,3 +35,10 @@ var SupportedTimeFormatsLegacy = []string{
PostgresTimeFormatNoTZ,
AdditionalTimeFormat,
}

// RFC 339 variants
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: missing a 3 in RFC 3339

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

}

// Represents the number of milliseconds since the epoch, and does not include timezone information.
return ext.NewExtendedTime(time.UnixMilli(castedValue).In(time.UTC), ext.DateTimeKindType, ext.RFC3339Millisecond), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to call IsValid() on the return value from NewExtendedTime?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, if we are able to correctly get time.Time and parse the year to be larger than 9999, it still passes time.Format(...)

https://go.dev/play/p/tOJR2Ho6EZi

}
{
// micros is preserved despite it being all zeroes.
converted, err := MicroTimestamp{}.Convert(int64(1_712_609_795_827_123))
Copy link
Contributor

@nathan-artie nathan-artie Sep 3, 2024

Choose a reason for hiding this comment

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

Should the input for this test end in _000_000?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it should. Updating the test

@Tang8330 Tang8330 merged commit 6f8db5a into master Sep 3, 2024
3 checks passed
@Tang8330 Tang8330 deleted the implement-timestamp-converter branch September 3, 2024 23:57
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