You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (Jira)" <ji...@apache.org> on 2022/08/03 07:14:00 UTC
[jira] [Resolved] (SPARK-39962) Global aggregation against pandas aggregate UDF does not take the column order into account
[ https://issues.apache.org/jira/browse/SPARK-39962?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hyukjin Kwon resolved SPARK-39962.
----------------------------------
Fix Version/s: 3.3.1
3.1.4
3.2.3
3.4.0
Resolution: Fixed
Issue resolved by pull request 37390
[https://github.com/apache/spark/pull/37390]
> Global aggregation against pandas aggregate UDF does not take the column order into account
> -------------------------------------------------------------------------------------------
>
> Key: SPARK-39962
> URL: https://issues.apache.org/jira/browse/SPARK-39962
> Project: Spark
> Issue Type: Bug
> Components: PySpark
> Affects Versions: 3.1.3, 3.3.0, 3.2.2, 3.4.0
> Reporter: Hyukjin Kwon
> Assignee: Hyukjin Kwon
> Priority: Major
> Fix For: 3.3.1, 3.1.4, 3.2.3, 3.4.0
>
>
> {code}
> import pandas as pd
> from pyspark.sql import functions as f
> @f.pandas_udf("double")
> def AVG(x: pd.Series) -> float:
> return x.mean()
> abc = spark.createDataFrame([(1.0, 5.0, 17.0)], schema=["a", "b", "c"])
> abc.agg(AVG("a"), AVG("c")).show()
> abc.select("c", "a").agg(AVG("a"), AVG("c")).show()
> {code}
> {code}
> +------+------+
> |AVG(a)|AVG(c)|
> +------+------+
> | 1.0| 17.0|
> +------+------+
> +------+------+
> |AVG(a)|AVG(c)|
> +------+------+
> | 17.0| 1.0|
> +------+------+
> {code}
> Both have to be the same.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org