From 5857d3bf22ef35ce6cf8311f503ffacfcd8d63f3 Mon Sep 17 00:00:00 2001 From: jontradesy Date: Tue, 10 Dec 2019 19:49:28 -0800 Subject: [PATCH] Jon/bigquery timestamp support (#27) * Adding support for BigQuery timestamps without millisecond precision * Setting jar manifest to the Apache Beam job * Adding unit test for timestamp format * Update pom.xml Removing manifest configuration in pom.xml --- src/main/java/com/github/yuiskw/beam/TableRow2EntityFn.java | 1 + src/test/java/com/github/yuiskw/beam/TableRow2EntityFnTest.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/com/github/yuiskw/beam/TableRow2EntityFn.java b/src/main/java/com/github/yuiskw/beam/TableRow2EntityFn.java index 1d67b7d..147ebe4 100644 --- a/src/main/java/com/github/yuiskw/beam/TableRow2EntityFn.java +++ b/src/main/java/com/github/yuiskw/beam/TableRow2EntityFn.java @@ -303,6 +303,7 @@ public static Instant parseTimestamp(String value) { "yyyy-M-d H:m:s.SSS z", "yyyy-M-d H:m:s.SS z", "yyyy-M-d H:m:s.S z", + "yyyy-M-d H:m:s z", "yyyy-M-d H:m:s.SSS", "yyyy-M-d H:m:s.SS", "yyyy-M-d H:m:s.S", diff --git a/src/test/java/com/github/yuiskw/beam/TableRow2EntityFnTest.java b/src/test/java/com/github/yuiskw/beam/TableRow2EntityFnTest.java index f3665cc..62cd414 100644 --- a/src/test/java/com/github/yuiskw/beam/TableRow2EntityFnTest.java +++ b/src/test/java/com/github/yuiskw/beam/TableRow2EntityFnTest.java @@ -166,6 +166,7 @@ public void testIsTimestamp() { assertNotNull(TableRow2EntityFn.parseTimestamp("2017-9-1 4:1:1.1 UTC")); assertNotNull(TableRow2EntityFn.parseTimestamp("2017-9-1 4:1:1.12 UTC")); assertNotNull(TableRow2EntityFn.parseTimestamp("2017-9-1 4:1:1.001 UTC")); + assertNotNull(TableRow2EntityFn.parseTimestamp("2019-03-13 22:00:20 UTC")); assertNotNull(TableRow2EntityFn.parseTimestamp("2017-09-16 04:14:37.844 PST")); assertNotNull(TableRow2EntityFn.parseTimestamp("2017-09-16 04:14:37.844 JST"));