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

项目: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());
}