Java 类org.apache.hadoop.mapreduce.lib.db.DBInputFormat.NullDBWritable 实例源码

项目:hadoop    文件:TestDbClasses.java   
/**
 * test generate sql script for OracleDBRecordReader.
 */

@Test(timeout = 20000)
public void testOracleDBRecordReader() throws Exception {
  DBInputSplit splitter = new DBInputSplit(1, 10);
  Configuration configuration = new Configuration();
  Connection connect = DriverForTest.getConnection();

  DBConfiguration dbConfiguration = new DBConfiguration(configuration);
  dbConfiguration.setInputOrderBy("Order");
  String[] fields = { "f1", "f2" };

  OracleDBRecordReader<NullDBWritable> recorder = new OracleDBRecordReader<NullDBWritable>(
      splitter, NullDBWritable.class, configuration, connect,
      dbConfiguration, "condition", fields, "table");
  assertEquals(
      "SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 10 ) WHERE dbif_rno > 1",
      recorder.getSelectQuery());
}
项目:aliyun-oss-hadoop-fs    文件:TestDbClasses.java   
/**
 * test generate sql script for OracleDBRecordReader.
 */

@Test(timeout = 20000)
public void testOracleDBRecordReader() throws Exception {
  DBInputSplit splitter = new DBInputSplit(1, 10);
  Configuration configuration = new Configuration();
  Connection connect = DriverForTest.getConnection();

  DBConfiguration dbConfiguration = new DBConfiguration(configuration);
  dbConfiguration.setInputOrderBy("Order");
  String[] fields = { "f1", "f2" };

  OracleDBRecordReader<NullDBWritable> recorder = new OracleDBRecordReader<NullDBWritable>(
      splitter, NullDBWritable.class, configuration, connect,
      dbConfiguration, "condition", fields, "table");
  assertEquals(
      "SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 10 ) WHERE dbif_rno > 1",
      recorder.getSelectQuery());
}
项目:big-c    文件:TestDbClasses.java   
/**
 * test generate sql script for OracleDBRecordReader.
 */

@Test(timeout = 20000)
public void testOracleDBRecordReader() throws Exception {
  DBInputSplit splitter = new DBInputSplit(1, 10);
  Configuration configuration = new Configuration();
  Connection connect = DriverForTest.getConnection();

  DBConfiguration dbConfiguration = new DBConfiguration(configuration);
  dbConfiguration.setInputOrderBy("Order");
  String[] fields = { "f1", "f2" };

  OracleDBRecordReader<NullDBWritable> recorder = new OracleDBRecordReader<NullDBWritable>(
      splitter, NullDBWritable.class, configuration, connect,
      dbConfiguration, "condition", fields, "table");
  assertEquals(
      "SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 10 ) WHERE dbif_rno > 1",
      recorder.getSelectQuery());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDbClasses.java   
/**
 * test generate sql script for OracleDBRecordReader.
 */

@Test(timeout = 2000)
public void testOracleDBRecordReader() throws Exception {
  DBInputSplit splitter = new DBInputSplit(1, 10);
  Configuration configuration = new Configuration();
  Connection connect = DriverForTest.getConnection();

  DBConfiguration dbConfiguration = new DBConfiguration(configuration);
  dbConfiguration.setInputOrderBy("Order");
  String[] fields = { "f1", "f2" };

  OracleDBRecordReader<NullDBWritable> recorder = new OracleDBRecordReader<NullDBWritable>(
      splitter, NullDBWritable.class, configuration, connect,
      dbConfiguration, "condition", fields, "table");
  assertEquals(
      "SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 10 ) WHERE dbif_rno > 1",
      recorder.getSelectQuery());
}
项目:FlexMap    文件:TestDbClasses.java   
/**
 * test generate sql script for OracleDBRecordReader.
 */

@Test(timeout = 2000)
public void testOracleDBRecordReader() throws Exception {
  DBInputSplit splitter = new DBInputSplit(1, 10);
  Configuration configuration = new Configuration();
  Connection connect = DriverForTest.getConnection();

  DBConfiguration dbConfiguration = new DBConfiguration(configuration);
  dbConfiguration.setInputOrderBy("Order");
  String[] fields = { "f1", "f2" };

  OracleDBRecordReader<NullDBWritable> recorder = new OracleDBRecordReader<NullDBWritable>(
      splitter, NullDBWritable.class, configuration, connect,
      dbConfiguration, "condition", fields, "table");
  assertEquals(
      "SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 10 ) WHERE dbif_rno > 1",
      recorder.getSelectQuery());
}
项目:hops    文件:TestDbClasses.java   
/**
 * test generate sql script for OracleDBRecordReader.
 */

@Test(timeout = 20000)
public void testOracleDBRecordReader() throws Exception {
  DBInputSplit splitter = new DBInputSplit(1, 10);
  Configuration configuration = new Configuration();
  Connection connect = DriverForTest.getConnection();

  DBConfiguration dbConfiguration = new DBConfiguration(configuration);
  dbConfiguration.setInputOrderBy("Order");
  String[] fields = { "f1", "f2" };

  OracleDBRecordReader<NullDBWritable> recorder = new OracleDBRecordReader<NullDBWritable>(
      splitter, NullDBWritable.class, configuration, connect,
      dbConfiguration, "condition", fields, "table");
  assertEquals(
      "SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 10 ) WHERE dbif_rno > 1",
      recorder.getSelectQuery());
}
项目:hadoop-on-lustre2    文件:TestDbClasses.java   
/**
 * test generate sql script for OracleDBRecordReader.
 */

@Test(timeout = 2000)
public void testOracleDBRecordReader() throws Exception {
  DBInputSplit splitter = new DBInputSplit(1, 10);
  Configuration configuration = new Configuration();
  Connection connect = DriverForTest.getConnection();

  DBConfiguration dbConfiguration = new DBConfiguration(configuration);
  dbConfiguration.setInputOrderBy("Order");
  String[] fields = { "f1", "f2" };

  OracleDBRecordReader<NullDBWritable> recorder = new OracleDBRecordReader<NullDBWritable>(
      splitter, NullDBWritable.class, configuration, connect,
      dbConfiguration, "condition", fields, "table");
  assertEquals(
      "SELECT * FROM (SELECT a.*,ROWNUM dbif_rno FROM ( SELECT f1, f2 FROM table WHERE condition ORDER BY Order ) a WHERE rownum <= 1 + 9 ) WHERE dbif_rno >= 1",
      recorder.getSelectQuery());
}
项目:hadoop    文件:TestDbClasses.java   
/**
 * test splitters from DataDrivenDBInputFormat. For different data types may
 * be different splitter
 */
@Test(timeout = 10000)
public void testDataDrivenDBInputFormatSplitter() {
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  testCommonSplitterTypes(format);
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.DATE).getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIME).getClass());
}
项目:hadoop    文件:TestDbClasses.java   
@Test(timeout = 10000)
public void testDataDrivenDBInputFormat() throws Exception {
  JobContext jobContext = mock(JobContext.class);
  Configuration configuration = new Configuration();
  configuration.setInt(MRJobConfig.NUM_MAPS, 1);

  when(jobContext.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  List<InputSplit> splits = format.getSplits(jobContext);
  assertEquals(1, splits.size());
  DataDrivenDBInputSplit split = (DataDrivenDBInputSplit) splits.get(0);
  assertEquals("1=1", split.getLowerClause());
  assertEquals("1=1", split.getUpperClause());

  // 2
  configuration.setInt(MRJobConfig.NUM_MAPS, 2);

  DataDrivenDBInputFormat.setBoundingQuery(configuration, "query");
  assertEquals("query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));

  Job job = mock(Job.class);
  when(job.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat.setInput(job, NullDBWritable.class, "query",
      "Bounding Query");

  assertEquals("Bounding Query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));
}
项目:hadoop    文件:TestDbClasses.java   
@Test(timeout = 10000)
public void testOracleDataDrivenDBInputFormat() throws Exception {
  OracleDataDrivenDBInputFormat<NullDBWritable> format = 
      new OracleDataDrivenDBInputFormatForTest();
  testCommonSplitterTypes(format);
  assertEquals(OracleDateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.DATE).getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.TIME).getClass());
}
项目:hadoop    文件:TestDbClasses.java   
private void testCommonSplitterTypes(
    DataDrivenDBInputFormat<NullDBWritable> format) {
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.DECIMAL)
      .getClass());
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.NUMERIC)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BOOLEAN)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BIT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.BIGINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.TINYINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.SMALLINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.INTEGER)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.DOUBLE)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.REAL).getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.FLOAT)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.LONGVARCHAR)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.CHAR).getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.VARCHAR)
      .getClass());
  // if unknown data type splitter is null
  assertNull(format.getSplitter(Types.BINARY));
}
项目:aliyun-oss-hadoop-fs    文件:TestDbClasses.java   
/**
 * test splitters from DataDrivenDBInputFormat. For different data types may
 * be different splitter
 */
@Test(timeout = 10000)
public void testDataDrivenDBInputFormatSplitter() {
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  testCommonSplitterTypes(format);
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.DATE).getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIME).getClass());
}
项目:aliyun-oss-hadoop-fs    文件:TestDbClasses.java   
@Test(timeout = 10000)
public void testDataDrivenDBInputFormat() throws Exception {
  JobContext jobContext = mock(JobContext.class);
  Configuration configuration = new Configuration();
  configuration.setInt(MRJobConfig.NUM_MAPS, 1);

  when(jobContext.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  List<InputSplit> splits = format.getSplits(jobContext);
  assertEquals(1, splits.size());
  DataDrivenDBInputSplit split = (DataDrivenDBInputSplit) splits.get(0);
  assertEquals("1=1", split.getLowerClause());
  assertEquals("1=1", split.getUpperClause());

  // 2
  configuration.setInt(MRJobConfig.NUM_MAPS, 2);

  DataDrivenDBInputFormat.setBoundingQuery(configuration, "query");
  assertEquals("query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));

  Job job = mock(Job.class);
  when(job.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat.setInput(job, NullDBWritable.class, "query",
      "Bounding Query");

  assertEquals("Bounding Query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));
}
项目:aliyun-oss-hadoop-fs    文件:TestDbClasses.java   
@Test(timeout = 10000)
public void testOracleDataDrivenDBInputFormat() throws Exception {
  OracleDataDrivenDBInputFormat<NullDBWritable> format = 
      new OracleDataDrivenDBInputFormatForTest();
  testCommonSplitterTypes(format);
  assertEquals(OracleDateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.DATE).getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.TIME).getClass());
}
项目:aliyun-oss-hadoop-fs    文件:TestDbClasses.java   
private void testCommonSplitterTypes(
    DataDrivenDBInputFormat<NullDBWritable> format) {
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.DECIMAL)
      .getClass());
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.NUMERIC)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BOOLEAN)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BIT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.BIGINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.TINYINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.SMALLINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.INTEGER)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.DOUBLE)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.REAL).getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.FLOAT)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.LONGVARCHAR)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.CHAR).getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.VARCHAR)
      .getClass());
  // if unknown data type splitter is null
  assertNull(format.getSplitter(Types.BINARY));
}
项目:big-c    文件:TestDbClasses.java   
/**
 * test splitters from DataDrivenDBInputFormat. For different data types may
 * be different splitter
 */
@Test(timeout = 10000)
public void testDataDrivenDBInputFormatSplitter() {
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  testCommonSplitterTypes(format);
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.DATE).getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIME).getClass());
}
项目:big-c    文件:TestDbClasses.java   
@Test(timeout = 10000)
public void testDataDrivenDBInputFormat() throws Exception {
  JobContext jobContext = mock(JobContext.class);
  Configuration configuration = new Configuration();
  configuration.setInt(MRJobConfig.NUM_MAPS, 1);

  when(jobContext.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  List<InputSplit> splits = format.getSplits(jobContext);
  assertEquals(1, splits.size());
  DataDrivenDBInputSplit split = (DataDrivenDBInputSplit) splits.get(0);
  assertEquals("1=1", split.getLowerClause());
  assertEquals("1=1", split.getUpperClause());

  // 2
  configuration.setInt(MRJobConfig.NUM_MAPS, 2);

  DataDrivenDBInputFormat.setBoundingQuery(configuration, "query");
  assertEquals("query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));

  Job job = mock(Job.class);
  when(job.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat.setInput(job, NullDBWritable.class, "query",
      "Bounding Query");

  assertEquals("Bounding Query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));
}
项目:big-c    文件:TestDbClasses.java   
@Test(timeout = 10000)
public void testOracleDataDrivenDBInputFormat() throws Exception {
  OracleDataDrivenDBInputFormat<NullDBWritable> format = 
      new OracleDataDrivenDBInputFormatForTest();
  testCommonSplitterTypes(format);
  assertEquals(OracleDateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.DATE).getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.TIME).getClass());
}
项目:big-c    文件:TestDbClasses.java   
private void testCommonSplitterTypes(
    DataDrivenDBInputFormat<NullDBWritable> format) {
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.DECIMAL)
      .getClass());
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.NUMERIC)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BOOLEAN)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BIT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.BIGINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.TINYINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.SMALLINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.INTEGER)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.DOUBLE)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.REAL).getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.FLOAT)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.LONGVARCHAR)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.CHAR).getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.VARCHAR)
      .getClass());
  // if unknown data type splitter is null
  assertNull(format.getSplitter(Types.BINARY));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDbClasses.java   
/**
 * test splitters from DataDrivenDBInputFormat. For different data types may
 * be different splitter
 */
@Test(timeout = 1000)
public void testDataDrivenDBInputFormatSplitter() {
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  testCommonSplitterTypes(format);
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.DATE).getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIME).getClass());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDbClasses.java   
@Test(timeout = 1000)
public void testDataDrivenDBInputFormat() throws Exception {
  JobContext jobContext = mock(JobContext.class);
  Configuration configuration = new Configuration();
  configuration.setInt(MRJobConfig.NUM_MAPS, 1);

  when(jobContext.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  List<InputSplit> splits = format.getSplits(jobContext);
  assertEquals(1, splits.size());
  DataDrivenDBInputSplit split = (DataDrivenDBInputSplit) splits.get(0);
  assertEquals("1=1", split.getLowerClause());
  assertEquals("1=1", split.getUpperClause());

  // 2
  configuration.setInt(MRJobConfig.NUM_MAPS, 2);

  DataDrivenDBInputFormat.setBoundingQuery(configuration, "query");
  assertEquals("query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));

  Job job = mock(Job.class);
  when(job.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat.setInput(job, NullDBWritable.class, "query",
      "Bounding Query");

  assertEquals("Bounding Query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDbClasses.java   
@Test(timeout = 1000)
public void testOracleDataDrivenDBInputFormat() throws Exception {
  OracleDataDrivenDBInputFormat<NullDBWritable> format = 
      new OracleDataDrivenDBInputFormatForTest();
  testCommonSplitterTypes(format);
  assertEquals(OracleDateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.DATE).getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.TIME).getClass());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDbClasses.java   
private void testCommonSplitterTypes(
    DataDrivenDBInputFormat<NullDBWritable> format) {
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.DECIMAL)
      .getClass());
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.NUMERIC)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BOOLEAN)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BIT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.BIGINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.TINYINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.SMALLINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.INTEGER)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.DOUBLE)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.REAL).getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.FLOAT)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.LONGVARCHAR)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.CHAR).getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.VARCHAR)
      .getClass());
  // if unknown data type splitter is null
  assertNull(format.getSplitter(Types.BINARY));
}
项目:FlexMap    文件:TestDbClasses.java   
/**
 * test splitters from DataDrivenDBInputFormat. For different data types may
 * be different splitter
 */
@Test(timeout = 1000)
public void testDataDrivenDBInputFormatSplitter() {
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  testCommonSplitterTypes(format);
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.DATE).getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIME).getClass());
}
项目:FlexMap    文件:TestDbClasses.java   
@Test(timeout = 1000)
public void testDataDrivenDBInputFormat() throws Exception {
  JobContext jobContext = mock(JobContext.class);
  Configuration configuration = new Configuration();
  configuration.setInt(MRJobConfig.NUM_MAPS, 1);

  when(jobContext.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  List<InputSplit> splits = format.getSplits(jobContext);
  assertEquals(1, splits.size());
  DataDrivenDBInputSplit split = (DataDrivenDBInputSplit) splits.get(0);
  assertEquals("1=1", split.getLowerClause());
  assertEquals("1=1", split.getUpperClause());

  // 2
  configuration.setInt(MRJobConfig.NUM_MAPS, 2);

  DataDrivenDBInputFormat.setBoundingQuery(configuration, "query");
  assertEquals("query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));

  Job job = mock(Job.class);
  when(job.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat.setInput(job, NullDBWritable.class, "query",
      "Bounding Query");

  assertEquals("Bounding Query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));
}
项目:FlexMap    文件:TestDbClasses.java   
@Test(timeout = 1000)
public void testOracleDataDrivenDBInputFormat() throws Exception {
  OracleDataDrivenDBInputFormat<NullDBWritable> format = 
      new OracleDataDrivenDBInputFormatForTest();
  testCommonSplitterTypes(format);
  assertEquals(OracleDateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.DATE).getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.TIME).getClass());
}
项目:FlexMap    文件:TestDbClasses.java   
private void testCommonSplitterTypes(
    DataDrivenDBInputFormat<NullDBWritable> format) {
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.DECIMAL)
      .getClass());
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.NUMERIC)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BOOLEAN)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BIT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.BIGINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.TINYINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.SMALLINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.INTEGER)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.DOUBLE)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.REAL).getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.FLOAT)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.LONGVARCHAR)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.CHAR).getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.VARCHAR)
      .getClass());
  // if unknown data type splitter is null
  assertNull(format.getSplitter(Types.BINARY));
}
项目:hops    文件:TestDbClasses.java   
/**
 * test splitters from DataDrivenDBInputFormat. For different data types may
 * be different splitter
 */
@Test(timeout = 10000)
public void testDataDrivenDBInputFormatSplitter() {
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  testCommonSplitterTypes(format);
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.DATE).getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIME).getClass());
}
项目:hops    文件:TestDbClasses.java   
@Test(timeout = 10000)
public void testDataDrivenDBInputFormat() throws Exception {
  JobContext jobContext = mock(JobContext.class);
  Configuration configuration = new Configuration();
  configuration.setInt(MRJobConfig.NUM_MAPS, 1);

  when(jobContext.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  List<InputSplit> splits = format.getSplits(jobContext);
  assertEquals(1, splits.size());
  DataDrivenDBInputSplit split = (DataDrivenDBInputSplit) splits.get(0);
  assertEquals("1=1", split.getLowerClause());
  assertEquals("1=1", split.getUpperClause());

  // 2
  configuration.setInt(MRJobConfig.NUM_MAPS, 2);

  DataDrivenDBInputFormat.setBoundingQuery(configuration, "query");
  assertEquals("query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));

  Job job = mock(Job.class);
  when(job.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat.setInput(job, NullDBWritable.class, "query",
      "Bounding Query");

  assertEquals("Bounding Query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));
}
项目:hops    文件:TestDbClasses.java   
@Test(timeout = 10000)
public void testOracleDataDrivenDBInputFormat() throws Exception {
  OracleDataDrivenDBInputFormat<NullDBWritable> format = 
      new OracleDataDrivenDBInputFormatForTest();
  testCommonSplitterTypes(format);
  assertEquals(OracleDateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.DATE).getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.TIME).getClass());
}
项目:hops    文件:TestDbClasses.java   
private void testCommonSplitterTypes(
    DataDrivenDBInputFormat<NullDBWritable> format) {
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.DECIMAL)
      .getClass());
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.NUMERIC)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BOOLEAN)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BIT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.BIGINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.TINYINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.SMALLINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.INTEGER)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.DOUBLE)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.REAL).getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.FLOAT)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.LONGVARCHAR)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.CHAR).getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.VARCHAR)
      .getClass());
  // if unknown data type splitter is null
  assertNull(format.getSplitter(Types.BINARY));
}
项目:hadoop-on-lustre2    文件:TestDbClasses.java   
/**
 * test splitters from DataDrivenDBInputFormat. For different data types may
 * be different splitter
 */
@Test(timeout = 1000)
public void testDataDrivenDBInputFormatSplitter() {
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  testCommonSplitterTypes(format);
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.DATE).getClass());
  assertEquals(DateSplitter.class, format.getSplitter(Types.TIME).getClass());
}
项目:hadoop-on-lustre2    文件:TestDbClasses.java   
@Test(timeout = 1000)
public void testDataDrivenDBInputFormat() throws Exception {
  JobContext jobContext = mock(JobContext.class);
  Configuration configuration = new Configuration();
  configuration.setInt(MRJobConfig.NUM_MAPS, 1);

  when(jobContext.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat<NullDBWritable> format = new DataDrivenDBInputFormat<NullDBWritable>();
  List<InputSplit> splits = format.getSplits(jobContext);
  assertEquals(1, splits.size());
  DataDrivenDBInputSplit split = (DataDrivenDBInputSplit) splits.get(0);
  assertEquals("1=1", split.getLowerClause());
  assertEquals("1=1", split.getUpperClause());

  // 2
  configuration.setInt(MRJobConfig.NUM_MAPS, 2);

  DataDrivenDBInputFormat.setBoundingQuery(configuration, "query");
  assertEquals("query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));

  Job job = mock(Job.class);
  when(job.getConfiguration()).thenReturn(configuration);
  DataDrivenDBInputFormat.setInput(job, NullDBWritable.class, "query",
      "Bounding Query");

  assertEquals("Bounding Query",
      configuration.get(DBConfiguration.INPUT_BOUNDING_QUERY));
}
项目:hadoop-on-lustre2    文件:TestDbClasses.java   
@Test(timeout = 1000)
public void testOracleDataDrivenDBInputFormat() throws Exception {
  OracleDataDrivenDBInputFormat<NullDBWritable> format = 
      new OracleDataDrivenDBInputFormatForTest();
  testCommonSplitterTypes(format);
  assertEquals(OracleDateSplitter.class, format.getSplitter(Types.TIMESTAMP)
      .getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.DATE).getClass());
  assertEquals(OracleDateSplitter.class, 
      format.getSplitter(Types.TIME).getClass());
}
项目:hadoop-on-lustre2    文件:TestDbClasses.java   
private void testCommonSplitterTypes(
    DataDrivenDBInputFormat<NullDBWritable> format) {
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.DECIMAL)
      .getClass());
  assertEquals(BigDecimalSplitter.class, format.getSplitter(Types.NUMERIC)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BOOLEAN)
      .getClass());
  assertEquals(BooleanSplitter.class, format.getSplitter(Types.BIT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.BIGINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.TINYINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.SMALLINT)
      .getClass());
  assertEquals(IntegerSplitter.class, format.getSplitter(Types.INTEGER)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.DOUBLE)
      .getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.REAL).getClass());
  assertEquals(FloatSplitter.class, format.getSplitter(Types.FLOAT)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.LONGVARCHAR)
      .getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.CHAR).getClass());
  assertEquals(TextSplitter.class, format.getSplitter(Types.VARCHAR)
      .getClass());
  // if unknown data type splitter is null
  assertNull(format.getSplitter(Types.BINARY));
}
项目:hadoop    文件:DBConfiguration.java   
public Class<?> getInputClass() {
  return conf.getClass(DBConfiguration.INPUT_CLASS_PROPERTY,
                       NullDBWritable.class);
}
项目:aliyun-oss-hadoop-fs    文件:DBConfiguration.java   
public Class<?> getInputClass() {
  return conf.getClass(DBConfiguration.INPUT_CLASS_PROPERTY,
                       NullDBWritable.class);
}
项目:big-c    文件:DBConfiguration.java   
public Class<?> getInputClass() {
  return conf.getClass(DBConfiguration.INPUT_CLASS_PROPERTY,
                       NullDBWritable.class);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DBConfiguration.java   
public Class<?> getInputClass() {
  return conf.getClass(DBConfiguration.INPUT_CLASS_PROPERTY,
                       NullDBWritable.class);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DBConfiguration.java   
public Class<?> getInputClass() {
  return conf.getClass(DBConfiguration.INPUT_CLASS_PROPERTY,
                       NullDBWritable.class);
}