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

TimSort failing with error when writing a partitioned data set

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Duplicate
    • None
    • None
    • SQL
    • None

    Description

      When we need to sort rows based on partitioning columns within a task, timsort somehow failed. I do not know what is the cause. The only thing I know right now is that the partitioning columns are three string columns.

      org.apache.spark.SparkException: Task failed while writing rows.
      at org.apache.spark.sql.execution.datasources.DynamicPartitionWriterContainer.writeRows(WriterContainer.scala:396)
      at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelation$$anonfun$run$1$$anonfun$apply$mcV$sp$3.apply(InsertIntoHadoopFsRelation.scala:150)
      at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelation$$anonfun$run$1$$anonfun$apply$mcV$sp$3.apply(InsertIntoHadoopFsRelation.scala:150)
      at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)
      at org.apache.spark.scheduler.Task.run(Task.scala:88)
      at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:214)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
      at org.apache.spark.util.collection.TimSort$SortState.mergeLo(TimSort.java:794)
      at org.apache.spark.util.collection.TimSort$SortState.mergeAt(TimSort.java:525)
      at org.apache.spark.util.collection.TimSort$SortState.mergeCollapse(TimSort.java:453)
      at org.apache.spark.util.collection.TimSort$SortState.access$200(TimSort.java:325)
      at org.apache.spark.util.collection.TimSort.sort(TimSort.java:153)
      at org.apache.spark.util.collection.Sorter.sort(Sorter.scala:37)
      at org.apache.spark.util.collection.unsafe.sort.UnsafeInMemorySorter.getSortedIterator(UnsafeInMemorySorter.java:231)
      at org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter.getSortedIterator(UnsafeExternalSorter.java:404)
      at org.apache.spark.sql.execution.UnsafeKVExternalSorter.sortedIterator(UnsafeKVExternalSorter.java:159)
      at org.apache.spark.sql.execution.datasources.DynamicPartitionWriterContainer.writeRows(WriterContainer.scala:365)
      ... 8 more
      

      Attachments

        Issue Links

          Activity

            People

              nongli Nong Li
              yhuai Yin Huai
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: