Skip to content

Commit

Permalink
[nereids] pull up join from union all rule
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongjian.xzj authored and zhongjian.xzj committed Dec 20, 2023
1 parent 39817c6 commit 93fb58a
Showing 1 changed file with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,23 +344,33 @@ private boolean checkJoinConditionOnPk(LogicalJoin joinRoot, LogicalCatalogRelat
}

private Set<String> getPkInfoFromConstraint(LogicalCatalogRelation table) {
for (Map.Entry<String, Constraint> constraintMap : table.getTable().getConstraintsMap().entrySet()) {
Constraint constraint = constraintMap.getValue();
if (constraint instanceof PrimaryKeyConstraint) {
return ((PrimaryKeyConstraint) constraint).getPrimaryKeyNames();
table.getTable().readLock();
try {
for (Map.Entry<String, Constraint> constraintMap : table.getTable().getConstraintsMap().entrySet()) {
Constraint constraint = constraintMap.getValue();
if (constraint instanceof PrimaryKeyConstraint) {
return ((PrimaryKeyConstraint) constraint).getPrimaryKeyNames();
}
}
return null;
} finally {
table.getTable().readUnlock();
}
return null;
}

private Set<String> getUkInfoFromConstraint(LogicalCatalogRelation table) {
for (Map.Entry<String, Constraint> constraintMap : table.getTable().getConstraintsMap().entrySet()) {
Constraint constraint = constraintMap.getValue();
if (constraint instanceof UniqueConstraint) {
return ((UniqueConstraint) constraint).getUniqueColumnNames();
table.getTable().readLock();
try {
for (Map.Entry<String, Constraint> constraintMap : table.getTable().getConstraintsMap().entrySet()) {
Constraint constraint = constraintMap.getValue();
if (constraint instanceof UniqueConstraint) {
return ((UniqueConstraint) constraint).getUniqueColumnNames();
}
}
return null;
} finally {
table.getTable().readUnlock();
}
return null;
}

private boolean checkJoinRoot(LogicalJoin joinRoot) {
Expand Down

0 comments on commit 93fb58a

Please sign in to comment.