Skip to content

Conversation

@DonnyZone
Copy link
Contributor

@DonnyZone DonnyZone commented Sep 12, 2017

What changes were proposed in this pull request?

https://issues.apache.org/jira/browse/SPARK-21980

This PR fixes the issue in ResolveGroupingAnalytics rule, which indexes the column references in grouping functions without considering case sensitive configurations.

The problem can be reproduced by:

val df = spark.createDataFrame(Seq((1, 1), (2, 1), (2, 2))).toDF("a", "b") df.cube("a").agg(grouping("A")).show()

How was this patch tested?

unit tests

@DonnyZone
Copy link
Contributor Author

ping @cloud-fan @gatorsmile

}
case e @ Grouping(col: Expression) =>
val idx = groupByExprs.indexOf(col)
val idx = groupByExprs.indexWhere(x => resolver(x.toString, col.toString))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indexWhere(_.semanticEquals(col))

@gatorsmile
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Sep 12, 2017

Test build #81688 has finished for PR 19202 at commit b08fd93.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@DonnyZone DonnyZone changed the title [SPARK-21980][SQL]References in grouping functions should be indexed with resolver [SPARK-21980][SQL]References in grouping functions should be indexed with semanticEquals Sep 13, 2017
@SparkQA
Copy link

SparkQA commented Sep 13, 2017

Test build #81699 has finished for PR 19202 at commit e24fdb8.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 13, 2017

Test build #81700 has finished for PR 19202 at commit 09efc4d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

LGTM

@gatorsmile
Copy link
Member

Thanks! Merged to master.

@asfgit asfgit closed this in 21c4450 Sep 13, 2017
asfgit pushed a commit that referenced this pull request Sep 13, 2017
… with semanticEquals

## What changes were proposed in this pull request?

https://issues.apache.org/jira/browse/SPARK-21980

This PR fixes the issue in ResolveGroupingAnalytics rule, which indexes the column references in grouping functions without considering case sensitive configurations.

The problem can be reproduced by:

`val df = spark.createDataFrame(Seq((1, 1), (2, 1), (2, 2))).toDF("a", "b")
 df.cube("a").agg(grouping("A")).show()`

## How was this patch tested?
unit tests

Author: donnyzone <[email protected]>

Closes #19202 from DonnyZone/ResolveGroupingAnalytics.

(cherry picked from commit 21c4450)
Signed-off-by: gatorsmile <[email protected]>
MatthewRBruce pushed a commit to Shopify/spark that referenced this pull request Jul 31, 2018
… with semanticEquals

## What changes were proposed in this pull request?

https://issues.apache.org/jira/browse/SPARK-21980

This PR fixes the issue in ResolveGroupingAnalytics rule, which indexes the column references in grouping functions without considering case sensitive configurations.

The problem can be reproduced by:

`val df = spark.createDataFrame(Seq((1, 1), (2, 1), (2, 2))).toDF("a", "b")
 df.cube("a").agg(grouping("A")).show()`

## How was this patch tested?
unit tests

Author: donnyzone <[email protected]>

Closes apache#19202 from DonnyZone/ResolveGroupingAnalytics.

(cherry picked from commit 21c4450)
Signed-off-by: gatorsmile <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants