deniskuzZ commented on code in PR #3718:
URL: https://github.com/apache/hive/pull/3718#discussion_r1803825110


##########
serde/src/java/org/apache/hadoop/hive/serde2/OpenCSVSerde.java:
##########
@@ -178,19 +185,26 @@ public Object deserialize(final Writable blob) throws 
SerDeException {
   private CSVReader newReader(final Reader reader, char separator, char quote, 
char escape) {
     // CSVReader will throw an exception if any of separator, quote, or escape 
is the same, but
     // the CSV format specifies that the escape character and quote char are 
the same... very weird
+    CSVParser parser;
     if (CSVWriter.DEFAULT_ESCAPE_CHARACTER == escape) {
-      return new CSVReader(reader, separator, quote);
+      parser = new CSVParserBuilder()
+          .withSeparator(separator)
+          .withQuoteChar(quote)
+          .build();
     } else {
-      return new CSVReader(reader, separator, quote, escape);
+      parser = new CSVParserBuilder()
+          .withSeparator(separator)
+          .withQuoteChar(quote)
+          .withEscapeChar(escape)
+          .build();
     }
+    return new CSVReaderBuilder(reader)
+        .withCSVParser(parser)
+        .build();
   }
 
   private CSVWriter newWriter(final Writer writer, char separator, char quote, 
char escape) {
-    if (CSVWriter.DEFAULT_ESCAPE_CHARACTER == escape) {
-      return new CSVWriter(writer, separator, quote, "");
-    } else {
-      return new CSVWriter(writer, separator, quote, escape, "");
-    }
+    return new CSVWriter(writer, separator, quote, escape, "");

Review Comment:
   why do we change the escape char handling here, but keep it in a reader?



-- 
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: gitbox-unsubscr...@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to