You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2023/02/23 07:17:21 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #40138: [SPARK-41793][SQL] Incorrect result for window frames defined by a range clause on large decimals

cloud-fan commented on code in PR #40138:
URL: https://github.com/apache/spark/pull/40138#discussion_r1115306480


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameWindowFramesSuite.scala:
##########
@@ -474,4 +474,33 @@ class DataFrameWindowFramesSuite extends QueryTest with SharedSparkSession {
     checkAnswer(df,
       Row(3, 1.5) :: Row(3, 1.5) :: Row(6, 2.0) :: Row(6, 2.0) :: Row(6, 2.0) :: Nil)
   }
+
+  test("SPARK-41793: Incorrect result for window frames defined by a range clause on large " +
+    "decimals") {
+    withTempView("test_table") {
+      spark.sql(
+        """
+          |create or replace temp view test_table as
+          |select * from values
+          |  (1, cast('11342371013783243717493546650944543.47' as decimal(38,2))),
+          |  (1, cast('999999999999999999999999999999999999.99' as decimal(38,2)))
+          |as data(a, b);
+          |""".stripMargin)

Review Comment:
   It seems simpler to use scala API for it
   ```
   Seq(
     1 -> "113...",
     1 -> "999 ..."
   ).toDF("a", "b")
     .select("a", $"b".cast("decimal(38, 2)"))
     .createTempView("...")
   ```



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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