Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-44999

Refactor ExternalSorter to reduce checks on shouldPartition when calling getPartition

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.0.0
    • 4.0.0
    • Spark Core
    • None

    Description

        private def getPartition(key: K): Int = {
          if (shouldPartition) partitioner.get.getPartition(key) else 0
        } 

       

      The getPartition method checks shouldPartition every time it is called. However, shouldPartition should not be able to change after the ExternalSorter is instantiated. Therefore, it can be refactored to reduce the checks on shouldPartition.

      Attachments

        Activity

          People

            LuciferYang Yang Jie
            LuciferYang Yang Jie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: