ahmedabu98 commented on code in PR #17492:
URL: https://github.com/apache/beam/pull/17492#discussion_r863990806
##########
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:
[BigQuery
docs](https://cloud.google.com/bigquery/docs/nested-repeated#limitations) show
that the limit is 15 nested structs. If the user sticks to the BigQuery
guidelines it shouldn't be a problem.
Ofc this doesn't stop the user from making a mistake. Do you think it's
necessary for us to handle that 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]