Skip to content

Commit

Permalink
keep origin join order if join reorder failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikyou1997 committed Jun 16, 2022
1 parent 8a5a1ea commit 28bc291
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ public void materializeRequiredSlots(Analyzer analyzer) throws AnalysisException

protected void reorderTable(Analyzer analyzer) throws AnalysisException {
List<Pair<TableRef, Long>> candidates = Lists.newArrayList();

List<TableRef> originOrderBackUp = Lists.newArrayList(fromClause.getTableRefs());
// New pair of table ref and row count
for (TableRef tblRef : fromClause) {
if (tblRef.getJoinOp() != JoinOperator.INNER_JOIN || tblRef.hasJoinHints()) {
Expand Down Expand Up @@ -773,8 +773,8 @@ protected void reorderTable(Analyzer analyzer) throws AnalysisException {

// can not get AST only with equal join, MayBe cross join can help
fromClause.clear();
for (Pair<TableRef, Long> candidate : candidates) {
fromClause.add(candidate.first);
for (TableRef tableRef : originOrderBackUp) {
fromClause.add(tableRef);
}
}

Expand Down

0 comments on commit 28bc291

Please sign in to comment.