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

Bmoric/fix diff #16513

Merged
merged 14 commits into from
Sep 13, 2022
Merged

Bmoric/fix diff #16513

merged 14 commits into from
Sep 13, 2022

Conversation

benmoriceau
Copy link
Contributor

@benmoriceau benmoriceau commented Sep 8, 2022

What

Fix the catalog diff, Address https://github.com/airbytehq/oncall/issues/463

How

CatalogHelpers.getFullyQualifiedFieldNamesWithTypes was including the oneOfField which could lead to duplicated key if the one of is contains in an array (one entry for the array, one entry for the one of).

This PR is adding a oneOf indicator as part of the key path which makes it unique. This doesn't change the behavior of the diff or gettingAllFieldName.

Edit: we now consider the field as updated if there is an issue.

@benmoriceau benmoriceau requested a review from a team as a code owner September 8, 2022 23:37
@github-actions github-actions bot added area/platform issues related to the platform area/protocol labels Sep 8, 2022
@benmoriceau benmoriceau temporarily deployed to more-secrets September 8, 2022 23:38 Inactive
@benmoriceau benmoriceau changed the base branch from malik/catalog-diff to master September 8, 2022 23:41
@benmoriceau benmoriceau temporarily deployed to more-secrets September 8, 2022 23:46 Inactive
fieldNamesThatAreOneOfs))
.map(fieldWithSchema -> {
if (withNamedOneOf && isOneOfField(fieldWithSchema.getRight())) {
final List<String> newPath = new ArrayList<>(fieldWithSchema.getLeft());
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this could be reduced to a one liner: final List<String> newPath = List.of(fieldWithSchema.getLeft(), "oneOf");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted the fix. We shouldn't allow it and have the format being enforced instead.

Copy link
Contributor

@jdpgrailsdev jdpgrailsdev left a comment

Choose a reason for hiding this comment

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

:shipit:

@benmoriceau benmoriceau temporarily deployed to more-secrets September 9, 2022 17:02 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets September 9, 2022 17:50 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets September 9, 2022 22:56 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets September 9, 2022 22:58 Inactive
@benmoriceau
Copy link
Contributor Author

Re-request review because there was several changes since the last approval.

@benmoriceau benmoriceau temporarily deployed to more-secrets September 12, 2022 16:49 Inactive
@@ -334,10 +335,15 @@ private static UpdateStreamTransform getStreamDiff(final AirbyteStream streamOld
final Set<FieldTransform> fieldTransforms = new HashSet<>();
final Map<List<String>, JsonNode> fieldNameToTypeOld = getFullyQualifiedFieldNamesWithTypes(streamOld.getJsonSchema())
.stream()
.collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
.collect(
() -> new HashMap<>(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think that you can do HashMap::new here as well.

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

@benmoriceau benmoriceau temporarily deployed to more-secrets September 12, 2022 18:32 Inactive
Copy link
Contributor

@jdpgrailsdev jdpgrailsdev left a comment

Choose a reason for hiding this comment

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

:shipit:

@benmoriceau benmoriceau temporarily deployed to more-secrets September 12, 2022 21:34 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets September 13, 2022 15:41 Inactive
@benmoriceau benmoriceau mentioned this pull request Sep 13, 2022
@benmoriceau benmoriceau merged commit a0772b5 into master Sep 13, 2022
@benmoriceau benmoriceau deleted the bmoric/fix-diff branch September 13, 2022 17:17
robbinhan pushed a commit to robbinhan/airbyte that referenced this pull request Sep 29, 2022
* Add test on the catalog diff logic

* Simplify test case

* Fix the bug

* Rm useless val

* Format

* Update test input

* revert map change

* Add test

* Fix test

* Format

* Use sugar

* Fix PMD errors

Co-authored-by: Malik Diarra <malik@airbyte.io>
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* Add test on the catalog diff logic

* Simplify test case

* Fix the bug

* Rm useless val

* Format

* Update test input

* revert map change

* Add test

* Fix test

* Format

* Use sugar

* Fix PMD errors

Co-authored-by: Malik Diarra <malik@airbyte.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform area/protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants