當前位置: 首頁>>代碼示例>>Java>>正文


Java UpdateMode類代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:26,代碼來源:ExportTool.java

示例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);
  }
}
 
開發者ID:infinidb,項目名稱:sqoop,代碼行數:23,代碼來源:ExportTool.java

示例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);
    }
  }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:16,代碼來源:ExportTool.java

示例4: getUpdateMode

import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
/**
 * @return how to handle new rows found in update export.
 */
public UpdateMode getUpdateMode() {
  return updateMode;
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:7,代碼來源:SqoopOptions.java

示例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;
}
 
開發者ID:unicredit,項目名稱:zSqoop,代碼行數:69,代碼來源:SqoopOptions.java

示例6: getUpdateMode

import com.cloudera.sqoop.SqoopOptions.UpdateMode; //導入依賴的package包/類
/**
 * @return how to handle new rows found in update export.
 */
public UpdateMode getUpdateMode() {
	return updateMode;
}
 
開發者ID:unicredit,項目名稱:zSqoop,代碼行數:7,代碼來源:SqoopOptions.java

示例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;
}
 
開發者ID:infinidb,項目名稱:sqoop,代碼行數:65,代碼來源:SqoopOptions.java

示例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;
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:8,代碼來源:SqoopOptions.java

示例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;
}
 
開發者ID:unicredit,項目名稱:zSqoop,代碼行數:8,代碼來源:SqoopOptions.java


注:本文中的com.cloudera.sqoop.SqoopOptions.UpdateMode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。