You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/08/03 17:10:05 UTC

[GitHub] [beam] darshan-sj commented on a diff in pull request #22428: Add units tests for SpannerIO

darshan-sj commented on code in PR #22428:
URL: https://github.com/apache/beam/pull/22428#discussion_r936934221


##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/MutationUtilsTest.java:
##########
@@ -235,10 +311,42 @@ private static Mutation createMutation(Mutation.Op operation) {
         .to(Struct.newBuilder().set("int64").to(3L).build())
         .set("f_array")
         .toInt64Array(ImmutableList.of(2L, 3L))
+        .set("f_double_array")
+        .toFloat64Array(ImmutableList.of(1., 2.))
+        .set("f_decimal_array")
+        .toNumericArray(
+            ImmutableList.of(
+                BigDecimal.valueOf(Long.MIN_VALUE), BigDecimal.valueOf(Long.MAX_VALUE)))
+        .set("f_boolean_array")
+        .toBoolArray(ImmutableList.of(false, true))
+        .set("f_string_array")
+        .toStringArray(ImmutableList.of("donald_duck", "micky_mouse"))
+        .set("f_bytes_array")
+        .toBytesArray(
+            ImmutableList.of(
+                ByteArray.copyFrom("some_bytes".getBytes(UTF_8)),
+                ByteArray.copyFrom("some_bytes".getBytes(UTF_8))))
+        .set("f_datetime_array")
+        .toTimestampArray(
+            ImmutableList.of(
+                Timestamp.parseTimestamp("2077-10-15T00:00:00Z"),

Review Comment:
   Same comment here. Does this produce different output based on machine timezone? I mean the test should not be flaky.



##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/MutationUtilsTest.java:
##########
@@ -70,11 +83,47 @@ public class MutationUtilsTest {
           .withFieldValue("f_struct", EMPTY_ROW)
           .withFieldValue("f_struct_int64", INT64_ROW)
           .withFieldValue("f_array", ImmutableList.of(2L, 3L))
+          .withFieldValue("f_double_array", ImmutableList.of(1., 2.))
+          .withFieldValue(
+              "f_decimal_array",
+              ImmutableList.of(
+                  BigDecimal.valueOf(Long.MIN_VALUE), BigDecimal.valueOf(Long.MAX_VALUE)))
+          .withFieldValue("f_boolean_array", ImmutableList.of(false, true))
+          .withFieldValue("f_string_array", ImmutableList.of("donald_duck", "micky_mouse"))
+          .withFieldValue(
+              "f_bytes_array",
+              ImmutableList.of("some_bytes".getBytes(UTF_8), "some_bytes".getBytes(UTF_8)))
+          .withFieldValue(
+              "f_datetime_array",
+              ImmutableList.of(
+                  DateTime.parse("2077-10-15T00:00:00+00:00"),

Review Comment:
   Does this parse method produce different output based on the timezone of machine it is running on?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org