本文整理匯總了Java中com.cloudera.sqoop.SqoopOptions.UpdateMode.UpdateOnly方法的典型用法代碼示例。如果您正苦於以下問題:Java UpdateMode.UpdateOnly方法的具體用法?Java UpdateMode.UpdateOnly怎麽用?Java UpdateMode.UpdateOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.cloudera.sqoop.SqoopOptions.UpdateMode
的用法示例。
在下文中一共展示了UpdateMode.UpdateOnly方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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;
}
示例4: 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;
}