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

[jira] [Created] (SPARK-8972) Wrong result for rollup

Cheng Hao created SPARK-8972:
--------------------------------

             Summary: Wrong result for rollup
                 Key: SPARK-8972
                 URL: https://issues.apache.org/jira/browse/SPARK-8972
             Project: Spark
          Issue Type: Bug
          Components: SQL
            Reporter: Cheng Hao
            Priority: Critical


{code:java}
import sqlContext.implicits._
case class KeyValue(key: Int, value: String)
val df = sc.parallelize(1 to 5).map(i=>KeyValue(i, i.toString)).toDF
df.registerTempTable("foo")
sqlContext.sql("select count(*) as cnt, key % 100,GROUPING__ID from foo group by key%100 with rollup").show(100)
// output
+---+---+------------+
|cnt|_c1|GROUPING__ID|
+---+---+------------+
|  1|  4|           0|
|  1|  4|           1|
|  1|  5|           0|
|  1|  5|           1|
|  1|  1|           0|
|  1|  1|           1|
|  1|  2|           0|
|  1|  2|           1|
|  1|  3|           0|
|  1|  3|           1|
+---+---+------------+
{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