You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "herefree (via GitHub)" <gi...@apache.org> on 2024/10/22 08:30:07 UTC

[PR] [hive] Support create formatTable set csv.field-delimiter [paimon]

herefree opened a new pull request, #4360:
URL: https://github.com/apache/paimon/pull/4360

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
   
   ### Purpose
   I found that when using flink to create a format table, flink will throw an exception when reading the format table. This is due to the fact that the field-delimiter of the hive table is not specified. This pr is to support setting csv.field-delimiter.
   <!-- Linking this pull request to the issue -->
   Linked issue: close #xxx
   
   <!-- What is the purpose of the change -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [hive] Support create formatTable set csv.field-delimiter [paimon]

Posted by "wwj6591812 (via GitHub)" <gi...@apache.org>.
wwj6591812 commented on code in PR #4360:
URL: https://github.com/apache/paimon/pull/4360#discussion_r1810623190


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveFormatTableUtils.java:
##########
@@ -58,11 +58,15 @@ public static FormatTable convertToFormatTable(Table hiveTable) {
         String comment = options.remove(COMMENT_PROP);
         String location = hiveTable.getSd().getLocation();
         Format format;
+        SerDeInfo serdeInfo = hiveTable.getSd().getSerdeInfo();
         if (Options.fromMap(options).get(TYPE) == FORMAT_TABLE) {
             format = Format.valueOf(options.get(FILE_FORMAT.key()).toUpperCase());
-            // field delimiter for csv leaves untouched
+            if (format.equals(Format.CSV)) {
+                options.put(
+                        FIELD_DELIMITER.key(),
+                        serdeInfo.getParameters().getOrDefault(FIELD_DELIM, "\u0001"));

Review Comment:
   serdeInfo.getParameters() may null?



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [hive] Support create formatTable set csv.field-delimiter [paimon]

Posted by "wwj6591812 (via GitHub)" <gi...@apache.org>.
wwj6591812 commented on code in PR #4360:
URL: https://github.com/apache/paimon/pull/4360#discussion_r1810623190


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveFormatTableUtils.java:
##########
@@ -58,11 +58,15 @@ public static FormatTable convertToFormatTable(Table hiveTable) {
         String comment = options.remove(COMMENT_PROP);
         String location = hiveTable.getSd().getLocation();
         Format format;
+        SerDeInfo serdeInfo = hiveTable.getSd().getSerdeInfo();
         if (Options.fromMap(options).get(TYPE) == FORMAT_TABLE) {
             format = Format.valueOf(options.get(FILE_FORMAT.key()).toUpperCase());
-            // field delimiter for csv leaves untouched
+            if (format.equals(Format.CSV)) {
+                options.put(
+                        FIELD_DELIMITER.key(),
+                        serdeInfo.getParameters().getOrDefault(FIELD_DELIM, "\u0001"));

Review Comment:
   serdeInfo.getParameters() may null?



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [hive] Support create formatTable set csv.field-delimiter [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #4360:
URL: https://github.com/apache/paimon/pull/4360


-- 
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: issues-unsubscribe@paimon.apache.org

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