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 2021/06/24 08:00:26 UTC

[GitHub] [spark] AngersZhuuuu commented on a change in pull request #33056: [SPARK-35871][SQL] Literal.create(value, dataType) should support fields

AngersZhuuuu commented on a change in pull request #33056:
URL: https://github.com/apache/spark/pull/33056#discussion_r657717341



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/LiteralExpressionSuite.scala
##########
@@ -432,4 +432,22 @@ class LiteralExpressionSuite extends SparkFunSuite with ExpressionEvalHelper {
       assert(literal.toString === expected)
     }
   }
+
+  test("SPARK-35871: Literal.create(value, dataType) should support fields") {
+    Seq((Period.ofMonths(13), Array(13, 12, 13)))
+      .foreach { case (period, expect) =>
+        DataTypeTestUtils.yearMonthIntervalTypes.zip(expect).foreach { case (dt, result) =>
+          checkEvaluation(Literal.create(period, dt), result)
+        }
+      }
+
+    Seq((Duration.ofSeconds(86400 + 3600 + 60 + 1),
+      Array(86400000000L, 90000000000L, 90060000000L, 90061000000L, 90000000000L,
+        90060000000L, 90061000000L, 90060000000L, 90061000000L, 90061000000L)))

Review comment:
       how about current ?




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