Skip to content

Commit

Permalink
[nereids] fix join fd computing bug (apache#28849)
Browse files Browse the repository at this point in the history
  • Loading branch information
xzj7019 authored Dec 23, 2023
1 parent 37777dc commit 13a3550
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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");
}
}

0 comments on commit 13a3550

Please sign in to comment.