Skip to content

Commit 6282a09

Browse files
committed
Avoid call trim multiple times for beforeLoop and conditionCheck
1 parent 979c759 commit 6282a09

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ case class SortMergeJoinExec(
699699
|}
700700
|$bufferedAfter
701701
""".stripMargin
702-
(before, checking)
702+
(before, checking.trim)
703703
} else {
704704
(evaluateVariables(streamedVars), "")
705705
}
@@ -748,10 +748,10 @@ case class SortMergeJoinExec(
748748
eagerCleanup: String): String = {
749749
s"""
750750
|while ($findNextJoinRows) {
751-
| ${beforeLoop.trim}
751+
| $beforeLoop
752752
| while ($matchIterator.hasNext()) {
753753
| InternalRow $bufferedRow = (InternalRow) $matchIterator.next();
754-
| ${conditionCheck.trim}
754+
| $conditionCheck
755755
| $outputRow
756756
| }
757757
| if (shouldStop()) return;
@@ -776,14 +776,14 @@ case class SortMergeJoinExec(
776776
s"""
777777
|while ($streamedInput.hasNext()) {
778778
| $findNextJoinRows;
779-
| ${beforeLoop.trim}
779+
| $beforeLoop
780780
| boolean $hasOutputRow = false;
781781
|
782782
| // the last iteration of this loop is to emit an empty row if there is no matched rows.
783783
| while ($matchIterator.hasNext() || !$hasOutputRow) {
784784
| InternalRow $bufferedRow = $matchIterator.hasNext() ?
785785
| (InternalRow) $matchIterator.next() : null;
786-
| ${conditionCheck.trim}
786+
| $conditionCheck
787787
| $hasOutputRow = true;
788788
| $outputRow
789789
| }
@@ -807,12 +807,12 @@ case class SortMergeJoinExec(
807807
eagerCleanup: String): String = {
808808
s"""
809809
|while ($findNextJoinRows) {
810-
| ${beforeLoop.trim}
810+
| $beforeLoop
811811
| boolean $hasOutputRow = false;
812812
|
813813
| while (!$hasOutputRow && $matchIterator.hasNext()) {
814814
| InternalRow $bufferedRow = (InternalRow) $matchIterator.next();
815-
| ${conditionCheck.trim}
815+
| $conditionCheck
816816
| $hasOutputRow = true;
817817
| $outputRow
818818
| }

0 commit comments

Comments
 (0)