wombatu-kun commented on code in PR #16746:
URL: https://github.com/apache/iceberg/pull/16746#discussion_r3408219479


##########
aws/src/test/java/org/apache/iceberg/aws/glue/TestIcebergToGlueConverter.java:
##########
@@ -384,4 +384,51 @@ public void 
testSetTableInputInformationWithExistingTable() {
         .as("Columns should match")
         .isEqualTo(expectedTableInput.storageDescriptor().columns());
   }
+
+  @Test
+  public void testSetColumnCommentTruncation() {
+    TableInput.Builder actualTableInputBuilder = TableInput.builder();
+    Schema schema =
+        new Schema(Types.NestedField.required(1, "x", Types.StringType.get(), 
"a".repeat(256)));
+    TableMetadata tableMetadata =
+        TableMetadata.newTableMetadata(
+            schema, PartitionSpec.unpartitioned(), "s3://test", 
ImmutableMap.of());
+
+    IcebergToGlueConverter.setTableInputInformation(actualTableInputBuilder, 
tableMetadata);
+    TableInput actualTableInput = actualTableInputBuilder.build();
+
+    assertThat(actualTableInput.storageDescriptor().columns().get(0).comment())
+        .as("Column comment should be truncated")
+        .hasSize(IcebergToGlueConverter.GLUE_COLUMN_COMMENT_MAX_LENGTH);
+  }
+
+  @Test
+  public void testSetColumnCommentTruncationWithExistingTable() {
+    // Actual TableInput
+    TableInput.Builder actualTableInputBuilder = TableInput.builder();
+    Schema schema =
+        new Schema(Types.NestedField.required(1, "x", Types.StringType.get(), 
"a".repeat(256)));

Review Comment:
   This test does not exercise the existing-table branch it advertises: field 
`x` is given a 256-char doc, so `addColumnWithDedupe` takes the `field.doc()` 
path (`IcebergToGlueConverter.java:382`) and never reaches the 
`existingColumnMap` fallback at `:384`. The assertion passes on the doc 
truncation alone - reverting only the `:384` change would leave this test 
green. To cover the existing-comment path, drop the field doc 
(`Types.StringType.get()` with no doc) and set the existing column's comment to 
a 256-char string.



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

Reply via email to