chrismgrayftsinc commented on a change in pull request #15566:
URL: https://github.com/apache/beam/pull/15566#discussion_r715220959



##########
File path: 
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/SchemaUtil.java
##########
@@ -351,7 +351,12 @@ private BeamRowMapper(Schema schema, 
List<ResultSetFieldExtractor> fieldExtracto
     public Row mapRow(ResultSet rs) throws Exception {
       Row.Builder rowBuilder = Row.withSchema(schema);
       for (int i = 0; i < schema.getFieldCount(); i++) {
-        rowBuilder.addValue(fieldExtractors.get(i).extract(rs, i + 1));
+        Object value = fieldExtractors.get(i).extract(rs, i + 1);
+        if (rs.wasNull() && schema.getField(i).getType().getNullable()) {
+          rowBuilder.addValue(null);
+        } else {
+          rowBuilder.addValue(value);

Review comment:
       Either way seems valid to me.  The current code seems more 
backward-compatible, but I'm happy with either.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to