[ 
https://issues.apache.org/jira/browse/BEAM-10139?focusedWorklogId=511408&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-511408
 ]

ASF GitHub Bot logged work on BEAM-10139:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Nov/20 15:30
            Start Date: 13/Nov/20 15:30
    Worklog Time Spent: 10m 
      Work Description: piotr-szuberski commented on a change in pull request 
#12611:
URL: https://github.com/apache/beam/pull/12611#discussion_r523024788



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/StructUtils.java
##########
@@ -0,0 +1,301 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.spanner;
+
+import static java.util.stream.Collectors.toList;
+
+import com.google.cloud.ByteArray;
+import com.google.cloud.Timestamp;
+import com.google.cloud.spanner.Struct;
+import com.google.cloud.spanner.Type;
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.StreamSupport;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.values.Row;
+import org.joda.time.DateTime;
+import org.joda.time.Instant;
+
+@SuppressWarnings({
+  "nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
+})

Review comment:
       Done. Oh, it was quite painful as all of the row getters return a 
@Nullable value. Especially that checkNotNull doesn't work with the checker and 
there is even no possibility to check for null in a function (only `if (var == 
null) { throw new NullPointerException("Null var"); }` seem to work.
   
   It doesn't even work in chained functions as in this example:
   ```
   @Nullable Object var = new Object();
   if (var != null) {
     someObject.doSth().doChained(var); // checker doesn't understand that var 
is checked for nullness)
   }
   ```
   So it's quite unfriendly. In general I'm really excited about dealing with 
NPE problem, but for now it adds much more complexity and reduces the 
contributor friendliness. But I guess that it's worth it, especially when the 
checker gets smarter and will work with the Guava checks and chained functions 
(if it's even possible?)




----------------------------------------------------------------
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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 511408)
    Time Spent: 32h 40m  (was: 32.5h)

> Add cross-language wrapper for Java's SpannerIO Write
> -----------------------------------------------------
>
>                 Key: BEAM-10139
>                 URL: https://issues.apache.org/jira/browse/BEAM-10139
>             Project: Beam
>          Issue Type: Sub-task
>          Components: cross-language, io-java-gcp, io-py-gcp
>    Affects Versions: Not applicable
>            Reporter: Piotr Szuberski
>            Assignee: Piotr Szuberski
>            Priority: P2
>              Labels: portability
>             Fix For: Not applicable
>
>          Time Spent: 32h 40m
>  Remaining Estimate: 0h
>
> Add cross-language wrapper for Java's SpannerIO Write



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to