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

🐛 📝 don't missparse +/-infinity in postgres-source #31856

Merged
merged 3 commits into from
Nov 9, 2023

Conversation

stephane-airbyte
Copy link
Contributor

@stephane-airbyte stephane-airbyte commented Oct 25, 2023

fixes #19952

Postgres has the ability to store +infinity and -infinity in its date, timestamp and timestamp with timezone datatypes. Unfortunately, we don't handle them, and PG-JDBC does some unnatural stuff to still return a java.sql.* java type: It returns a special value of a Timestamp/Date/OffsetDateTime, which is not their max value either. Debezium will do the same thing.

So in this change, I look for those special values and return +infinity and -infinity instead of a non-sensical date.

There's some changes to the CDK because the postgres debezum converter is in there.

I added some tests to the AbstractPostgresSourceDatatypeTest, but I'm not 100% clear what the destination's behavior will be WRT the new values

@vercel
Copy link

vercel bot commented Oct 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Nov 9, 2023 6:22pm

@CLAassistant
Copy link

CLAassistant commented Oct 25, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Contributor

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! 🎉

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

@stephane-airbyte stephane-airbyte force-pushed the stephane-19952-postgres-infinity branch from e650134 to b7737ab Compare October 31, 2023 23:43
@octavia-squidington-iii octavia-squidington-iii added the CDK Connector Development Kit label Oct 31, 2023
@@ -634,23 +635,6 @@ protected void addTimeWithTimeZoneTest() {
}
}

protected void addTimestampWithInfinityValuesTest() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the test because 1) it was doing the wrong thing and 2) we added a lot more tests in the original test block

@@ -196,25 +196,6 @@ protected void addTimeWithTimeZoneTest() {
}
}

@Override
protected void addTimestampWithInfinityValuesTest() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed this because 1) it's testing the wrong thing and 2) we have a lot more infinity tests in the abstract class above

@stephane-airbyte stephane-airbyte force-pushed the stephane-19952-postgres-infinity branch 2 times, most recently from 1e2de43 to 95d3cb7 Compare November 6, 2023 20:57
@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Nov 7, 2023
@stephane-airbyte stephane-airbyte force-pushed the stephane-19952-postgres-infinity branch from 553e00d to 4733fac Compare November 7, 2023 21:34
"enum": ["+infinity", "-infinity"]
}
],
"description": "An RFC 3339\u00a75.6 full-time, extended with +/-infinity"
},
"TimeWithoutTimezone": {
"type": "string",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops

@@ -9,7 +9,7 @@ plugins {
airbyteJavaConnector {
cdkVersionRequired = '0.4.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.

push new CDK

Copy link
Contributor

github-actions bot commented Nov 7, 2023

Coverage report for source-postgres

File Coverage [35.11%]
PostgresSourceOperations.java 35.11%
Total Project Coverage 71.75% 🍏

@stephane-airbyte stephane-airbyte marked this pull request as ready for review November 8, 2023 21:02
@stephane-airbyte stephane-airbyte requested a review from a team as a code owner November 8, 2023 21:02
@stephane-airbyte stephane-airbyte changed the title don't missparse +/-infinity in postgres-source 🐛 📝 don't missparse +/-infinity in postgres-source Nov 8, 2023
features = ['db-sources']
useLocalCdk = false
useLocalCdk = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to unset this before merging.

@stephane-airbyte
Copy link
Contributor Author

stephane-airbyte commented Nov 8, 2023

/publish-java-cdk

🕑 https://github.com/airbytehq/airbyte/actions/runs/6804841041
❌ Publish Java CDK version=0.4.7version=0.4.6 failed!

@stephane-airbyte
Copy link
Contributor Author

stephane-airbyte commented Nov 8, 2023

/publish-java-cdk

🕑 https://github.com/airbytehq/airbyte/actions/runs/6805251415
❌ Publish Java CDK version=0.4.7version=0.4.6 failed!

@stephane-airbyte stephane-airbyte force-pushed the stephane-19952-postgres-infinity branch from 0d1b3e6 to d7b8e89 Compare November 8, 2023 23:35
@stephane-airbyte
Copy link
Contributor Author

stephane-airbyte commented Nov 8, 2023

/publish-java-cdk

🕑 https://github.com/airbytehq/airbyte/actions/runs/6805316543
✅ Successfully published Java CDK version=0.4.7!

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should comment that this isn't currently used (if that hasn't already been said)

@stephane-airbyte stephane-airbyte force-pushed the stephane-19952-postgres-infinity branch from 8e61a39 to 58e6f4c Compare November 9, 2023 01:17
stephane-airbyte and others added 3 commits November 9, 2023 10:22
…postgres-source

add tests. Add support for arrays of timestamps

refactor

more fixes

Automated Commit - Formatting Changes

fix

add infinityHandling for CDC

fix infinity for CDC

Automated Commit - Formatting Changes

simplify comparisons

update CDK version

revert change

revert change

change +/-infinity to (-)Infinity

Update build.gradle

Update version.properties

revert last changes

push CDK to 0.4.7
@stephane-airbyte stephane-airbyte force-pushed the stephane-19952-postgres-infinity branch from 58e6f4c to 3460729 Compare November 9, 2023 18:22
@stephane-airbyte
Copy link
Contributor Author

stephane-airbyte commented Nov 9, 2023

/publish-java-cdk

🕑 https://github.com/airbytehq/airbyte/actions/runs/6815901227
❌ Publish Java CDK version=0.4.7 failed!

@stephane-airbyte stephane-airbyte merged commit 3f42418 into master Nov 9, 2023
@stephane-airbyte stephane-airbyte deleted the stephane-19952-postgres-infinity branch November 9, 2023 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation CDK Connector Development Kit connectors/source/postgres
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source Postgres: Don't misparse "infinity" timestamps
5 participants