You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/09/09 23:32:47 UTC

[GitHub] [spark] maropu commented on a change in pull request #29673: [SPARK-32816][SQL] Fix analyzer bug when aggregating multiple distinct DECIMAL columns

maropu commented on a change in pull request #29673:
URL: https://github.com/apache/spark/pull/29673#discussion_r485977416



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
##########
@@ -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")

Review comment:
       How about writing it like this w/o a temp view;
   ```
     test("SPARK-32816: aggregating multiple distinct DECIMAL columns") {
       checkAnswer(
         sql(
           s"""
              |SELECT AVG(DISTINCT decimal_col), SUM(DISTINCT decimal_col)
              |  FROM VALUES (CAST(1 AS DECIMAL(9, 0))) t(decimal_col)
            """.stripMargin),
         Row(XXX, XXX))
     }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org