Can you please post result of show()? On 10 Jul 2015 01:00, "Yana Kadiyska" <yana.kadiy...@gmail.com> wrote:
> Hi folks, I just re-wrote a query from using UNION ALL to use "with > rollup" and I'm seeing some unexpected behavior. I'll open a JIRA if needed > but wanted to check if this is user error. Here is my 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, value as key,GROUPING__ID from foo > group by value with rollup”).show(100) > > > sqlContext.sql(“select count(*) as cnt, key % 100 as key,GROUPING__ID from > foo group by key%100 with rollup”).show(100) > > > > Grouping by value does the right thing, I get one group 0 with the overall > count. But grouping by expression (key%100) produces weird results -- > appears that group 1 results are replicated as group 0. Am I doing > something wrong or is this a bug? >