Skip to content

Commit f27be09

Browse files
committed
Fix tests by binding attributes.
1 parent 0a79d39 commit f27be09

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/basicOperators.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,10 @@ case class UnsafeExternalSort(
270270
assert(codegenEnabled, "UnsafeExternalSort requires code generation to be enabled")
271271
def doSort(iterator: Iterator[InternalRow]): Iterator[InternalRow] = {
272272
val ordering = newOrdering(sortOrder, child.output)
273-
val prefixComparator = SortPrefixUtils.getPrefixComparator(sortOrder.head)
273+
val boundSortExpression = BindReferences.bindReference(sortOrder.head, child.output)
274+
val prefixComparator = SortPrefixUtils.getPrefixComparator(boundSortExpression)
274275
val prefixComputer = {
275-
val prefixComputer = SortPrefixUtils.getPrefixComputer(sortOrder.head)
276+
val prefixComputer = SortPrefixUtils.getPrefixComputer(boundSortExpression)
276277
new UnsafeExternalRowSorter.PrefixComputer {
277278
override def computePrefix(row: InternalRow): Long = prefixComputer(row)
278279
}

sql/core/src/test/scala/org/apache/spark/sql/execution/UnsafeExternalSortSuite.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import org.apache.spark.sql.catalyst.dsl.expressions._
2626
import org.apache.spark.sql.test.TestSQLContext
2727
import org.apache.spark.sql.types._
2828

29-
3029
class UnsafeExternalSortSuite extends SparkPlanTest with BeforeAndAfterAll {
3130

3231
override def beforeAll(): Unit = {

0 commit comments

Comments
 (0)