Search in sources :

Example 1 with CsvEncoder

use of org.supercsv.encoder.CsvEncoder in project hive by apache.

the class SeparatedValuesOutputFormat method getCsvPreference.

private CsvPreference getCsvPreference() {
    char separator = this.defaultSeparator;
    char quoteChar = DEFAULT_QUOTE_CHAR;
    CsvEncoder encoder;
    if (DSV_OPT_OUTPUT_FORMAT.equals(beeLine.getOpts().getOutputFormat())) {
        separator = beeLine.getOpts().getDelimiterForDSV();
    }
    if (isQuotingDisabled()) {
        quoteChar = '\0';
        encoder = new SelectiveCsvEncoder();
    } else {
        encoder = new DefaultCsvEncoder();
    }
    return new CsvPreference.Builder(quoteChar, separator, StringUtils.EMPTY).useEncoder(encoder).build();
}
Also used : SelectiveCsvEncoder(org.supercsv.encoder.SelectiveCsvEncoder) DefaultCsvEncoder(org.supercsv.encoder.DefaultCsvEncoder) CsvEncoder(org.supercsv.encoder.CsvEncoder) DefaultCsvEncoder(org.supercsv.encoder.DefaultCsvEncoder) SelectiveCsvEncoder(org.supercsv.encoder.SelectiveCsvEncoder)

Aggregations

CsvEncoder (org.supercsv.encoder.CsvEncoder)1 DefaultCsvEncoder (org.supercsv.encoder.DefaultCsvEncoder)1 SelectiveCsvEncoder (org.supercsv.encoder.SelectiveCsvEncoder)1