ahmedabu98 commented on code in PR #26873:
URL: https://github.com/apache/beam/pull/26873#discussion_r1207196178


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -694,7 +694,16 @@ public static Row toBeamRow(Schema rowSchema, TableSchema 
bqSchema, TableRow jso
     if (jsonBQValue instanceof List) {
       return ((List<Object>) jsonBQValue)
           .stream()
-              .map(v -> ((Map<String, Object>) v).get("v"))
+              .map(
+                  v -> {
+                    if (v instanceof Map) {
+                      Map<String, Object> m = (Map<String, Object>) v;
+                      if (m.size() == 1 && m.containsKey("v")) {
+                        return m.get("v");
+                      }
+                    }
+                    return v;
+                  })

Review Comment:
   Users can set this option to get results without flattening:
   
https://github.com/apache/beam/blob/6865eefac5633198c71fd1ec75b514e8a390d002/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java#L823
   
   A test for List<Map<>> should be added at some point, but let's not block 
this PR for that



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