-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-17237][SPARK-17458][SQL][Backport-2.0] Preserve aliases that are given for pivot aggregations #16565
Conversation
Test build #71281 has finished for PR 16565 at commit
|
Could you change the PR title to |
okay! I'm now looking into the test failure, so just a sec, thanks |
Test build #71290 has finished for PR 16565 at commit
|
I checked the change history. Actually, you also backported #15111. Could you please update your PR description and PR title? |
LGTM except one comment |
@gatorsmile oh, I see. Is it okay to mix this pr with the fix of #15111? Would it be better to backport #15111 first then, backport this? |
@gatorsmile ping |
I think it is fine to do it together. Basically, your PR is to fix the bug of #15111 |
okay! I'll update them |
@gatorsmile How about this fix? plz check this again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…re given for pivot aggregations ## What changes were proposed in this pull request? This pr is to preserve aliases that are given for pivot aggregations to solve the issue reported in `SPARK-17237`. This pivoting adds backticks (e.g. 3_count(\`c\`)) in column names and, in some cases, thes causes analysis exceptions like; ``` scala> val df = Seq((2, 3, 4), (3, 4, 5)).toDF("a", "x", "y") scala> df.groupBy("a").pivot("x").agg(count("y"), avg("y")).na.fill(0) org.apache.spark.sql.AnalysisException: syntax error in attribute name: `3_count(`y`)`; at org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute$.e$1(unresolved.scala:134) at org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute$.parseAttributeName(unresolved.scala:144) ... ``` So, this pr also removes these backticks from column names. ## How was this patch tested? Added a test in `DataFrameAggregateSuite`. Author: Takeshi YAMAMURO <linguin.m.s@gmail.com> Closes #16565 from maropu/SPARK-17237-3.
Thanks! Merging to 2.0 Could you please close it? |
Okay and thanks! |
What changes were proposed in this pull request?
This pr is to preserve aliases that are given for pivot aggregations to solve the issue reported in
SPARK-17237
. This pivoting adds backticks (e.g. 3_count(`c`)) in column names and, in some cases,thes causes analysis exceptions like;
So, this pr also removes these backticks from column names.
How was this patch tested?
Added a test in
DataFrameAggregateSuite
.