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

Spark 3.5: Add tests for WHEN NOT MATCHED BY SOURCE clauses #8592

Merged

Conversation

aokolnychyi
Copy link
Contributor

This PR adds tests for WHEN NOT MATCHED BY SOURCE clauses, supported in Spark 3.5.

This resolves #8276. There are more tests in Spark itself, it is just a sanity check mostly.

@github-actions github-actions bot added the spark label Sep 19, 2023
assertEquals(
"Should have expected rows",
ImmutableList.of(
row(1, "emp-id-1"), // updated (matched)
Copy link
Member

Choose a reason for hiding this comment

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

Currently this is a little confusing because the results are not in the same order as the clauses above

Clause 1
Clause 4
Clause 3

Could we add in some blanks and make it look more like

Clause 1 result row,
// Clause 2 row deleted
Clause 3 result row,
Clause 4 result row,
// Clause 5 row deleted

Minor nit here and would require rewriting this a little, it would just make the test a bit easier to read

+ "{ \"id\": 3, \"dep\": \"emp-id-3\" }\n"
+ "{ \"id\": 4, \"dep\": \"emp-id-4\" }");

createOrReplaceView("source", Collections.singletonList(1), Encoders.INT());
Copy link
Member

Choose a reason for hiding this comment

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

It is not super clear here that this makes a table with an ID column with a single element, there are also different methods used for providing lists below.

Nit: I think we could be consistent with just always using ImmutableList.of(...)

Copy link
Member

@RussellSpitzer RussellSpitzer left a comment

Choose a reason for hiding this comment

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

Looks good to me, just have some test style nits which you are free to ignore

@aokolnychyi aokolnychyi merged commit e88d0f4 into apache:master Sep 19, 2023
37 checks passed
@aokolnychyi
Copy link
Contributor Author

Thanks, @RussellSpitzer @rdblue @Fokko!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support WHEN NOT MATCHED BY SOURCE in MERGE
4 participants