-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HIVE-20917: Support applyQuotesToAll option in OpenCSVSerde. #3718
base: master
Are you sure you want to change the base?
Conversation
OpenCSV version 3.10 added an option called "applyQuotesToAll." When set to false, output columns were not quoted unless they needed it. This commit adds support for that option in OpenCSVSerde and also updates the support for OpenCSV version 5.7.1, which is the current version at the time of this commit. This commit is based on a patch from Sungwoo Park <[email protected]>, which was based on a patch from David Engel <[email protected]>.
@check-spelling-bot Report🔴 Please reviewSee the files view or the action log for details. Unrecognized words (1)APPLYQUOTESTOALL Previously acknowledged words that are now absentaarry bytecode timestamplocal yyyyTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the [email protected]:gigem/hive.git repository
If the flagged items do not appear to be textIf items relate to a ...
|
Kudos, SonarCloud Quality Gate passed! |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@deniskuzZ @ayushtkn Hello. can we reopen this? |
@@ -90,6 +95,8 @@ public void initialize(Configuration configuration, Properties tableProperties, | |||
separatorChar = getProperty(properties, SEPARATORCHAR, CSVWriter.DEFAULT_SEPARATOR); | |||
quoteChar = getProperty(properties, QUOTECHAR, CSVWriter.DEFAULT_QUOTE_CHARACTER); | |||
escapeChar = getProperty(properties, ESCAPECHAR, CSVWriter.DEFAULT_ESCAPE_CHARACTER); | |||
String temp = properties.getProperty(APPLYQUOTESTOALL); | |||
applyQuotesToAll = (temp == null || Boolean.parseBoolean(temp)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just inline
applyQuotesToAll = Boolean.parseBoolean(properties.getProperty(APPLYQUOTESTOALL))
} else { | ||
return new CSVReader(reader, separator, quote, escape); | ||
parser = new CSVParserBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid duplication by creating a builder var or using ternary operator? the only diff here is the missing escape char setup
} else { | ||
return new CSVWriter(writer, separator, quote, escape, ""); | ||
} | ||
return new CSVWriter(writer, separator, quote, escape, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we change the escape char handling here, but keep it in a reader?
OpenCSV version 3.10 added an option called "applyQuotesToAll." When set to false, output columns were not quoted unless they needed it. This commit adds support for that option in OpenCSVSerde and also updates the support for OpenCSV version 5.7.1, which is the current version at the time of this commit. This commit is based on a patch from Sungwoo Park [email protected], which was based on a patch from David Engel [email protected].
What changes were proposed in this pull request?
Why are the changes needed?
Does this PR introduce any user-facing change?
How was this patch tested?