This is an automated email from the ASF dual-hosted git repository.

gengliang pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.3 by this push:
     new 3241f20b13c [SPARK-39093][SQL][FOLLOWUP] Fix Period test
3241f20b13c is described below

commit 3241f20b13c0f0a390027b182a33e88b6a16cedd
Author: Bruce Robbins <bersprock...@gmail.com>
AuthorDate: Sun May 8 18:14:47 2022 +0800

    [SPARK-39093][SQL][FOLLOWUP] Fix Period test
    
    ### What changes were proposed in this pull request?
    
    Change the Period test to use months rather than days.
    
    ### Why are the changes needed?
    
    While the Period test as-is confirms that the compilation error is fixed, 
it doesn't confirm that the newly generated code is correct. Spark ignores any 
unit less than months in Periods. As a result, we are always testing `0/(num + 
3)`, so the test doesn't verify that the code generated for the right-hand 
operand is correct.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, only changes a test.
    
    ### How was this patch tested?
    
    Unit test.
    
    Closes #36481 from bersprockets/SPARK-39093_followup.
    
    Authored-by: Bruce Robbins <bersprock...@gmail.com>
    Signed-off-by: Gengliang Wang <gengli...@apache.org>
    (cherry picked from commit 670710e91dfb2ed27c24b139c50a6bcf03132024)
    Signed-off-by: Gengliang Wang <gengli...@apache.org>
---
 .../src/test/scala/org/apache/spark/sql/ColumnExpressionSuite.scala   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/ColumnExpressionSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/ColumnExpressionSuite.scala
index f970b68c39a..1f8dc6f80d0 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/ColumnExpressionSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/ColumnExpressionSuite.scala
@@ -2990,9 +2990,9 @@ class ColumnExpressionSuite extends QueryTest with 
SharedSparkSession {
   }
 
   test("SPARK-39093: divide period by integral expression") {
-    val df = Seq(((Period.ofDays(10)), 2)).toDF("pd", "num")
+    val df = Seq(((Period.ofMonths(10)), 2)).toDF("pd", "num")
     checkAnswer(df.select($"pd" / ($"num" + 3)),
-      Seq((Period.ofDays(2))).toDF)
+      Seq((Period.ofMonths(2))).toDF)
   }
 
   test("SPARK-39093: divide duration by integral expression") {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to