This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/branch-1.7 by this push:
new f9c6af4 ORC-879: Fix testDateTimeTypeSupport unit test (#942)
f9c6af4 is described below
commit f9c6af4b0a3d48ed559a87420973b34bdce748af
Author: Guiyanakaung <[email protected]>
AuthorDate: Wed Oct 20 15:06:21 2021 +0800
ORC-879: Fix testDateTimeTypeSupport unit test (#942)
### What changes were proposed in this pull request?
```java
OffsetDateTime datetime4 = OffsetDateTime.of(datetime2,
ZoneOffset.ofHours(-7));
datetime4.toString().replace("07:00", "0700")
```
The intention here is to replace the format of the time zone, but it is
possible to replace HH:mm.
https://github.com/apache/orc/pull/941#issuecomment-946774472
```
java.time.format.DateTimeParseException: Text
'2021-10-19T0700:01.683210-0700' could not be parsed at index 13
at
java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046)
at
java.base/java.time.format.DateTimeFormatter.parseBest(DateTimeFormatter.java:1994)
at
org.apache.orc.tools.convert.JsonReader$TimestampColumnConverter.convert(JsonReader.java:169)
at
org.apache.orc.tools.convert.JsonReader.nextBatch(JsonReader.java:375)
at
org.apache.orc.tools.convert.TestJsonReader.testDateTimeTypeSupport(TestJsonReader.java:132)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
at
org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at
```
This pr is aimed at fixing this bug.
### Why are the changes needed?
Ensure that UT behave consistently at all times.
### How was this patch tested?
Using the current UT.
(cherry picked from commit f54833e5816f222c490e473fd9cb51fefc0e3371)
Signed-off-by: Dongjoon Hyun <[email protected]>
---
java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git
a/java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java
b/java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java
index 4863ee6..3a32c90 100644
--- a/java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java
+++ b/java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java
@@ -117,10 +117,13 @@ public class TestJsonReader {
ZonedDateTime datetime5 = ZonedDateTime.of(datetime1,
ZoneId.of("UTC"));
ZonedDateTime datetime6 = ZonedDateTime.of(datetime2,
ZoneId.of("America/New_York"));
+ String datetime4Str = datetime4.toString();
+ datetime4Str = datetime4Str.substring(0, datetime4Str.length() - 5) +
"0700";
+
String inputString = "{\"dt\": \"" + datetime1.toString() + "\"}\n" +
"{\"dt\": \"" + datetime2.toString() + "\"}\n" +
"{\"dt\": \"" + datetime3.toString() + "\"}\n" +
- "{\"dt\": \"" +
datetime4.toString().replace("07:00", "0700") + "\"}\n" +
+ "{\"dt\": \"" + datetime4Str + "\"}\n" +
"{\"dt\": \"" +
datetime5.toLocalDateTime().toString() + "[" + datetime5.getZone() + "]\"}\n" +
"{\"dt\": \"" +
datetime6.toLocalDateTime().toString() + "[" + datetime6.getZone() + "]\"}\n";