Skip to content

Commit

Permalink
Avoid call trim multiple times for beforeLoop and conditionCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
c21 committed May 13, 2021
1 parent 979c759 commit 6282a09
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ case class SortMergeJoinExec(
|}
|$bufferedAfter
""".stripMargin
(before, checking)
(before, checking.trim)
} else {
(evaluateVariables(streamedVars), "")
}
Expand Down Expand Up @@ -748,10 +748,10 @@ case class SortMergeJoinExec(
eagerCleanup: String): String = {
s"""
|while ($findNextJoinRows) {
| ${beforeLoop.trim}
| $beforeLoop
| while ($matchIterator.hasNext()) {
| InternalRow $bufferedRow = (InternalRow) $matchIterator.next();
| ${conditionCheck.trim}
| $conditionCheck
| $outputRow
| }
| if (shouldStop()) return;
Expand All @@ -776,14 +776,14 @@ case class SortMergeJoinExec(
s"""
|while ($streamedInput.hasNext()) {
| $findNextJoinRows;
| ${beforeLoop.trim}
| $beforeLoop
| boolean $hasOutputRow = false;
|
| // the last iteration of this loop is to emit an empty row if there is no matched rows.
| while ($matchIterator.hasNext() || !$hasOutputRow) {
| InternalRow $bufferedRow = $matchIterator.hasNext() ?
| (InternalRow) $matchIterator.next() : null;
| ${conditionCheck.trim}
| $conditionCheck
| $hasOutputRow = true;
| $outputRow
| }
Expand All @@ -807,12 +807,12 @@ case class SortMergeJoinExec(
eagerCleanup: String): String = {
s"""
|while ($findNextJoinRows) {
| ${beforeLoop.trim}
| $beforeLoop
| boolean $hasOutputRow = false;
|
| while (!$hasOutputRow && $matchIterator.hasNext()) {
| InternalRow $bufferedRow = (InternalRow) $matchIterator.next();
| ${conditionCheck.trim}
| $conditionCheck
| $hasOutputRow = true;
| $outputRow
| }
Expand Down

0 comments on commit 6282a09

Please sign in to comment.