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

postgres-source: handle 24:00:00 value for time column #17782

Merged
merged 11 commits into from
Oct 11, 2022

Conversation

subodh1810
Copy link
Contributor

@subodh1810 subodh1810 requested a review from edgao October 10, 2022 12:59
@subodh1810 subodh1810 requested a review from a team as a code owner October 10, 2022 12:59
@subodh1810 subodh1810 self-assigned this Oct 10, 2022
@github-actions github-actions bot added the area/connectors Connector related issues label Oct 10, 2022
@subodh1810 subodh1810 temporarily deployed to more-secrets October 10, 2022 13:01 Inactive
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;
Copy link
Contributor

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

Suggested change
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)

Suggested change
final long updatedValue = 0 > value ? Math.abs(value) : 86399999999999L;
final long updatedValue = Math.min(Math.abs(value), TimeUnit.DAYS.toNanos(1) - 1);

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

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 10, 2022

/test connector=connectors/source-mysql

🕑 connectors/source-mysql https://github.com/airbytehq/airbyte/actions/runs/3220863395
✅ connectors/source-mysql https://github.com/airbytehq/airbyte/actions/runs/3220863395
No Python unittests run

Build Passed

Test summary info:

All Passed

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 10, 2022

/test connector=connectors/source-postgres

🕑 connectors/source-postgres https://github.com/airbytehq/airbyte/actions/runs/3220864224
❌ connectors/source-postgres https://github.com/airbytehq/airbyte/actions/runs/3220864224
🐛 https://gradle.com/s/6bd7c22asn2p6

Build Failed

Test summary info:

Could not find result summary

@subodh1810 subodh1810 temporarily deployed to more-secrets October 10, 2022 16:24 Inactive
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);
Copy link
Contributor

@rodireich rodireich Oct 10, 2022

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",
Copy link
Contributor Author

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

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 10, 2022

/test connector=connectors/source-postgres

🕑 connectors/source-postgres https://github.com/airbytehq/airbyte/actions/runs/3221415092
✅ connectors/source-postgres https://github.com/airbytehq/airbyte/actions/runs/3221415092
No Python unittests run

Build Passed

Test summary info:

All Passed

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 10, 2022

/test connector=connectors/source-mysql

🕑 connectors/source-mysql https://github.com/airbytehq/airbyte/actions/runs/3221415646
✅ connectors/source-mysql https://github.com/airbytehq/airbyte/actions/runs/3221415646
No Python unittests run

Build Passed

Test summary info:

All Passed

@subodh1810 subodh1810 temporarily deployed to more-secrets October 10, 2022 18:06 Inactive
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,
Copy link
Contributor

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?

@akashkulk
Copy link
Contributor

Could you add some brief context to the PR description?

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Oct 10, 2022
@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 10, 2022

/publish connector=connectors/source-postgres

🕑 Publishing the following connectors:
connectors/source-postgres
https://github.com/airbytehq/airbyte/actions/runs/3222241467


Connector Did it publish? Were definitions generated?
connectors/source-postgres

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@subodh1810 subodh1810 temporarily deployed to more-secrets October 10, 2022 20:44 Inactive
@github-actions
Copy link
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • source-postgres-strict-encrypt
  • source-alloydb
  • source-alloydb-strict-encrypt

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 11, 2022

/publish connector=connectors/source-postgres

🕑 Publishing the following connectors:
connectors/source-postgres
https://github.com/airbytehq/airbyte/actions/runs/3226515657


Connector Did it publish? Were definitions generated?
connectors/source-postgres

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 11, 2022

/publish connector=connectors/source-postgres-strict-encrypt

🕑 Publishing the following connectors:
connectors/source-postgres-strict-encrypt
https://github.com/airbytehq/airbyte/actions/runs/3226516290


Connector Did it publish? Were definitions generated?
connectors/source-postgres-strict-encrypt

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@subodh1810 subodh1810 temporarily deployed to more-secrets October 11, 2022 11:41 Inactive
@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 11, 2022

/publish connector=connectors/source-postgres

🕑 Publishing the following connectors:
connectors/source-postgres
https://github.com/airbytehq/airbyte/actions/runs/3229710852


Connector Did it publish? Were definitions generated?
connectors/source-postgres

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 11, 2022

/publish connector=connectors/source-postgres-strict-encrypt

🕑 Publishing the following connectors:
connectors/source-postgres-strict-encrypt
https://github.com/airbytehq/airbyte/actions/runs/3229711576


Connector Did it publish? Were definitions generated?
connectors/source-postgres-strict-encrypt

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@github-actions
Copy link
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • source-alloydb
  • source-postgres-strict-encrypt
  • source-alloydb-strict-encrypt

@subodh1810 subodh1810 temporarily deployed to more-secrets October 11, 2022 19:37 Inactive
@github-actions
Copy link
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • source-alloydb
  • source-postgres-strict-encrypt
  • source-alloydb-strict-encrypt

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 11, 2022

/publish connector=connectors/source-alloydb

🕑 Publishing the following connectors:
connectors/source-alloydb
https://github.com/airbytehq/airbyte/actions/runs/3229749736


Connector Did it publish? Were definitions generated?
connectors/source-alloydb

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@subodh1810
Copy link
Contributor Author

subodh1810 commented Oct 11, 2022

/publish connector=connectors/source-alloydb-strict-encrypt

🕑 Publishing the following connectors:
connectors/source-alloydb-strict-encrypt
https://github.com/airbytehq/airbyte/actions/runs/3229751328


Connector Did it publish? Were definitions generated?
connectors/source-alloydb-strict-encrypt

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@subodh1810 subodh1810 temporarily deployed to more-secrets October 11, 2022 19:43 Inactive
@github-actions
Copy link
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • source-alloydb
  • source-alloydb-strict-encrypt
  • source-postgres-strict-encrypt

@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets October 11, 2022 20:44 Inactive
@subodh1810 subodh1810 merged commit 4652173 into master Oct 11, 2022
@subodh1810 subodh1810 deleted the handle-24-hour-time-postgres branch October 11, 2022 22:03
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants