mirror of
https://github.com/actiontech/dble.git
synced 2026-01-27 15:58:52 -06:00
@@ -665,19 +665,34 @@ public class JoinChooser {
|
||||
}
|
||||
|
||||
|
||||
private ERTable getERKey(PlanNode tn, Item c) {
|
||||
if (!(c instanceof ItemField))
|
||||
return null;
|
||||
if (tn.type() != PlanNode.PlanNodeType.TABLE && !PlanUtil.isERNode(tn)) {
|
||||
return null;
|
||||
private boolean onlyContainsOneTable(PlanNode queryNode) {
|
||||
PlanNode child = queryNode.getChildren().get(0);
|
||||
if (child.type() == PlanNode.PlanNodeType.TABLE) {
|
||||
return true;
|
||||
} else if (child.type() == PlanNode.PlanNodeType.QUERY) {
|
||||
return onlyContainsOneTable(child);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private ERTable getERKey(PlanNode tn, Item column) {
|
||||
if (!(column instanceof ItemField))
|
||||
return null;
|
||||
Pair<TableNode, ItemField> pair = null;
|
||||
if (tn.type() == PlanNode.PlanNodeType.QUERY && onlyContainsOneTable(tn)) {
|
||||
pair = PlanUtil.findColumnInTableLeaf((ItemField) column, tn);
|
||||
} else if (tn.type() != PlanNode.PlanNodeType.TABLE && !PlanUtil.isERNode(tn)) {
|
||||
return null;
|
||||
} else {
|
||||
pair = PlanUtil.findColumnInTableLeaf((ItemField) column, tn);
|
||||
}
|
||||
Pair<TableNode, ItemField> pair = PlanUtil.findColumnInTableLeaf((ItemField) c, tn);
|
||||
if (pair == null)
|
||||
return null;
|
||||
TableNode tableNode = pair.getKey();
|
||||
ItemField col = pair.getValue();
|
||||
ERTable erTable = new ERTable(tableNode.getSchema(), tableNode.getPureName(), col.getItemName());
|
||||
if (tn.type() == PlanNode.PlanNodeType.TABLE) {
|
||||
if (tn.type() == PlanNode.PlanNodeType.TABLE || tn.type() == PlanNode.PlanNodeType.QUERY) {
|
||||
return erTable;
|
||||
} else {
|
||||
List<ERTable> erList = ((JoinNode) tn).getERkeys();
|
||||
|
||||
Reference in New Issue
Block a user