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 2021/01/23 01:53:31 UTC

[GitHub] [beam] chamikaramj commented on a change in pull request #13762: [BEAM-11643] Add BigDecimal support for SpannerIO

chamikaramj commented on a change in pull request #13762:
URL: https://github.com/apache/beam/pull/13762#discussion_r562999602



##########
File path: sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/MutationSizeEstimator.java
##########
@@ -153,6 +161,21 @@ private static long estimateArrayValue(Value v) {
         return 12L * v.getDateArray().size();
       case TIMESTAMP:
         return 12L * v.getTimestampArray().size();
+      case NUMERIC:
+        totalLength = 0;
+        for (BigDecimal n : v.getNumericArray()) {
+          if (n == null) {

Review comment:
       Is size estimation all that is needed for adding support for this type ? Don't we have to handle the values that are read ?

##########
File path: sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/MutationSizeEstimatorTest.java
##########
@@ -81,10 +100,16 @@ public void nullPrimitiveArrays() throws Exception {
             .build();
     Mutation bool =
         Mutation.newInsertOrUpdateBuilder("test").set("one").toBoolArray((boolean[]) null).build();
+    Mutation numeric =
+        Mutation.newInsertOrUpdateBuilder("test")
+            .set("one")

Review comment:
       Also add tests for reading/writing the new type ?




----------------------------------------------------------------
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.

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