You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yana Kadiyska (JIRA)" <ji...@apache.org> on 2015/07/10 22:07:04 UTC

[jira] [Resolved] (SPARK-8956) Rollup produces incorrect result when group by contains expressions

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

Yana Kadiyska resolved SPARK-8956.
----------------------------------
    Resolution: Duplicate

Duplicate of Spark-8972

> Rollup produces incorrect result when group by contains expressions
> -------------------------------------------------------------------
>
>                 Key: SPARK-8956
>                 URL: https://issues.apache.org/jira/browse/SPARK-8956
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.4.0
>            Reporter: Yana Kadiyska
>
> Rollup produces incorrect results when group clause contains an expression
> {code}case class KeyValue(key: Int, value: String)
> val df = sc.parallelize(1 to 50).map(i=>KeyValue(i, i.toString)).toDF
> df.registerTempTable("foo")
> sqlContext.sql(“select count(*) as cnt, key % 100 as key,GROUPING__ID from foo group by key%100 with rollup”).show(100)
> {code}
> As a workaround, this works correctly:
> {code}
> val df1=df.withColumn("newkey",df("key")%100)
> df1.registerTempTable("foo1")
> sqlContext.sql("select count(*) as cnt, newkey as key,GROUPING__ID as grp from foo1 group by newkey with rollup").show(100)
> {code}



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