-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-32816][SQL] Fix analyzer bug when aggregating multiple distinct DECIMAL columns #29673
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
Changes from 2 commits
b1ce4b5
4df4f7c
737f996
f2111df
8510ff9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2555,6 +2555,15 @@ class DataFrameSuite extends QueryTest | |
| val df = Seq(0.0 -> -0.0).toDF("pos", "neg") | ||
| checkAnswer(df.select($"pos" > $"neg"), Row(false)) | ||
| } | ||
|
|
||
| test("SPARK-32816: aggregating multiple distinct DECIMAL columns") { | ||
| spark.range(0, 100, 1, 1) | ||
| .selectExpr("id", "cast(id as decimal(9, 0)) as decimal_col") | ||
| .createOrReplaceTempView("test_table") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: wrap the test with
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about writing it like this w/o a temp view;
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Also, could you move this test into
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let me try this, I'm not sure if literal will behave differently |
||
| checkAnswer( | ||
| sql("select avg(distinct decimal_col), sum(distinct decimal_col) from test_table"), | ||
| Row(49.5, 4950)) | ||
| } | ||
| } | ||
|
|
||
| case class GroupByKey(a: Int, b: Int) | ||
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.
can we add a comment to say: this batch must be run after "Decimal Optimizations", as "Decimal Optimizations" may change the aggregate distinct column?