You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by am...@apache.org on 2019/10/14 20:04:12 UTC
[beam] branch master updated: [BEAM-7073]: Add unit test for Avro
logical type datum.
This is an automated email from the ASF dual-hosted git repository.
amaliujia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 8a661a4 [BEAM-7073]: Add unit test for Avro logical type datum.
new b8bef24 Merge pull request #9773 from RyanSkraba/BEAM-7073-avro-sql-unit-test
8a661a4 is described below
commit 8a661a45947af9f86d9e365097ee84767934fb5d
Author: Ryan Skraba <ry...@skraba.com>
AuthorDate: Fri Oct 11 16:22:55 2019 +0200
[BEAM-7073]: Add unit test for Avro logical type datum.
---
.../test/java/org/apache/beam/sdk/schemas/utils/AvroUtilsTest.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/utils/AvroUtilsTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/utils/AvroUtilsTest.java
index cedeb77..3679e21 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/utils/AvroUtilsTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/utils/AvroUtilsTest.java
@@ -502,8 +502,14 @@ public class AvroUtilsTest {
@Test
public void testGenericRecordToBeamRow() {
+ GenericRecord genericRecord = getGenericRecord();
Row row = AvroUtils.toBeamRowStrict(getGenericRecord(), null);
assertEquals(getBeamRow(), row);
+
+ // Alternatively, a timestamp-millis logical type can have a joda datum.
+ genericRecord.put("timestampMillis", new DateTime(genericRecord.get("timestampMillis")));
+ row = AvroUtils.toBeamRowStrict(getGenericRecord(), null);
+ assertEquals(getBeamRow(), row);
}
@Test