wombatu-kun commented on code in PR #16746:
URL: https://github.com/apache/iceberg/pull/16746#discussion_r3408235595
##########
aws/src/main/java/org/apache/iceberg/aws/glue/IcebergToGlueConverter.java:
##########
@@ -378,13 +379,28 @@ private static void addColumnWithDedupe(
ICEBERG_FIELD_CURRENT, Boolean.toString(isCurrent)));
if (field.doc() != null && !field.doc().isEmpty()) {
- builder.comment(field.doc());
+ builder.comment(truncateColumnComment(field.doc()));
} else if (existingColumnMap != null &&
existingColumnMap.containsKey(field.name())) {
- builder.comment(existingColumnMap.get(field.name()));
+
builder.comment(truncateColumnComment(existingColumnMap.get(field.name())));
}
columns.add(builder.build());
dedupe.add(field.name());
}
}
+
+ private static String truncateColumnComment(String comment) {
+ if (comment == null) {
+ return null;
+ }
+
+ if (comment.length() <= GLUE_COLUMN_COMMENT_MAX_LENGTH) {
+ return comment;
+ }
+
+ LOG.warn(
Review Comment:
This warning does not say which column was truncated or by how much, so on a
wide schema an operator cannot tell what lost data. Consider threading the
field name into the helper and logging it with the original length, e.g.
`LOG.warn("Truncating comment for column {} from {} to Glue's maximum {}
characters", name, comment.length(), GLUE_COLUMN_COMMENT_MAX_LENGTH)`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]