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

Verify that table joins use the key in the join criterion #1718

Merged
merged 5 commits into from
Aug 10, 2018

Conversation

rodesai
Copy link
Contributor

@rodesai rodesai commented Aug 9, 2018

Description

Verify that table joins use the key in the join criterion
Fixes #1712

Testing done

Added unit tests to JoinNodeTest

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@rodesai rodesai requested a review from a team August 9, 2018 05:12
@hjafarpour
Copy link
Contributor

Should this target master or 5.0.x?

Copy link
Contributor

@hjafarpour hjafarpour left a comment

Choose a reason for hiding this comment

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

LGTM. Left couple of comments.

@@ -481,6 +483,44 @@ public void shouldNotPerformJoinIfInputPartitionsMisMatch() {
assertEquals(JoinNode.JoinType.OUTER, joinNode.getJoinType());
}

@SuppressWarnings("unchecked")
@Test
public void shouldFailJoinIfTableCriteriaColumnIsNotKey() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean join criteria column?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I mean the table's column in the join criteria.

String.format(
"Source table key column (%s) is not the column used in the join criteria (%s).",
schemaKStream.getKeyField().name(),
keyFieldName
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also include the table alias in the message. It would make it less ambiguous if we have columns with the same name in both sides of the join.

Copy link
Contributor

@apurvam apurvam left a comment

Choose a reason for hiding this comment

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

LGTM, assuming the comments are addressed.

Also, I think this should be merged to 5.0.x, it is a correctness bug with joins that should be fixed.

left,
right,
leftKeyFieldName,
"COL0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably add a comment in this test and the other that this should be COL1.

@rodesai
Copy link
Contributor Author

rodesai commented Aug 9, 2018

Currently this targets the branch for #1697, since it depends on the function added there for field name comparison. Once that PR gets merged I'll update this to target 5.0.x

@rodesai rodesai force-pushed the fix_key_selection_5.0.x branch 2 times, most recently from f5ec518 to 15ab445 Compare August 9, 2018 21:41
@rodesai rodesai changed the base branch from fix_key_selection_5.0.x to 5.0.x August 10, 2018 04:14
@rodesai rodesai merged commit 9b4c2c3 into confluentinc:5.0.x Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants