This is an automated email from the ASF dual-hosted git repository. reuvenlax 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 871a98b97fb Merge pull request #17779: [BEAM-14529] Add integer to float64 conversion support 871a98b97fb is described below commit 871a98b97fb52169a245a8800b92586a0026a565 Author: Yiru Tang <y...@google.com> AuthorDate: Fri Jun 3 15:58:08 2022 -0700 Merge pull request #17779: [BEAM-14529] Add integer to float64 conversion support --- .../beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java | 2 +- .../beam/sdk/io/gcp/bigquery/TableRowToStorageApiProtoTest.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java index 7c1aefd4b85..442bc57eb0d 100644 --- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java +++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java @@ -403,7 +403,7 @@ public class TableRowToStorageApiProto { case "FLOAT": if (value instanceof String) { return Double.valueOf((String) value); - } else if (value instanceof Double || value instanceof Float) { + } else if (value instanceof Number) { return ((Number) value).doubleValue(); } break; diff --git a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProtoTest.java b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProtoTest.java index 459fed3a168..c2d6cf23984 100644 --- a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProtoTest.java +++ b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProtoTest.java @@ -457,7 +457,7 @@ public class TableRowToStorageApiProtoTest { new TableCell().setV("42"), new TableCell().setV("43"), new TableCell().setV("2.8168"), - new TableCell().setV("2.817"), + new TableCell().setV("2"), new TableCell().setV("true"), new TableCell().setV("true"), new TableCell().setV("1970-01-01T00:00:00.000043Z"), @@ -476,7 +476,7 @@ public class TableRowToStorageApiProtoTest { .set("int64Value", "42") .set("intValue", "43") .set("float64Value", "2.8168") - .set("floatValue", "2.817") + .set("floatValue", "2") .set("boolValue", "true") .set("booleanValue", "true") .set("timestampValue", "1970-01-01T00:00:00.000043Z") @@ -495,7 +495,7 @@ public class TableRowToStorageApiProtoTest { .put("int64value", (long) 42) .put("intvalue", (long) 43) .put("float64value", (double) 2.8168) - .put("floatvalue", (double) 2.817) + .put("floatvalue", (double) 2) .put("boolvalue", true) .put("booleanvalue", true) .put("timestampvalue", 43L) @@ -518,7 +518,7 @@ public class TableRowToStorageApiProtoTest { .put("int64value", (long) 42) .put("intvalue", (long) 43) .put("float64value", (double) 2.8168) - .put("floatvalue", (double) 2.817) + .put("floatvalue", (double) 2) .put("boolvalue", true) .put("booleanvalue", true) .put("timestampvalue", 43L)