Skip to content

πŸ› source-postgres: fix jsonb[] handling bug - #30534

Merged
Marius Posta (postamar) merged 3 commits into
masterfrom
postamar/fix-29551
Sep 26, 2023
Merged

Marius Posta (postamar) merged 3 commits into
masterfrom
postamar/fix-29551

Conversation

@postamar

@postamar Marius Posta (postamar) commented Sep 18, 2023 •

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented Sep 18, 2023 •

Copy link
Copy Markdown
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.

@postamar Marius Posta (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 (octavia-squidington-iii) added the area/documentation Improvements or additions to documentation label Sep 18, 2023
@github-actions

github-actions Bot commented Sep 18, 2023 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

@vercel

vercel Bot commented Sep 25, 2023 •

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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

@nguyenaiden Duy Nguyen (nguyenaiden) left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Marius Posta (postamar) merged commit 8a22cf9 into master Sep 26, 2023
@postamar
Marius Posta (postamar) deleted the postamar/fix-29551 branch September 26, 2023 17:00

This branch was successfully deployed

1 active deployment
Preview β€” 851f5933 Deployed Sep 25, 2023 by vercel[bot]
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

Development

Successfully merging this pull request may close these issues.

Source postgres: Cursor-based replication reads JSONB[] columns incorrectly Postgres Source - Unable to handle jsonb[] (regression)

6 participants