HyukjinKwon commented on a change in pull request #27278: 
[SPARK-30569][SQL][PYSPARK][SPARKR] Add percentile_approx DSL functions.
URL: https://github.com/apache/spark/pull/27278#discussion_r380071198
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/api/python/PythonUtils.scala
 ##########
 @@ -71,6 +71,13 @@ private[spark] object PythonUtils {
     vs.toArray().asInstanceOf[Array[T]]
   }
 
+  /**
+   * Convert list of java.lang.Double into array of Double
+   */
+  def doubleJListToArray(vs: JList[java.lang.Double]): Array[Double] = {
+    vs.asScala.map(_.doubleValue).toArray
 
 Review comment:
   Oh, we don't need this. We can manually create an array of double in PySpark 
side. For example as below:
   
   ```python
   # Create an array of objects
   a_list = [...]
   double_class = self._spark_session._jvm.Double
   arr = SparkContext._gateway.new_array(str_class, len(a_list))
   for i in range(len(a_list)):
       arr[i] = a_list[i]
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to