deniskuzZ commented on code in PR #3718:
URL: https://github.com/apache/hive/pull/3718#discussion_r1803823943
##########
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()
Review Comment:
can we avoid duplication by creating a builder var or using ternary
operator? the only diff here is the missing escape char setup
--
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]