in client/migrationx/migrationx-transformer/src/main/java/com/aliyun/dataworks/migrationx/transformer/core/sqoop/ExportTool.java [183:224]
protected void validateExportOptions(SqoopOptions options) throws InvalidOptionsException {
if (options.getTableName() == null && options.getCall() == null) {
throw new InvalidOptionsException("Export requires a --table or a --call argument." + HELP_STR);
} else if (options.getExportDir() == null && options.getHCatTableName() == null) {
throw new InvalidOptionsException(
"Export requires an --export-dir argument or " + "--hcatalog-table argument." + HELP_STR);
} else if (options.getExistingJarName() != null && options.getClassName() == null) {
throw new InvalidOptionsException(
"Jar specified with --jar-file, but no " + "class specified with --class-name." + HELP_STR);
} else if (options.getExistingJarName() != null && options.getUpdateKeyCol() != null) {
// We need to regenerate the class with the output column order set
// correctly for the update-based export. So we can't use a premade
// class.
throw new InvalidOptionsException(
"Jar cannot be specified with " + "--jar-file when export is running in update mode.");
} else if (options.getStagingTableName() != null && options.getUpdateKeyCol() != null) {
// Staging table may not be used when export is running in update mode
throw new InvalidOptionsException(
"Staging table cannot be used when " + "export is running in update mode.");
} else if (options.getStagingTableName() != null
&& options.getStagingTableName().equalsIgnoreCase(options.getTableName())) {
// Name of staging table and destination table cannot be the same
throw new InvalidOptionsException("Staging table cannot be the same as "
+ "the destination table. Name comparison used is case-insensitive.");
} else if (options.doClearStagingTable() && options.getStagingTableName() == null) {
// Option to clear staging table specified but not the staging table name
throw new InvalidOptionsException(
"Option to clear the staging table is " + "specified but the staging table name is not.");
} else if (options.getCall() != null && options.getStagingTableName() != null) {
// using a stored procedure to insert rows is incompatible with using
// a staging table (as we don't know where the procedure will put the
// data, or what transactions it'll perform)
throw new InvalidOptionsException(
"Option the use a staging table is " + "specified as well as a call option.");
} else if (options.getCall() != null && options.getUpdateKeyCol() != null) {
throw new InvalidOptionsException("Option to call a stored procedure" + "can't be used in update mode.");
} else if (options.getCall() != null && options.getTableName() != null) {
// we don't know if the stored procedure will insert rows into
// a given table
throw new InvalidOptionsException("Can't specify --call and --table.");
}
}