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

Replace revertPartialWritesAndClose with close in ExternalSorter.spill and ExternalAppendOnlyMap.spill

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: In Progress
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.3.0
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None

      Description

      ExternalAppendOnlyMap.spill method call  `revertPartialWritesAndClose` method when `objectsWritten == 0` as follows:

      try {
        while (inMemoryIterator.hasNext) {
          ...
          if (objectsWritten == serializerBatchSize) {
            flush()
          }
        }
        if (objectsWritten > 0) {
          flush()
          writer.close()
        } else {
          writer.revertPartialWritesAndClose()
        }
        success = true
      } finally {
        ...
      }

       

      writer.revertPartialWritesAndClose() can replace with writer.close to reduce a set of file operations includes open, truncate and close.

       

      A similar situation exists for ExternalSorter

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              LuciferYang Yang Jie
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: