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

maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 3904c0e  [SPARK-35778][SQL][TESTS] Check multiply/divide of year month 
interval of any fields by numeric
3904c0e is described below

commit 3904c0edbad1838d70cbde0aec0318dea1ecdf4a
Author: PengLei <18066542...@189.cn>
AuthorDate: Thu Jun 24 12:25:06 2021 +0300

    [SPARK-35778][SQL][TESTS] Check multiply/divide of year month interval of 
any fields by numeric
    
    ### What changes were proposed in this pull request?
    Check multiply/divide of year-month intervals of any fields by numeric.
    
    ### Why are the changes needed?
    To improve test coverage.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Expanded existed test cases.
    
    Closes #33051 from Peng-Lei/SPARK-35778.
    
    Authored-by: PengLei <18066542...@189.cn>
    Signed-off-by: Max Gekk <max.g...@gmail.com>
---
 .../sql/catalyst/expressions/IntervalExpressionsSuite.scala    | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
index 3d423dd..b83aeab 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
@@ -325,7 +325,6 @@ class IntervalExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
     checkException(days = Int.MaxValue)
   }
 
-  // TODO(SPARK-35778): Check multiply/divide of year-month intervals of any 
fields by numeric
   test("SPARK-34824: multiply year-month interval by numeric") {
     Seq(
       (Period.ofYears(-123), Literal(null, DecimalType.USER_DEFAULT)) -> null,
@@ -337,7 +336,9 @@ class IntervalExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
       (Period.ofYears(9999), 0.0001d) -> Period.ofYears(1),
       (Period.ofYears(9999), BigDecimal(0.0001)) -> Period.ofYears(1)
     ).foreach { case ((period, num), expected) =>
-      checkEvaluation(MultiplyYMInterval(Literal(period), Literal(num)), 
expected)
+      DataTypeTestUtils.yearMonthIntervalTypes.foreach { dt =>
+        checkEvaluation(MultiplyYMInterval(Literal.create(period, dt), 
Literal(num)), expected)
+      }
     }
 
     Seq(
@@ -398,7 +399,6 @@ class IntervalExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
     }
   }
 
-  // TODO(SPARK-35778): Check multiply/divide of year-month intervals of any 
fields by numeric
   test("SPARK-34868: divide year-month interval by numeric") {
     Seq(
       (Period.ofYears(-123), Literal(null, DecimalType.USER_DEFAULT)) -> null,
@@ -412,7 +412,9 @@ class IntervalExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
       (Period.ofYears(1000), 100d) -> Period.ofYears(10),
       (Period.ofMonths(2), BigDecimal(0.1)) -> Period.ofMonths(20)
     ).foreach { case ((period, num), expected) =>
-      checkEvaluation(DivideYMInterval(Literal(period), Literal(num)), 
expected)
+      DataTypeTestUtils.yearMonthIntervalTypes.foreach { dt =>
+        checkEvaluation(DivideYMInterval(Literal.create(period, dt), 
Literal(num)), expected)
+      }
     }
 
     Seq(

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

Reply via email to