derrickaw commented on code in PR #35567:
URL: https://github.com/apache/beam/pull/35567#discussion_r2209091758


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImpl.java:
##########
@@ -1317,6 +1364,79 @@ <T> long insertAll(
       }
     }
 
+    /**
+     * Formats a {@link TableRow} for logging, comparing the provided row 
against a BigQuery schema.
+     * The formatted string shows the type of each field in the row, and 
indicates any mismatches
+     * between the row's types and the schema's expected types.
+     *
+     * <p>For example, a {@link TableRow} with a "name" (String) and "age" 
(Integer) field, where
+     * the schema expects a String and Integer respectively, would be 
formatted as:
+     *
+     * <pre>{@code {'name': java.lang.String, 'age': java.lang.Integer}}</pre>
+     *
+     * <p>If a field exists in the row but not in the schema, it's marked as 
"Unknown field". If a
+     * field's type doesn't match the schema, it's shown as "Provided: X, 
Expected: Y".
+     *
+     * @param row The {@link TableRow} to format.
+     * @param bqSchemaMap A map of field names to their expected BigQuery 
types (e.g., "STRING",
+     *     "INTEGER").
+     * @return A string representation of the row, indicating the type of each 
field and any schema
+     *     mismatches.
+     */
+    private String formatRowWithSchema(TableRow row, Map<String, String> 
bqSchemaMap) {

Review Comment:
   Good point.  Maybe I just remove the comparison for now and only concentrate 
on the field names and leave it up to the user to figure out from there for now?



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to