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
Add a test to JavaUDFSuite
  • Loading branch information
MaxGekk committed Oct 11, 2019
commit 4aeb9b0066090a39e1a355d8e4e13ddc53af8af9
11 changes: 11 additions & 0 deletions sql/core/src/test/java/test/org/apache/spark/sql/JavaUDFSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package test.org.apache.spark.sql;

import java.io.Serializable;
import java.time.Duration;
import java.time.LocalDate;
import java.util.List;

Expand Down Expand Up @@ -139,4 +140,14 @@ public void udf7Test() {
spark.conf().set(SQLConf.DATETIME_JAVA8API_ENABLED().key(), originConf);
}
}

@SuppressWarnings("unchecked")
@Test
public void udf8Test() {
spark.udf().register(
"plusDay",
(Duration d) -> d.plusDays(1), DataTypes.CalendarIntervalType);
Row result = spark.sql("SELECT plusDay(interval 40 minutes)").head();
Assert.assertEquals(Duration.ofMinutes(40).plusDays(1), result.get(0));
}
}