johnjcasey commented on code in PR #17492:
URL: https://github.com/apache/beam/pull/17492#discussion_r863984188


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java:
##########
@@ -3002,6 +3004,25 @@ private <DestinationT> WriteResult continueExpandTyped(
       }
     }
 
+    private void validateNoJsonTypeInSchema(JSONObject schema) {
+      JSONArray fields = schema.getJSONArray("fields");
+
+      for (int i = 0; i < fields.length(); i++) {
+        JSONObject field = fields.getJSONObject(i);
+        checkArgument(
+            !field.getString("type").equals("JSON"),
+            "Found JSON type in TableSchema. JSON data insertion is currently "
+                + "not supported with 'FILE_LOADS' write method. This is 
supported with the "
+                + "other write methods, however. For more information, visit: "
+                + 
"https://cloud.google.com/bigquery/docs/reference/standard-sql/";
+                + "json-data#ingest_json_data");
+
+        if (field.getString("type").equals("STRUCT")) {
+          validateNoJsonTypeInSchema(field);

Review Comment:
   Looks basically good. Are we at all concerned with recursion depth here?



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