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

🐛 source-postgres: fix jsonb[] handling bug #30534

Merged
merged 3 commits into from
Sep 26, 2023
Merged

Conversation

postamar
Copy link
Contributor

@postamar postamar commented Sep 18, 2023

This PR fixes #29172 by adding a new subcase for unmatched PostgresTypes in copyToJsonField. This new subcase distinguishes remaining array types from remaining non-array types. Added a unit test to cover.

Fixes #29551.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 18, 2023

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.

@postamar postamar changed the title source-postgres: fix jsonb[] handling bug 🐛 source-postgres: fix jsonb[] handling bug Sep 18, 2023
@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Sep 18, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 18, 2023

Coverage report for source-postgres

File Coverage [60.35%]
PostgresType.java 96.48% 🍏
InitialSyncCtidIterator.java 90.19% 🍏
PostgresSourceOperations.java 32.21%
Total Project Coverage 71.72% 🍏

@github-actions
Copy link
Contributor

source-postgres test report (commit ec6707d904) - ❌

⏲️ Total pipeline duration: 25mn26s

Step Result
Build connector tar
Build source-postgres docker image for platform linux/x86_64
Java Connector Unit Tests
Java Connector Integration Tests
Acceptance tests
Validate airbyte-integrations/connectors/source-postgres/metadata.yaml
Connector version semver check
Connector version increment check
QA checks

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-postgres test

@github-actions
Copy link
Contributor

source-postgres test report (commit 43cc9c6a8e) - ✅

⏲️ Total pipeline duration: 23mn39s

Step Result
Build connector tar
Build source-postgres docker image for platform linux/x86_64
Java Connector Unit Tests
Java Connector Integration Tests
Acceptance tests
Validate airbyte-integrations/connectors/source-postgres/metadata.yaml
Connector version semver check
Connector version increment check
QA checks

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-postgres test

@postamar postamar enabled auto-merge (squash) September 18, 2023 19:52
@vercel
Copy link

vercel bot commented Sep 25, 2023

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

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 25, 2023 8:49pm

@airbyte-oss-build-runner
Copy link
Collaborator

source-postgres test report (commit 721bc36f71) - ❌

⏲️ Total pipeline duration: 26mn57s

Step Result
Build connector tar
Build source-postgres docker image for platform linux/x86_64
Java Connector Unit Tests
Java Connector Integration Tests
Acceptance tests
Validate airbyte-integrations/connectors/source-postgres/metadata.yaml
Connector version semver check
Connector version increment check
QA checks

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-postgres test

@airbyte-oss-build-runner
Copy link
Collaborator

source-postgres test report (commit 851f593303) - ✅

⏲️ Total pipeline duration: 26mn38s

Step Result
Build connector tar
Build source-postgres docker image for platform linux/x86_64
Java Connector Unit Tests
Java Connector Integration Tests
Acceptance tests
Validate airbyte-integrations/connectors/source-postgres/metadata.yaml
Connector version semver check
Connector version increment check
QA checks

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-postgres test

Copy link
Contributor

@nguyenaiden nguyenaiden left a comment

Choose a reason for hiding this comment

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

This looks good to me! Could you make sure to bump the version in source-postgres-strict-encrypt as well?

default -> json.put(columnName, value);
default -> {
if (columnInfo.columnType.isArrayType()) {
putArray(json, columnName, resultSet, colIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

How come jsonb[] type not falling into case ARRAY ?

.withItems(JsonSchemaType.builder(JsonSchemaPrimitive.STRING).build())
.build())
.addInsertValues("ARRAY['{\"foo\":\"bar\"}'::JSONB, NULL]")
.addExpectedValues("[\"{\\\"foo\\\": \\\"bar\\\"}\",null]")
Copy link
Contributor

Choose a reason for hiding this comment

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

This still seem likes Postgres's string representation of the array. I think we want something along the lines of ["{\"foo\": \"bar\"}"]

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed offline, disregard this. It's Java's representation of the array. We've tested this version manually and it fixes the regression 👍

@postamar postamar merged commit 8a22cf9 into master Sep 26, 2023
24 of 25 checks passed
@postamar postamar deleted the postamar/fix-29551 branch September 26, 2023 17:00
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 connectors/source/postgres
Projects
None yet
6 participants