@Test public void testInitCsvImportJob() throws IOException { Configuration conf = new Configuration(); char delimiter = '\001'; char quote = '\002'; char escape = '!'; CsvBulkImportUtil.initCsvImportJob(conf, delimiter, quote, escape, null, null); File tempFile = File.createTempFile("test-config", ".xml"); FileOutputStream fileOutputStream = new FileOutputStream(tempFile); conf.writeXml(fileOutputStream); fileOutputStream.close(); Configuration deserialized = new Configuration(); deserialized.addResource(new FileInputStream(tempFile)); assertEquals(Character.valueOf('\001'), CsvBulkImportUtil.getCharacter(deserialized, CsvToKeyValueMapper.FIELD_DELIMITER_CONFKEY)); assertEquals(Character.valueOf('\002'), CsvBulkImportUtil.getCharacter(deserialized, CsvToKeyValueMapper.QUOTE_CHAR_CONFKEY)); assertEquals(Character.valueOf('!'), CsvBulkImportUtil.getCharacter(deserialized, CsvToKeyValueMapper.ESCAPE_CHAR_CONFKEY)); assertNull(deserialized.get(CsvToKeyValueMapper.ARRAY_DELIMITER_CONFKEY)); tempFile.delete(); }
public static void initCsvImportJob(Configuration conf, char fieldDelimiter, char quoteChar, char escapeChar, String arrayDelimiter, String binaryEncoding) { setChar(conf, CsvToKeyValueMapper.FIELD_DELIMITER_CONFKEY, fieldDelimiter); setChar(conf, CsvToKeyValueMapper.QUOTE_CHAR_CONFKEY, quoteChar); setChar(conf, CsvToKeyValueMapper.ESCAPE_CHAR_CONFKEY, escapeChar); if (arrayDelimiter != null) { conf.set(CsvToKeyValueMapper.ARRAY_DELIMITER_CONFKEY, arrayDelimiter); } if(binaryEncoding!=null){ conf.set(QueryServices.UPLOAD_BINARY_DATA_TYPE_ENCODING, binaryEncoding); } }
CsvBulkImportUtil { public static void initCsvImportJob(Configuration conf, char fieldDelimiter, char quoteChar, char escapeChar, String arrayDelimiter, String binaryEncoding) { setChar(conf, CsvToKeyValueMapper.FIELD_DELIMITER_CONFKEY, fieldDelimiter); setChar(conf, CsvToKeyValueMapper.QUOTE_CHAR_CONFKEY, quoteChar); setChar(conf, CsvToKeyValueMapper.ESCAPE_CHAR_CONFKEY, escapeChar); if (arrayDelimiter != null) { conf.set(CsvToKeyValueMapper.ARRAY_DELIMITER_CONFKEY, arrayDelimiter); } if(binaryEncoding!=null){ conf.set(QueryServices.UPLOAD_BINARY_DATA_TYPE_ENCODING, binaryEncoding); } } }
CsvBulkImportUtil { public static void initCsvImportJob(Configuration conf, char fieldDelimiter, char quoteChar, char escapeChar, String arrayDelimiter, String binaryEncoding) { setChar(conf, CsvToKeyValueMapper.FIELD_DELIMITER_CONFKEY, fieldDelimiter); setChar(conf, CsvToKeyValueMapper.QUOTE_CHAR_CONFKEY, quoteChar); setChar(conf, CsvToKeyValueMapper.ESCAPE_CHAR_CONFKEY, escapeChar); if (arrayDelimiter != null) { conf.set(CsvToKeyValueMapper.ARRAY_DELIMITER_CONFKEY, arrayDelimiter); } if(binaryEncoding!=null){ conf.set(QueryServices.UPLOAD_BINARY_DATA_TYPE_ENCODING, binaryEncoding); } }  }
CsvBulkImportUtil { public static void initCsvImportJob(Configuration conf, char fieldDelimiter, char quoteChar, char escapeChar, String arrayDelimiter, String binaryEncoding) { setChar(conf, CsvToKeyValueMapper.FIELD_DELIMITER_CONFKEY, fieldDelimiter); setChar(conf, CsvToKeyValueMapper.QUOTE_CHAR_CONFKEY, quoteChar); setChar(conf, CsvToKeyValueMapper.ESCAPE_CHAR_CONFKEY, escapeChar); if (arrayDelimiter != null) { conf.set(CsvToKeyValueMapper.ARRAY_DELIMITER_CONFKEY, arrayDelimiter); } if(binaryEncoding!=null){ conf.set(QueryServices.UPLOAD_BINARY_DATA_TYPE_ENCODING, binaryEncoding); } }  static void initCsvImportJob(Configuration conf, char fieldDelimiter, char quoteChar,
            char escapeChar, String arrayDelimiter, String binaryEncoding); static void configurePreUpsertProcessor(Configuration conf,
            Class<? extends ImportPreUpsertKeyValueProcessor> processorClass); static Path getOutputPath(Path outputdir, String tableName); }
CsvBulkImportUtil { public static void initCsvImportJob(Configuration conf, char fieldDelimiter, char quoteChar, char escapeChar, String arrayDelimiter, String binaryEncoding) { setChar(conf, CsvToKeyValueMapper.FIELD_DELIMITER_CONFKEY, fieldDelimiter); setChar(conf, CsvToKeyValueMapper.QUOTE_CHAR_CONFKEY, quoteChar); setChar(conf, CsvToKeyValueMapper.ESCAPE_CHAR_CONFKEY, escapeChar); if (arrayDelimiter != null) { conf.set(CsvToKeyValueMapper.ARRAY_DELIMITER_CONFKEY, arrayDelimiter); } if(binaryEncoding!=null){ conf.set(QueryServices.UPLOAD_BINARY_DATA_TYPE_ENCODING, binaryEncoding); } }  static void initCsvImportJob(Configuration conf, char fieldDelimiter, char quoteChar,
            char escapeChar, String arrayDelimiter, String binaryEncoding); static void configurePreUpsertProcessor(Configuration conf,
            Class<? extends ImportPreUpsertKeyValueProcessor> processorClass); static Path getOutputPath(Path outputdir, String tableName);  }