Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
UDF test
  • Loading branch information
MaxGekk committed Oct 11, 2019
commit c188351c774f8d028c61b50e780b1bd0d8f188a0
8 changes: 8 additions & 0 deletions sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@ class UDFSuite extends QueryTest with SharedSparkSession {
}
}

test("Using java.time.Duration in UDF") {
val expected = java.time.Duration.ofMinutes(40).plusDays(1)
val plusDay = udf((i: java.time.Duration) => i.plusDays(1))
val df = spark.sql("SELECT interval 40 minutes as i")
.select(plusDay('i))
assert(df.collect().toSeq === Seq(Row(expected)))
}

test("SPARK-28321 0-args Java UDF should not be called only once") {
val nonDeterministicJavaUDF = udf(
new UDF0[Int] {
Expand Down