-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
🐛 Source Postgres: allow handling of java sql date #9554
🐛 Source Postgres: allow handling of java sql date #9554
Conversation
thanks @shrodingers! I requested to the team review the contribution during this week. |
@@ -42,7 +43,10 @@ public static String convertDate(final Object input) { | |||
} else if (input instanceof Number) { | |||
return DataTypeUtils.toISO8601String( | |||
new Timestamp(((Number) input).longValue()).toLocalDateTime()); | |||
} else if (input instanceof String) { | |||
} else if (input instanceof Date) { | |||
return DataTypeUtils.toISO8601String(input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input
has Object
type and can't be put as input parameter for the DataTypeUtils.toISO8601String
without cast.
@@ -42,7 +43,10 @@ public static String convertDate(final Object input) { | |||
} else if (input instanceof Number) { | |||
return DataTypeUtils.toISO8601String( | |||
new Timestamp(((Number) input).longValue()).toLocalDateTime()); | |||
} else if (input instanceof String) { | |||
} else if (input instanceof Date) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please specify the case which you are trying to fix with steps to reproduce.
I've tested your change using CDC MySql Source and there is no any issues with Date
type.
More over the class java.sql.Date
is not used there.
All columns with Date
type processed inside the Debezium as class java.time.LocalDate
. Example from data type test:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna update the PR description, im using CDC for PostgreSql for this case (thought it was the same case for all dbs thus my initial description).
I had lots of warning while syncing columns with postgres's type Date looking like :
Uncovered date class type java.sql.Date. Use default converter.
Which led me to this part of the code (only happened on the initial migration though, not while consuming the slots).
I had a minimal setup to reproduce this :
- A postgres table with a date column
- replication and CDC enabled
- connection that syncs the table in
incremental
mode
I log the class name inside the convertDate
function, and without this update i have the following log :
Maybe it is a postgres only issue, or that i didn't understand how everything works around Debezium, but this is the reason i tried to submit this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @shrodingers ,
You PR looks good for me, but there are few small things left to do.
- As this change will effect only Postgres processing and I will only incr. that version, please rename the PR from
Debeezium based sources
toSource Postgres
. - The formatting check is a part of our build. It means that all changes should be in line with it. So, in order not to brake the master build, please make you changes in line with the changes in my technical PR [#9554 PR] Postgres/Mssql Source: Increase version #9753. (Note that sequence of imports also counts)
All tests are fine, so after that we can merge your PR and I will bump the version.
…ngers/debeeziumDate
Hi @DoNotPanicUA, thanks for your patience in this review !
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* #9554 PR * format * incr version for Postgres * Update docs/integrations/sources/postgres.md Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com> * test upd * test upd * incr ver for mssql as effected source Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
Hi @shrodingers, |
What
Had an issue on a Postgres CDC source, where I have some Postgres date columns, and on the initial load, date object types were
Java.sql.Date
, which weren't handled properly. This caused a warning to be prompted for every row, and the date format conversion to fall on the default string converter.How
Added a handler for
Java.sql.Date
type that can be returned by Debeezium, instead of a repetitive warning causing unreadable logs.Allow for a specific handler and not the default one.
🚨 User Impact 🚨
Should be none, since it just adds a handler instead of the default one for debeezium based sources
Community member or Airbyter
README.md
bootstrap.md
. See description and examplesdocs/SUMMARY.md
docs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changes