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


Java DBInputSplit類代碼示例

本文整理匯總了Java中com.cloudera.sqoop.mapreduce.db.DBInputFormat.DBInputSplit的典型用法代碼示例。如果您正苦於以下問題:Java DBInputSplit類的具體用法?Java DBInputSplit怎麽用?Java DBInputSplit使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DBInputSplit類屬於com.cloudera.sqoop.mapreduce.db.DBInputFormat包,在下文中一共展示了DBInputSplit類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: castSplit

import com.cloudera.sqoop.mapreduce.db.DBInputFormat.DBInputSplit; //導入依賴的package包/類
public static OraOopDBInputSplit castSplit(DBInputSplit split) {

    // Check there's a split available...
    if (split == null) {
      throw new IllegalArgumentException("The DBInputSplit cannot be null.");
    }

    // Check that the split is the correct type...
    Class<?> desiredSplitClass = OraOopDBInputSplit.class;
    if (!(split.getClass() == desiredSplitClass)) {
      String errMsg =
          String.format("The type of Split available within %s "
              + "should be an instance of class %s, "
              + "but is actually an instance of class %s", OraOopUtilities
              .getCurrentMethodName(), desiredSplitClass.getName(), split
              .getClass().getName());
      throw new RuntimeException(errMsg);
    }

    // TODO Cast this using desiredSplitClass, so we only need 1 line of code
    // that
    // identifies the type of the split class...
    // inputSplit = (desiredSplitClass)this.getSplit();
    return (OraOopDBInputSplit) split;
  }
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:26,代碼來源:OraOopDBRecordReader.java

示例2: createDBRecordReader

import com.cloudera.sqoop.mapreduce.db.DBInputFormat.DBInputSplit; //導入依賴的package包/類
@Override
protected RecordReader<LongWritable, T> createDBRecordReader(
    DBInputSplit split, Configuration conf) throws IOException {

  DBConfiguration dbConf = getDBConf();
  @SuppressWarnings("unchecked")
  Class<T> inputClass = (Class<T>) (dbConf.getInputClass());

  try {
    // Use Oracle-specific db reader
    return new OracleDataDrivenDBRecordReader<T>(split, inputClass,
        conf, getConnection(), dbConf, dbConf.getInputConditions(),
        dbConf.getInputFieldNames(), dbConf.getInputTableName());
  } catch (SQLException ex) {
    throw new IOException(ex);
  }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:18,代碼來源:OracleDataDrivenDBInputFormat.java

示例3: createDBRecordReader

import com.cloudera.sqoop.mapreduce.db.DBInputFormat.DBInputSplit; //導入依賴的package包/類
protected RecordReader<LongWritable, T> createDBRecordReader(
    DBInputSplit split, Configuration conf) throws IOException {

  DBConfiguration dbConf = getDBConf();
  @SuppressWarnings("unchecked")
  Class<T> inputClass = (Class<T>) (dbConf.getInputClass());
  String dbProductName = getDBProductName();

  LOG.debug("Creating db record reader for db product: " + dbProductName);

  try {
    return new DataDrivenDBRecordReader<T>(split, inputClass,
        conf, getConnection(), dbConf, dbConf.getInputConditions(),
        dbConf.getInputFieldNames(), dbConf.getInputTableName(),
        dbProductName);
  } catch (SQLException ex) {
    throw new IOException(ex);
  }
}
 
開發者ID:unicredit,項目名稱:zSqoop,代碼行數:20,代碼來源:DataDrivenDBInputFormat.java

示例4: OraOopDBRecordReader

import com.cloudera.sqoop.mapreduce.db.DBInputFormat.DBInputSplit; //導入依賴的package包/類
public OraOopDBRecordReader(DBInputFormat.DBInputSplit split,
    Class<T> inputClass, Configuration conf, Connection conn,
    DBConfiguration dbConfig, String cond, String[] fields, String table)
    throws SQLException {

  super(split, inputClass, conf, conn, dbConfig, cond, fields, table,
      "ORACLE-ORAOOP");

  OraOopUtilities.enableDebugLoggingIfRequired(conf);

  this.dbInputSplit = castSplit(split);

  String thisOracleInstanceName =
      OraOopOracleQueries.getCurrentOracleInstanceName(conn);
  LOG.info(String.format(
      "This record reader is connected to Oracle via the JDBC URL: \n"
          + "\t\"%s\"\n" + "\tto the Oracle instance: \"%s\"", conn
          .toString(), thisOracleInstanceName));

  OracleConnectionFactory.initializeOracleConnection(conn, conf);

  if (OraOopUtilities.userWantsOracleSessionStatisticsReports(conf)) {
    this.oraOopOraStats = OraOopUtilities.startSessionSnapshot(conn);
  }

  this.numberOfBlocksInThisSplit =
      this.dbInputSplit.getTotalNumberOfBlocksInThisSplit();
  this.numberOfBlocksProcessedInThisSplit = 0;

  this.profilingEnabled = conf.getBoolean("oraoop.profiling.enabled", false);
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:32,代碼來源:OraOopDBRecordReader.java


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