Member since
03-21-2018
3
Posts
0
Kudos Received
0
Solutions
05-03-2018
09:54 PM
Hi Vitalii, I think you are correct, based on below: https://github.com/cloudera/sqoop/blob/cdh5-1.4.6_5.14.0/src/java/org/apache/sqoop/SqoopOptions.java#L1719-L1721 public void setInputFieldsTerminatedBy(char c) {
this.inputDelimiters.setFieldsTerminatedBy(c);
} https://github.com/cloudera/sqoop/blob/cdh5-1.4.6_5.14.0/src/java/org/apache/sqoop/SqoopOptions.java#L1816-L1818 public void setFieldsTerminatedBy(char c) {
this.outputDelimiters.setFieldsTerminatedBy(c);
} However, I can see that when --direct is used, 1. it calls class DirectMySQLManager: https://github.com/cloudera/sqoop/blob/cdh5-1.4.6_5.14.0/src/java/org/apache/sqoop/manager/DirectMySQLManager.java#L103 public void exportTable(com.cloudera.sqoop.manager.ExportJobContext context)
throws IOException, ExportException {
context.setConnManager(this);
MySQLExportJob exportJob = new MySQLExportJob(context);
exportJob.runExport();
} 2. in MySQLExportJob class, it actually uses getOutputFieldDelim() function https://github.com/cloudera/sqoop/blob/cdh5-1.4.6_5.14.0/src/java/org/apache/sqoop/mapreduce/MySQLExportJob.java#L57-L58 conf.setInt(MySQLUtils.OUTPUT_FIELD_DELIM_KEY,
options.getOutputFieldDelim()); This explains that we need to use --fields-terminated-by rather than --input-fields-terminated-by. It looks like that it is considered as output for MySQL, as code uses MySQLUtils.OUTPUT_FIELD_DELIM_KEY. I am not sure if it is expected or a bug. I will follow up with our engineering team. Look out for another update sometime next week.
... View more