spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pat McDonough (JIRA)" <>
Subject [jira] [Created] (SPARK-18148) Misleading Error Message for Aggregation Without Window/GroupBy
Date Fri, 28 Oct 2016 01:43:58 GMT
Pat McDonough created SPARK-18148:

             Summary: Misleading Error Message for Aggregation Without Window/GroupBy
                 Key: SPARK-18148
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.0.0
         Environment: Databricks
            Reporter: Pat McDonough

The following error message points to a random column I'm not actually using in my query,
making it hard to diagnose.

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

Note in the code below, I forgot to add {{.over(weeklyWindow)}} in the line for {{withColumn("user_count"...}}

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

CC: [~marmbrus]

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message