You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/02/17 09:35:34 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #27278: [SPARK-30569][SQL][PYSPARK][SPARKR] Add percentile_approx DSL functions.

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org