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

    https://github.com/apache/spark/pull/15874#discussion_r87922281
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/LSH.scala ---
    @@ -179,16 +211,13 @@ private[ml] abstract class LSHModel[T <: LSHModel[T]]
           inputName: String,
           explodeCols: Seq[String]): Dataset[_] = {
         require(explodeCols.size == 2, "explodeCols must be two strings.")
    -    val vectorToMap = udf((x: Vector) => x.asBreeze.iterator.toMap,
    -      MapType(DataTypes.IntegerType, DataTypes.DoubleType))
         val modelDataset: DataFrame = if 
(!dataset.columns.contains($(outputCol))) {
           transform(dataset)
         } else {
           dataset.toDF()
         }
         modelDataset.select(
    -      struct(col("*")).as(inputName),
    -      explode(vectorToMap(col($(outputCol)))).as(explodeCols))
    +      struct(col("*")).as(inputName), 
posexplode(col($(outputCol))).as(explodeCols))
    --- End diff --
    
    Well here's a fun one. When I run this test:
    
    ````scala
      test("memory leak test") {
        val numDim = 50
        val data = {
          for (i <- 0 until numDim; j <- Seq(-2, -1, 1, 2))
            yield Vectors.sparse(numDim, Seq((i, j.toDouble)))
        }
        val df = spark.createDataFrame(data.map(Tuple1.apply)).toDF("keys")
    
        // Project from 100 dimensional Euclidean Space to 10 dimensions
        val brp = new BucketedRandomProjectionLSH()
          .setNumHashTables(10)
          .setInputCol("keys")
          .setOutputCol("values")
          .setBucketLength(2.5)
          .setSeed(12345)
        val model = brp.fit(df)
        val joined = model.approxSimilarityJoin(df, df, Double.MaxValue, 
"distCol")
        joined.show()
    }
    ````
    I get the following error:
    ````
    [info] - BucketedRandomProjectionLSH with high dimension data: test of LSH 
property *** FAILED *** (7 seconds, 568 milliseconds)
    [info]   org.apache.spark.SparkException: Job aborted due to stage failure: 
Task 0 in stage 4.0 failed 1 times, most recent failure: Lost task 0.0 in stage 
4.0 (TID 205, localhost, executor driver): org.apache.spark.SparkException: 
Managed memory leak detected; size = 33816576 bytes, TID = 205
    [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)
    ````
    Could you run the same test and see if you get an error?


---
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