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 2021/03/03 23:32:45 UTC

[GitHub] [spark] ueshin opened a new pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

ueshin opened a new pull request #31730:
URL: https://github.com/apache/spark/pull/31730


   ### What changes were proposed in this pull request?
   
   Fixes a Python UDF `plus_one` used in `GroupedAggPandasUDFTests` to always return float (double) values.
   
   ### Why are the changes needed?
   
   The Python UDF `plus_one` used in `GroupedAggPandasUDFTests` is always returning `v + 1` regardless of its type. The return type of the UDF is 'double', so if the input is int, the result will be `null`.
   
   ```py
   >>> df = spark.range(10).toDF('id') \
   ...             .withColumn("vs", array([lit(i * 1.0) + col('id') for i in range(20, 30)])) \
   ...             .withColumn("v", explode(col('vs'))) \
   ...             .drop('vs') \
   ...             .withColumn('w', lit(1.0))
   >>> @udf('double')
   ... def plus_one(v):
   ...   assert isinstance(v, (int, float))
   ...   return v + 1
   ...
   >>> @pandas_udf('double', PandasUDFType.GROUPED_AGG)
   ... def sum_udf(v):
   ...   return v.sum()
   ...
   >>> df.groupby(plus_one(df.id)).agg(sum_udf(df.v)).show()
   +------------+----------+
   |plus_one(id)|sum_udf(v)|
   +------------+----------+
   |        null|    2900.0|
   +------------+----------+
   ```
   
   This is meaningless and should be:
   
   ```py
   >>> @udf('double')
   ... def plus_one(v):
   ...   assert isinstance(v, (int, float))
   ...   return float(v + 1)
   ...
   >>> df.groupby(plus_one(df.id)).agg(sum_udf(df.v)).sort('plus_one(id)').show()
   +------------+----------+
   |plus_one(id)|sum_udf(v)|
   +------------+----------+
   |         1.0|     245.0|
   |         2.0|     255.0|
   |         3.0|     265.0|
   |         4.0|     275.0|
   |         5.0|     285.0|
   |         6.0|     295.0|
   |         7.0|     305.0|
   |         8.0|     315.0|
   |         9.0|     325.0|
   |        10.0|     335.0|
   +------------+----------+
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, test-only.
   
   ### How was this patch tested?
   
   Fixed the test.
   


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



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790196690


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/135724/
   


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



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


[GitHub] [spark] HyukjinKwon closed pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #31730:
URL: https://github.com/apache/spark/pull/31730


   


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



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


[GitHub] [spark] SparkQA commented on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790209534


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/40306/
   


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



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790222221


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/40306/
   


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



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


[GitHub] [spark] SparkQA commented on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790181721


   **[Test build #135724 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/135724/testReport)** for PR 31730 at commit [`0a4b4d4`](https://github.com/apache/spark/commit/0a4b4d4c4b98b5ed8bb73f134e81182d9042f302).


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



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


[GitHub] [spark] AmplabJenkins commented on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790222221


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/40306/
   


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



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


[GitHub] [spark] SparkQA commented on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790198869


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/40306/
   


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



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


[GitHub] [spark] SparkQA removed a comment on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790181721


   **[Test build #135724 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/135724/testReport)** for PR 31730 at commit [`0a4b4d4`](https://github.com/apache/spark/commit/0a4b4d4c4b98b5ed8bb73f134e81182d9042f302).


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



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


[GitHub] [spark] SparkQA commented on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790191948


   **[Test build #135724 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/135724/testReport)** for PR 31730 at commit [`0a4b4d4`](https://github.com/apache/spark/commit/0a4b4d4c4b98b5ed8bb73f134e81182d9042f302).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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



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


[GitHub] [spark] HyukjinKwon commented on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790201695


   Merged to master, branch-3.1 and branch-3.0.


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



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


[GitHub] [spark] AmplabJenkins commented on pull request #31730: [SPARK-34610][PYTHON][TEST] Fix Python UDF used in GroupedAggPandasUDFTests.

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #31730:
URL: https://github.com/apache/spark/pull/31730#issuecomment-790196690


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/135724/
   


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



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