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


Java UpdateMode.UpdateOnly方法代碼示例

本文整理匯總了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);
  }
}
 
開發者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: 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

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


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