Github user xwu0226 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14842#discussion_r77372825
  
    --- Diff: 
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java
 ---
    @@ -333,11 +333,12 @@ public UnsafeSorterIterator getSortedIterator() {
         if (nullBoundaryPos > 0) {
           assert radixSortSupport != null : "Nulls are only stored separately 
with radix sort";
           LinkedList<UnsafeSorterIterator> queue = new LinkedList<>();
    -      if (radixSortSupport.sortDescending()) {
    -        // Nulls are smaller than non-nulls
    +
    +      // The null order is either LAST or FIRST, regardless of sorting 
direction (ASC|DESC)
    +      if (radixSortSupport.nullOrder() == PrefixComparator.NullOrder.LAST) 
{
             queue.add(new SortedIterator((pos - nullBoundaryPos) / 2, offset));
             queue.add(new SortedIterator(nullBoundaryPos / 2, 0));
    -      } else {
    +      } else if (radixSortSupport.nullOrder() == 
PrefixComparator.NullOrder.FIRST) {
             queue.add(new SortedIterator(nullBoundaryPos / 2, 0));
             queue.add(new SortedIterator((pos - nullBoundaryPos) / 2, offset));
           }
    --- End diff --
    
    Thank you for the advice! Yep. Your way works as expected. I am going to 
push soon after the full test. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to