DRILL-4225 TestDateFunctions#testToChar fails when the locale is non-English - Changed to use LocalDate, LocalTime and LocalDateTime to build expectedResults instead of string literals
Closes #311 Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/4e9b8256 Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/4e9b8256 Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/4e9b8256 Branch: refs/heads/master Commit: 4e9b82562cf0fc46e759b89857ffb85e129a178b Parents: 5e57b0e Author: Akihiko Kusanagi <[email protected]> Authored: Sun Dec 27 02:02:03 2015 +0900 Committer: Jason Altekruse <[email protected]> Committed: Mon Feb 8 14:54:44 2016 -0800 ---------------------------------------------------------------------- .../org/apache/drill/exec/fn/impl/TestDateFunctions.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/4e9b8256/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java index 088ca06..4718b39 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java @@ -31,6 +31,9 @@ import org.apache.drill.exec.rpc.user.QueryDataBatch; import org.apache.drill.exec.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; import org.apache.drill.exec.vector.ValueVector; +import org.joda.time.LocalDate; +import org.joda.time.LocalTime; +import org.joda.time.LocalDateTime; import org.junit.Ignore; import org.junit.Test; @@ -133,9 +136,9 @@ public class TestDateFunctions extends PopUnitTestBase { @Test public void testToChar() throws Exception { - String expectedResults[] = {"2008-Feb-23", - "12 20 30", - "2008 Feb 23 12:00:00"}; + String expectedResults[] = {(new LocalDate(2008, 2, 23)).toString("yyyy-MMM-dd"), + (new LocalTime(12, 20, 30)).toString("HH mm ss"), + (new LocalDateTime(2008, 2, 23, 12, 0, 0)).toString("yyyy MMM dd HH:mm:ss")}; testCommon(expectedResults, "/functions/date/to_char.json", "/test_simple_date.json"); }
