-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
postgres-source: handle 24:00:00 value for time column #17782
Conversation
return LocalTime.ofNanoOfDay(value).format(TIME_FORMATTER); | ||
} else { | ||
final long updatedValue = 0 > value ? Math.abs(value) : TimeUnit.DAYS.toNanos(1); | ||
final long updatedValue = 0 > value ? Math.abs(value) : 86399999999999L; |
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.
this would be more clear, assuming I understood correctly
final long updatedValue = 0 > value ? Math.abs(value) : 86399999999999L; | |
final long updatedValue = 0 > value ? Math.abs(value) : TimeUnit.DAYS.toNanos(1) - 1; |
or maybe just this? I.e. convert negative values to positive, and then cap all values to less than 23:59 - this is slightly different from the current behavior, where -864000...0000
would be converted to 864000...0000
rather than being reduced to 86399999999999)
final long updatedValue = 0 > value ? Math.abs(value) : 86399999999999L; | |
final long updatedValue = Math.min(Math.abs(value), TimeUnit.DAYS.toNanos(1) - 1); |
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.
done
airbyte-db/db-lib/src/main/java/io/airbyte/db/jdbc/DateTimeConverter.java
Show resolved
Hide resolved
/test connector=connectors/source-mysql
Build PassedTest summary info:
|
/test connector=connectors/source-postgres
Build FailedTest summary info:
|
final String valueAsString = time.toString(); | ||
if (valueAsString.startsWith("24")) { | ||
LOGGER.debug("Time value {} is above range, converting to 23:59:59", valueAsString); | ||
return LocalTime.parse("23:59:59.999999").format(TIME_FORMATTER); |
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.
LocalTime has .MAX
@@ -133,23 +133,23 @@ | |||
}, | |||
"client_certificate": { | |||
"type": "string", | |||
"title": "Client Certificate (Optional)", | |||
"title": "Client Certificate", |
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 changes to this file were required for PR #17544
/test connector=connectors/source-postgres
Build PassedTest summary info:
|
/test connector=connectors/source-mysql
Build PassedTest summary info:
|
return LocalTime.ofNanoOfDay(value).format(TIME_FORMATTER); | ||
} else { | ||
final long updatedValue = 0 > value ? Math.abs(value) : TimeUnit.DAYS.toNanos(1); | ||
final long updatedValue = Math.min(Math.abs(value), LocalTime.MAX.toNanoOfDay()); | ||
LOGGER.debug("Time values must use number of milliseconds greater than 0 and less than 86400000000000 but its {}, converting to {} ", value, |
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.
Should this comment say nanoseconds instead?
Could you add some brief context to the PR description? |
/publish connector=connectors/source-postgres
if you have connectors that successfully published but failed definition generation, follow step 4 here |
NOTE
|
/publish connector=connectors/source-postgres
if you have connectors that successfully published but failed definition generation, follow step 4 here |
/publish connector=connectors/source-postgres-strict-encrypt
if you have connectors that successfully published but failed definition generation, follow step 4 here |
/publish connector=connectors/source-postgres
if you have connectors that successfully published but failed definition generation, follow step 4 here |
/publish connector=connectors/source-postgres-strict-encrypt
if you have connectors that successfully published but failed definition generation, follow step 4 here |
NOTE
|
NOTE
|
/publish connector=connectors/source-alloydb
if you have connectors that successfully published but failed definition generation, follow step 4 here |
/publish connector=connectors/source-alloydb-strict-encrypt
if you have connectors that successfully published but failed definition generation, follow step 4 here |
NOTE
|
* postgres-source: handle 24:00:00 value for time column * address review comment * fix test + use LocalTime.MAX * bump version * update alloy db as well * auto-bump connector version [ci skip] * auto-bump connector version [ci skip] Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
For : https://github.com/airbytehq/oncall/issues/647#issuecomment-1271442608