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

[nereids] fix join fd computing bug #28849

Merged
merged 2 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ public FunctionalDependencies computeFuncDeps(Supplier<List<Slot>> outputSupplie
// TODO: consider Null-safe hash condition when left and rigth is not nullable
boolean isLeftUnique = left().getLogicalProperties()
.getFunctionalDependencies().isUnique(keys.first);
boolean isRightUnique = left().getLogicalProperties()
.getFunctionalDependencies().isUnique(keys.first);
boolean isRightUnique = right().getLogicalProperties()
.getFunctionalDependencies().isUnique(keys.second);
Builder fdBuilder = new Builder();
if (joinType.isInnerJoin()) {
// inner join propagate uniforms slots
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ void testNullWithPredicate() throws Exception {

@Test
void testMultiJoin() throws Exception {
addConstraint("Alter table foreign_null add constraint uk unique (id3)\n");
addConstraint("Alter table foreign_null add constraint uk_id3 unique (id3)\n");
addConstraint("Alter table foreign_not_null add constraint uk_id2 unique (id2)\n");
String sql = "select id1 from "
+ "foreign_null inner join foreign_not_null on id2 = id3\n"
+ "inner join pri on id1 = id3";
Expand All @@ -116,6 +117,7 @@ void testMultiJoin() throws Exception {
.rewrite()
.nonMatch(logicalOlapScan().when(scan -> scan.getTable().getName().equals("pri")))
.printlnTree();
dropConstraint("Alter table foreign_null drop constraint uk\n");
dropConstraint("Alter table foreign_null drop constraint uk_id3\n");
dropConstraint("Alter table foreign_not_null drop constraint uk_id2");
}
}
Loading