Skip to content

Commit

Permalink
Use empty prefix to sort UnsafeRow during sortBeforeRepartition
Browse files Browse the repository at this point in the history
  • Loading branch information
w.montaz committed Mar 19, 2024
1 parent 1f247d4 commit 0baeb2c
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,10 @@ object ShuffleExchangeExec {
// The prefix computer generates row hashcode as the prefix, so we may decrease the
// probability that the prefixes are equal when input rows choose column values from a
// limited range.
val emptyPrefix = new UnsafeExternalRowSorter.PrefixComputer.Prefix
val prefixComputer = new UnsafeExternalRowSorter.PrefixComputer {
private val result = new UnsafeExternalRowSorter.PrefixComputer.Prefix
override def computePrefix(row: InternalRow):
UnsafeExternalRowSorter.PrefixComputer.Prefix = {
// The hashcode generated from the binary form of a [[UnsafeRow]] should not be null.
result.isNull = false
result.value = row.hashCode()
result
}
UnsafeExternalRowSorter.PrefixComputer.Prefix = emptyPrefix
}
val pageSize = SparkEnv.get.memoryManager.pageSizeBytes

Expand Down

0 comments on commit 0baeb2c

Please sign in to comment.