[ https://issues.apache.org/jira/browse/SPARK-8956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14624121#comment-14624121 ]
Cheng Hao commented on SPARK-8956: ---------------------------------- Sorry, I didn't notice this jira issue when I created this issue 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org