Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/15916
  
    The test case I added in this pr:
    
        val rng = new scala.util.Random(42)
        val data = sparkContext.parallelize(Seq.tabulate(100) { i =>
          Row(Array.fill(10)(rng.nextInt(10)))
        })
        val schema = StructType(Seq(
          StructField("arr", DataTypes.createArrayType(DataTypes.IntegerType))
        ))
        val df = spark.createDataFrame(data, schema)
        val exploded = df.select(struct(col("*")).as("star"), 
explode(col("arr")).as("a"))
        val joined = exploded.join(exploded, "a").drop("a").distinct()
        joined.show()
    
    would thrown an exception like this:
    
        [info] - SPARK-18487: Consume all elements for show/take to avoid 
memory leak *** FAILED *** (1 second, 73 milliseconds)
        [info]   org.apache.spark.SparkException: Job aborted due to stage 
failure: Task 0 in stage 179.0 failed 1 times, most recent failure: Lost task 
0.0 in stage 179.0 (TID 501, localhost, executor driver): 
org.apache.spark.SparkException: Managed memory leak detected; size = 33816576 
bytes, TID = 501
        [info]  at 
org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:295)
        [info]  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        [info]  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        [info]  at java.lang.Thread.run(Thread.java:745)
    
    I submitted this pr because @sethah encountered this exception during his 
test. I think it might be other developers hit this in the future. If they 
don't know this part, from the error message they would think a memory leak 
happened. In order to avoid this and provide more useful info, I'd like to 
modify this error message too.
    



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to