-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CALCITE-6727] Column uniqueness constrain should only apply to inner… #4088
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1193,6 +1193,27 @@ private void checkColumnUniquenessForFilterWithConstantColumns(String sql) { | |
.assertThatUniqueKeysAre(bitSetOf()); | ||
} | ||
|
||
/** Test case for | ||
* <a href="https://issues.apache.org/jira/browse/CALCITE-6727">[CALCITE-6727] | ||
* Column uniqueness constrain should only apply to inner join</a>. */ | ||
@Test void testColumnUniquenessForLeftJoinOnLimit1() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is customary to add a JavaDoc comment to the test indicating the JIRA issue that is being addressed. This makes it easier for maintainers to understand the rationale for a test. You can find lots of examples in the code about how that is supposed to be structured, please follow the pattern. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the comment. Thanks for your reminder |
||
final String sql = "" | ||
+ "select A.empno as a_empno,\n" | ||
+ " A.ename as a_ename,\n" | ||
+ " B.empno as b_empno,\n" | ||
+ " B.ename as b_ename\n" | ||
+ "from emp A\n" | ||
+ "left join (\n" | ||
+ " select * from emp\n" | ||
+ " limit 1) B\n" | ||
+ "on A.empno = B.empno"; | ||
sql(sql) | ||
.assertThatAreColumnsUnique(bitSetOf(0), is(true)) | ||
.assertThatAreColumnsUnique(bitSetOf(1), is(false)) | ||
.assertThatAreColumnsUnique(bitSetOf(2), is(false)) | ||
.assertThatAreColumnsUnique(bitSetOf(3), is(false)); | ||
} | ||
|
||
@Test void testColumnUniquenessForJoinOnAggregation() { | ||
final String sql = "" | ||
+ "select *\n" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this correct even if maxRowCount is 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that the constrain still works even when the build side is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mihaibudiu Any more thoughts on this? Please take another look when you have a moment