This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new a8931fe0a5 [hive] Strip newline characters from Glue column comments
(#8918)
a8931fe0a5 is described below
commit a8931fe0a545da06364f864607fb07733d39c042
Author: 0dunay0 <[email protected]>
AuthorDate: Thu Jul 30 06:20:10 2026 -0500
[hive] Strip newline characters from Glue column comments (#8918)
---
.../org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java | 8 +++++++-
.../apache/paimon/iceberg/IcebergHiveMetadataCommitterTest.java | 9 +++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git
a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java
b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java
index 60f2016070..aa9b3a229e 100644
---
a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java
+++
b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java
@@ -271,7 +271,13 @@ public class IcebergHiveMetadataCommitter implements
IcebergMetadataCommitter {
@VisibleForTesting
static String normalizeColumnComment(@Nullable String comment) {
- if (comment == null || comment.length() <=
HIVE_COLUMN_COMMENT_MAX_LENGTH) {
+ if (comment == null) {
+ return comment;
+ }
+
+ comment = comment.replace('\n', ' ').replace('\r', ' ');
+
+ if (comment.length() <= HIVE_COLUMN_COMMENT_MAX_LENGTH) {
return comment;
}
diff --git
a/paimon-hive/paimon-hive-catalog/src/test/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitterTest.java
b/paimon-hive/paimon-hive-catalog/src/test/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitterTest.java
index e7559e6ea4..9ec9afdb1b 100644
---
a/paimon-hive/paimon-hive-catalog/src/test/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitterTest.java
+++
b/paimon-hive/paimon-hive-catalog/src/test/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitterTest.java
@@ -39,6 +39,15 @@ class IcebergHiveMetadataCommitterTest {
assertThat(IcebergHiveMetadataCommitter.normalizeColumnComment(longComment))
.hasSize(255)
.isEqualTo(repeat('b', 252) + "...");
+
+
assertThat(IcebergHiveMetadataCommitter.normalizeColumnComment("line1\nline2\r\nline3"))
+ .isEqualTo("line1 line2 line3");
+
+ assertThat(
+ IcebergHiveMetadataCommitter.normalizeColumnComment(
+ "first\n" + repeat('c', 253)))
+ .hasSize(255)
+ .endsWith("...");
}
private static String repeat(char c, int count) {