本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}