You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Reynold Xin (JIRA)" <ji...@apache.org> on 2016/11/01 20:25:59 UTC

[jira] [Updated] (SPARK-18148) Misleading Error Message for Aggregation Without Window/GroupBy

     [ https://issues.apache.org/jira/browse/SPARK-18148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Reynold Xin updated SPARK-18148:
--------------------------------
    Fix Version/s:     (was: 2.0.3)
                   2.0.2

> Misleading Error Message for Aggregation Without Window/GroupBy
> ---------------------------------------------------------------
>
>                 Key: SPARK-18148
>                 URL: https://issues.apache.org/jira/browse/SPARK-18148
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.0
>         Environment: Databricks
>            Reporter: Pat McDonough
>            Assignee: Jiang Xingbo
>             Fix For: 2.0.2, 2.1.0
>
>
> The following error message points to a random column I'm not actually using in my query, making it hard to diagnose.
> {code}
> org.apache.spark.sql.AnalysisException: expression '`randomColumn`' is neither present in the group by, nor is it an aggregate function. Add to group by or wrap in first() (or first_value) if you don't care which value you get.;
> {code}
> Note in the code below, I forgot to add {{.over(weeklyWindow)}} in the line for {{withColumn("user_count"...}}
> {code}
> spark.read.load("/some-data")
>   .withColumn("date_dt", to_date($"date"))
>   .withColumn("year", year($"date_dt"))
>   .withColumn("week", weekofyear($"date_dt"))
>   .withColumn("user_count", count($"userId"))
>   .withColumn("daily_max_in_week", max($"user_count").over(weeklyWindow))
> )
> {code}
> CC: [~marmbrus]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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