本文整理匯總了Java中com.cloudera.sqoop.SqoopOptions.UpdateMode類的典型用法代碼示例。如果您正苦於以下問題:Java UpdateMode類的具體用法?Java UpdateMode怎麽用?Java UpdateMode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UpdateMode類屬於com.cloudera.sqoop.SqoopOptions包,在下文中一共展示了UpdateMode類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: exportTable
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
private void exportTable(SqoopOptions options, String tableName)
throws ExportException, IOException {
String jarFile = null;
// Generate the ORM code for the tables.
jarFile = codeGenerator.generateORM(options, tableName);
ExportJobContext context = new ExportJobContext(tableName, jarFile,
options);
if (options.getUpdateKeyCol() != null) {
if (options.getUpdateMode() == UpdateMode.UpdateOnly) {
// UPDATE-based export.
manager.updateTable(context);
} else {
// Mixed update/insert export
manager.upsertTable(context);
}
} else if (options.getCall() != null) {
// Stored procedure-based export.
manager.callTable(context);
} else {
// INSERT-based export.
manager.exportTable(context);
}
}
示例2: exportTable
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
private void exportTable(SqoopOptions options, String tableName)
throws ExportException, IOException {
String jarFile = null;
// Generate the ORM code for the tables.
jarFile = codeGenerator.generateORM(options, tableName);
ExportJobContext context = new ExportJobContext(tableName, jarFile,
options);
if (options.getUpdateKeyCol() != null) {
if (options.getUpdateMode() == UpdateMode.UpdateOnly) {
// UPDATE-based export.
manager.updateTable(context);
} else {
// Mixed update/insert export
manager.upsertTable(context);
}
} else {
// INSERT-based export.
manager.exportTable(context);
}
}
示例3: applyNewUpdateOptions
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
private void applyNewUpdateOptions(CommandLine in, SqoopOptions out)
throws InvalidOptionsException {
if (in.hasOption(UPDATE_MODE_ARG)) {
String updateTypeStr = in.getOptionValue(UPDATE_MODE_ARG);
if ("updateonly".equals(updateTypeStr)) {
out.setUpdateMode(UpdateMode.UpdateOnly);
} else if ("allowinsert".equals(updateTypeStr)) {
out.setUpdateMode(UpdateMode.AllowInsert);
} else {
throw new InvalidOptionsException("Unknown new update mode: "
+ updateTypeStr + ". Use 'updateonly' or 'allowinsert'."
+ HELP_STR);
}
}
}
示例4: getUpdateMode
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
/**
* @return how to handle new rows found in update export.
*/
public UpdateMode getUpdateMode() {
return updateMode;
}
示例5: initDefaults
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
private void initDefaults(Configuration baseConfiguration) {
// first, set the true defaults if nothing else happens.
// default action is to run the full pipeline.
this.hadoopMapRedHome = System.getenv("HADOOP_MAPRED_HOME");
this.hiveHome = getHiveHomeDefault();
this.hCatHome = getHCatHomeDefault();
this.inputDelimiters = new DelimiterSet(
DelimiterSet.NULL_CHAR, DelimiterSet.NULL_CHAR,
DelimiterSet.NULL_CHAR, DelimiterSet.NULL_CHAR, false);
this.outputDelimiters = new DelimiterSet();
// Set this to cwd, but -Dsqoop.src.dir can override.
this.codeOutputDir = System.getProperty("sqoop.src.dir", ".");
String myTmpDir = System.getProperty("test.build.data", "/tmp/");
if (!myTmpDir.endsWith(File.separator)) {
myTmpDir = myTmpDir + File.separator;
}
this.tmpDir = myTmpDir;
String localUsername = System.getProperty("user.name", "unknown");
this.jarOutputDir = getNonceJarDir(tmpDir + "sqoop-" + localUsername
+ "/compile");
this.jarDirIsAuto = true;
this.layout = FileLayout.TextFile;
this.areOutputDelimsManuallySet = false;
this.areInputDelimsManuallySet = false;
this.numMappers = DEFAULT_NUM_MAPPERS;
this.useCompression = false;
this.compressionCodec = null;
this.directSplitSize = 0;
this.maxInlineLobSize = LargeObjectLoader.DEFAULT_MAX_LOB_LENGTH;
// Don't set a default value for fetchsize. This allows a JDBCManager to
// provide a database-specific default, if no value is provided by the
// user.
this.fetchSize = null;
if (null == baseConfiguration) {
this.conf = new Configuration();
} else {
this.conf = baseConfiguration;
}
this.extraArgs = null;
this.dbOutColumns = null;
this.incrementalMode = IncrementalMode.None;
this.updateMode = UpdateMode.UpdateOnly;
// Creating instances for user specific mapping
this.mapColumnHive = new Properties();
this.mapColumnJava = new Properties();
// We do not want to be verbose too much if not explicitly needed
this.verbose = false;
this.isValidationEnabled = false; // validation is disabled by default
this.validatorClass = RowCountValidator.class;
this.validationThresholdClass = AbsoluteValidationThreshold.class;
this.validationFailureHandlerClass = AbortOnFailureHandler.class;
}
示例6: getUpdateMode
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
/**
* @return how to handle new rows found in update export.
*/
public UpdateMode getUpdateMode() {
return updateMode;
}
示例7: initDefaults
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
private void initDefaults(Configuration baseConfiguration) {
// first, set the true defaults if nothing else happens.
// default action is to run the full pipeline.
this.hadoopHome = System.getenv("HADOOP_HOME");
// Set this with $HIVE_HOME, but -Dhive.home can override.
this.hiveHome = System.getenv("HIVE_HOME");
this.hiveHome = System.getProperty("hive.home", this.hiveHome);
this.inputDelimiters = new DelimiterSet(
DelimiterSet.NULL_CHAR, DelimiterSet.NULL_CHAR,
DelimiterSet.NULL_CHAR, DelimiterSet.NULL_CHAR, false);
this.outputDelimiters = new DelimiterSet();
// Set this to cwd, but -Dsqoop.src.dir can override.
this.codeOutputDir = System.getProperty("sqoop.src.dir", ".");
String myTmpDir = System.getProperty("test.build.data", "/tmp/");
if (!myTmpDir.endsWith(File.separator)) {
myTmpDir = myTmpDir + File.separator;
}
this.tmpDir = myTmpDir;
String localUsername = System.getProperty("user.name", "unknown");
this.jarOutputDir = getNonceJarDir(tmpDir + "sqoop-" + localUsername
+ "/compile");
this.jarDirIsAuto = true;
this.layout = FileLayout.TextFile;
this.areDelimsManuallySet = false;
this.numMappers = DEFAULT_NUM_MAPPERS;
this.useCompression = false;
this.compressionCodec = null;
this.directSplitSize = 0;
this.maxInlineLobSize = LargeObjectLoader.DEFAULT_MAX_LOB_LENGTH;
// Don't set a default value for fetchsize. This allows a JDBCManager to
// provide a database-specific default, if no value is provided by the
// user.
this.fetchSize = null;
if (null == baseConfiguration) {
this.conf = new Configuration();
} else {
this.conf = baseConfiguration;
}
this.extraArgs = null;
this.dbOutColumns = null;
this.incrementalMode = IncrementalMode.None;
this.updateMode = UpdateMode.UpdateOnly;
// Creating instances for user specific mapping
this.mapColumnHive = new Properties();
this.mapColumnJava = new Properties();
// We do not want to be verbose too much if not explicitly needed
this.verbose = false;
}
示例8: setUpdateMode
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
/**
* Set "UpdateOnly" to silently ignore new rows during update export.
* Set "AllowInsert" to insert new rows during update export.
*/
public void setUpdateMode(UpdateMode mode) {
this.updateMode = mode;
}
示例9: setUpdateMode
import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
/**
* Set "UpdateOnly" to silently ignore new rows during update export.
* Set "AllowInsert" to insert new rows during update export.
*/
public void setUpdateMode(UpdateMode mode) {
this.updateMode = mode;
}