From fc28544f9dd0ca19c63f8c23fbdd2dd6341dba20 Mon Sep 17 00:00:00 2001 From: herefree <841043203@qq.com> Date: Tue, 22 Oct 2024 16:33:11 +0800 Subject: [PATCH] format --- .../org/apache/paimon/hive/HiveFormatTableUtils.java | 4 +++- .../paimon/hive/HiveCatalogFormatTableITCaseBase.java | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveFormatTableUtils.java b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveFormatTableUtils.java index 5b166922a334..dcd0c3c450c6 100644 --- a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveFormatTableUtils.java +++ b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveFormatTableUtils.java @@ -62,7 +62,9 @@ public static FormatTable convertToFormatTable(Table hiveTable) { if (Options.fromMap(options).get(TYPE) == FORMAT_TABLE) { format = Format.valueOf(options.get(FILE_FORMAT.key()).toUpperCase()); if (format.equals(Format.CSV)) { - options.put(FIELD_DELIMITER.key(), serdeInfo.getParameters().getOrDefault(FIELD_DELIM, "\u0001")); + options.put( + FIELD_DELIMITER.key(), + serdeInfo.getParameters().getOrDefault(FIELD_DELIM, "\u0001")); } } else { String serLib = serdeInfo.getSerializationLib().toLowerCase(); diff --git a/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogFormatTableITCaseBase.java b/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogFormatTableITCaseBase.java index 7f5e5962f9e7..cd748c9ac72f 100644 --- a/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogFormatTableITCaseBase.java +++ b/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogFormatTableITCaseBase.java @@ -138,19 +138,23 @@ public void testPartitionTable() throws Exception { @Test public void testFlinkCreateCsvFormatTable() throws Exception { - tEnv.executeSql("CREATE TABLE flink_csv_table (a INT, b STRING) with ('type'='format-table', 'file.format'='csv')").await(); + tEnv.executeSql( + "CREATE TABLE flink_csv_table (a INT, b STRING) with ('type'='format-table', 'file.format'='csv')") + .await(); doTestFormatTable("flink_csv_table"); } @Test public void testFlinkCreateFormatTableWithDelimiter() throws Exception { - tEnv.executeSql("CREATE TABLE flink_csv_table_delimiter (a INT, b STRING) with ('type'='format-table', 'file.format'='csv', 'csv.field-delimiter'=';')"); + tEnv.executeSql( + "CREATE TABLE flink_csv_table_delimiter (a INT, b STRING) with ('type'='format-table', 'file.format'='csv', 'csv.field-delimiter'=';')"); doTestFormatTable("flink_csv_table_delimiter"); } @Test public void testFlinkCreatePartitionTable() throws Exception { - tEnv.executeSql("CREATE TABLE flink_partition_table (a INT,b STRING) PARTITIONED BY (b) with ('type'='format-table', 'file.format'='csv')"); + tEnv.executeSql( + "CREATE TABLE flink_partition_table (a INT,b STRING) PARTITIONED BY (b) with ('type'='format-table', 'file.format'='csv')"); doTestFormatTable("flink_partition_table"); }