PIG-3864: ToDate(userstring, format, timezone) computes DateTime with strange handling of Daylight Saving Time with location based timezones (daijy via rohini)
git-svn-id: https://svn.apache.org/repos/asf/pig/trunk@1819354 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index a443926..66ea6e6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -59,6 +59,9 @@
OPTIMIZATIONS
BUG FIXES
+
+PIG-3864: ToDate(userstring, format, timezone) computes DateTime with strange handling of Daylight Saving Time with location based timezones (daijy via rohini)
+
PIG-5312: Uids not set in inner schemas after UNION ONSCHEMA (tmwoodruff via knoguchi)
PIG-5300: hashCode for Bag needs to be order independent (knoguchi)
diff --git a/src/org/apache/pig/builtin/ToDate3ARGS.java b/src/org/apache/pig/builtin/ToDate3ARGS.java
index dc98b3c..64b7bff 100644
--- a/src/org/apache/pig/builtin/ToDate3ARGS.java
+++ b/src/org/apache/pig/builtin/ToDate3ARGS.java
@@ -39,8 +39,7 @@
}
DateTimeFormatter dtf = DateTimeFormat.forPattern(DataType
.toString(input.get(1)));
- DateTimeZone dtz = DateTimeZone.forOffsetMillis(DateTimeZone.forID(
- DataType.toString(input.get(2))).getOffset(null));
+ DateTimeZone dtz = DateTimeZone.forID(DataType.toString(input.get(2)));
return dtf.withZone(dtz).parseDateTime(DataType.toString(input.get(0)));
}
diff --git a/test/org/apache/pig/test/TestBuiltin.java b/test/org/apache/pig/test/TestBuiltin.java
index 05c7ca6..70abd5d 100644
--- a/test/org/apache/pig/test/TestBuiltin.java
+++ b/test/org/apache/pig/test/TestBuiltin.java
@@ -533,9 +533,16 @@
ToMilliSeconds func7 = new ToMilliSeconds();
Tuple t13 = TupleFactory.getInstance().newTuple(1);
t13.set(0, new DateTime(1231290421000L));
- Long ut2 = func7.exec(t11);
+ Long ut2 = func7.exec(t13);
assertEquals(ut2.longValue(), 1231290421000L);
+ Tuple t14 = TupleFactory.getInstance().newTuple(3);
+ t14.set(0, "2014-02-02 18:00:00.000Z");
+ t14.set(1, "yyyy-MM-dd HH:mm:ss.SSSZ");
+ t14.set(2, "Europe/Berlin");
+ DateTime dt8 = func4.exec(t14);
+ assertEquals(dt8.toString(), "2014-02-02T19:00:00.000+01:00");
+
// Null handling
t1.set(0, null);
assertEquals(func1.exec(t1), null);