当前位置: 首页>>代码示例>>Java>>正文


Java IntegerSplitter类代码示例

本文整理汇总了Java中com.cloudera.sqoop.mapreduce.db.IntegerSplitter的典型用法代码示例。如果您正苦于以下问题:Java IntegerSplitter类的具体用法?Java IntegerSplitter怎么用?Java IntegerSplitter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IntegerSplitter类属于com.cloudera.sqoop.mapreduce.db包,在下文中一共展示了IntegerSplitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSplitter

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
/**
 * @return the DBSplitter implementation to use to divide the table/query
 * into InputSplits.
 */
protected DBSplitter getSplitter(int sqlDataType) {
  switch (sqlDataType) {
  case Types.NUMERIC:
  case Types.DECIMAL:
    return new BigDecimalSplitter();

  case Types.BIT:
  case Types.BOOLEAN:
    return new BooleanSplitter();

  case Types.INTEGER:
  case Types.TINYINT:
  case Types.SMALLINT:
  case Types.BIGINT:
    return new IntegerSplitter();

  case Types.REAL:
  case Types.FLOAT:
  case Types.DOUBLE:
    return new FloatSplitter();

  case Types.CHAR:
  case Types.VARCHAR:
  case Types.LONGVARCHAR:
    return new TextSplitter();

  case Types.DATE:
  case Types.TIME:
  case Types.TIMESTAMP:
    return new DateSplitter();

  default:
    // TODO: Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB,
    // BLOB, ARRAY, STRUCT, REF, DATALINK, and JAVA_OBJECT.
    return null;
  }
}
 
开发者ID:unicredit,项目名称:zSqoop,代码行数:42,代码来源:DataDrivenDBInputFormat.java

示例2: getSplitter

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
/**
 * @return the DBSplitter implementation to use to divide the table/query
 * into InputSplits.
 */
protected DBSplitter getSplitter(int sqlDataType, long splitLimit) {
  switch (sqlDataType) {
  case Types.NUMERIC:
  case Types.DECIMAL:
    if(splitLimit >= 0) {
      throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
    }
    return new BigDecimalSplitter();

  case Types.BIT:
  case Types.BOOLEAN:
    if(splitLimit >= 0) {
      throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
    }
    return new BooleanSplitter();

  case Types.INTEGER:
  case Types.TINYINT:
  case Types.SMALLINT:
  case Types.BIGINT:
    return new IntegerSplitter();

  case Types.REAL:
  case Types.FLOAT:
  case Types.DOUBLE:
    if(splitLimit >= 0) {
      throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
    }
    return new FloatSplitter();

  case Types.NVARCHAR:
  case Types.NCHAR:
    if(splitLimit >= 0) {
      throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
    }
    return new NTextSplitter();

  case Types.CHAR:
  case Types.VARCHAR:
  case Types.LONGVARCHAR:
    if(splitLimit >= 0) {
       throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
    }
    return new TextSplitter();

  case Types.DATE:
  case Types.TIME:
  case Types.TIMESTAMP:
    return new DateSplitter();

  default:
    // TODO: Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB,
    // BLOB, ARRAY, STRUCT, REF, DATALINK, and JAVA_OBJECT.
    if(splitLimit >= 0) {
      throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
    }
    return null;
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:64,代码来源:DataDrivenDBInputFormat.java

示例3: testEvenSplits

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testEvenSplits() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(10,-1, 0, 100);
  long [] expected = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, };
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例4: testOddSplits

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testOddSplits() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(10,-1, 0, 95);
  long [] expected = { 0, 10, 20, 30, 40, 50, 59, 68, 77, 86, 95, };
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例5: testSingletonSplit

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testSingletonSplit() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(1,-1, 5, 5);
  long [] expected = { 5, 5 };
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例6: testSingletonSplit2

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testSingletonSplit2() throws SQLException {
  // Same test, but overly-high numSplits
  List<Long> splits = new IntegerSplitter().split(5,-1, 5, 5);
  long [] expected = { 5, 5 };
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:7,代码来源:TestIntegerSplitter.java

示例7: testTooManySplits

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testTooManySplits() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(5,-1, 3, 5);
  long [] expected = { 3, 4, 5, 5};
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例8: testExactSplitsAsInterval

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testExactSplitsAsInterval() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(5,-1, 1, 5);
  long [] expected = { 1, 2, 3, 4, 5, 5};
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例9: testEvenSplitsWithLimit

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testEvenSplitsWithLimit() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(5, 10, 0, 100);
  long [] expected = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例10: testOddSplitsWithLimit

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testOddSplitsWithLimit() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(5, 10, 0, 95);
  long [] expected = { 0, 10, 20, 30, 40, 50, 59, 68, 77, 86, 95};
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例11: testSplitWithBiggerLimit

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testSplitWithBiggerLimit() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(10, 15, 0, 100);
  long [] expected = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例12: testFractionalSplitWithLimit

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testFractionalSplitWithLimit() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(5, 1, 1, 10);
  long [] expected = {1,2, 3, 4, 5, 6, 7, 8, 9, 10, 10};
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestIntegerSplitter.java

示例13: testEvenSplits

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testEvenSplits() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(10, 0, 100);
  long [] expected = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, };
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:unicredit,项目名称:zSqoop,代码行数:6,代码来源:TestIntegerSplitter.java

示例14: testOddSplits

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testOddSplits() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(10, 0, 95);
  long [] expected = { 0, 10, 20, 30, 40, 50, 59, 68, 77, 86, 95, };
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:unicredit,项目名称:zSqoop,代码行数:6,代码来源:TestIntegerSplitter.java

示例15: testSingletonSplit

import com.cloudera.sqoop.mapreduce.db.IntegerSplitter; //导入依赖的package包/类
public void testSingletonSplit() throws SQLException {
  List<Long> splits = new IntegerSplitter().split(1, 5, 5);
  long [] expected = { 5, 5 };
  assertLongArrayEquals(expected, toLongArray(splits));
}
 
开发者ID:unicredit,项目名称:zSqoop,代码行数:6,代码来源:TestIntegerSplitter.java


注:本文中的com.cloudera.sqoop.mapreduce.db.IntegerSplitter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。