mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 02:52:19 +08:00
SQOOP-820: Escape table name in export job only if it's required by connector
(Jarek Jarcec Cecho via Cheolsoo Park)
This commit is contained in:
parent
7573450e18
commit
b02ddc3975
@ -450,6 +450,16 @@ public String escapeTableName(String tableName) {
|
|||||||
return tableName;
|
return tableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if Sqoop common code should automatically escape table name
|
||||||
|
* when saving it to mapreduce configuration object when during export.
|
||||||
|
*
|
||||||
|
* @return True if table name should be escaped
|
||||||
|
*/
|
||||||
|
public boolean escapeTableNameOnExport() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform any shutdown operations on the connection.
|
* Perform any shutdown operations on the connection.
|
||||||
*/
|
*/
|
||||||
|
@ -81,6 +81,11 @@ public String escapeTableName(String tableName) {
|
|||||||
return escapeIdentifier(tableName);
|
return escapeIdentifier(tableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean escapeTableNameOnExport() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected String escapeIdentifier(String identifier) {
|
protected String escapeIdentifier(String identifier) {
|
||||||
if (identifier == null) {
|
if (identifier == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -157,6 +157,11 @@ public String escapeTableName(String tableName) {
|
|||||||
return escapeObjectName(tableName);
|
return escapeObjectName(tableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean escapeTableNameOnExport() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escape database object name (database, table, column, schema).
|
* Escape database object name (database, table, column, schema).
|
||||||
*
|
*
|
||||||
|
@ -129,7 +129,12 @@ protected void configureOutputFormat(Job job, String tableName,
|
|||||||
if (null == colNames) {
|
if (null == colNames) {
|
||||||
colNames = mgr.getColumnNames(tableName);
|
colNames = mgr.getColumnNames(tableName);
|
||||||
}
|
}
|
||||||
DBOutputFormat.setOutput(job, mgr.escapeTableName(tableName), colNames);
|
|
||||||
|
if (mgr.escapeTableNameOnExport()) {
|
||||||
|
DBOutputFormat.setOutput(job, mgr.escapeTableName(tableName), colNames);
|
||||||
|
} else {
|
||||||
|
DBOutputFormat.setOutput(job, tableName, colNames);
|
||||||
|
}
|
||||||
|
|
||||||
job.setOutputFormatClass(getOutputFormatClass());
|
job.setOutputFormatClass(getOutputFormatClass());
|
||||||
job.getConfiguration().set(SQOOP_EXPORT_TABLE_CLASS_KEY, tableClassName);
|
job.getConfiguration().set(SQOOP_EXPORT_TABLE_CLASS_KEY, tableClassName);
|
||||||
|
Loading…
Reference in New Issue
Block a user