當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。