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


Java TextSplitter类代码示例

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


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

示例1: testAlphabetSplit

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testAlphabetSplit() throws SQLException, ValidationException {
  // This should give us 25 splits, one per letter.
  TextSplitter splitter = new TextSplitter();
  List<String> splits = splitter.split(25, "A", "Z", "");
  String [] expected = { "A", "B", "C", "D", "E", "F", "G", "H", "I",
      "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
      "V", "W", "X", "Y", "Z", };
  assertArrayEquals(expected, splits.toArray(new String [0]));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:10,代码来源:TestTextSplitter.java

示例2: testAlphabetSplitWhenMinStringGreaterThanMaxString

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testAlphabetSplitWhenMinStringGreaterThanMaxString() throws SQLException {
    TextSplitter splitter = new TextSplitter();
    try {
        splitter.split(4, "Z", "A", "");
        fail();
    } catch (ValidationException e) {
        // expected
        assertTrue(true);
    }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:11,代码来源:TestTextSplitter.java

示例3: testCommonPrefix

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testCommonPrefix() throws SQLException, ValidationException {
  // Splits between 'Hand' and 'Hardy'
  TextSplitter splitter = new TextSplitter();
  List<String> splits = splitter.split(5, "nd", "rdy", "Ha");
  // Don't check for exact values in the middle, because the splitter
  // generates some ugly Unicode-isms. But do check that we get multiple
  // splits and that it starts and ends on the correct points.
  assertEquals("Hand", splits.get(0));
  assertEquals("Hardy", splits.get(splits.size() -1));
  assertEquals(6, splits.size());
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:12,代码来源:TestTextSplitter.java

示例4: testNChar

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testNChar() throws SQLException {
  // Splits between 'Hand' and 'Hardy'
  NTextSplitter splitter = new NTextSplitter();
  assertEquals(true, splitter.isUseNCharStrings());
  TextSplitter splitter2 = new TextSplitter();
  assertEquals(false, splitter2.isUseNCharStrings());
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:8,代码来源:TestTextSplitter.java

示例5: getSplitter

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的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

示例6: testAlphabetSplit

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testAlphabetSplit() throws SQLException {
  // This should give us 25 splits, one per letter.
  TextSplitter splitter = new TextSplitter();
  List<String> splits = splitter.split(25, "A", "Z", "");
  String [] expected = { "A", "B", "C", "D", "E", "F", "G", "H", "I",
      "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
      "V", "W", "X", "Y", "Z", };
  assertArrayEquals(expected, splits.toArray(new String [0]));
}
 
开发者ID:unicredit,项目名称:zSqoop,代码行数:10,代码来源:TestTextSplitter.java

示例7: testCommonPrefix

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testCommonPrefix() throws SQLException {
  // Splits between 'Hand' and 'Hardy'
  TextSplitter splitter = new TextSplitter();
  List<String> splits = splitter.split(5, "nd", "rdy", "Ha");
  // Don't check for exact values in the middle, because the splitter
  // generates some ugly Unicode-isms. But do check that we get multiple
  // splits and that it starts and ends on the correct points.
  assertEquals("Hand", splits.get(0));
  assertEquals("Hardy", splits.get(splits.size() -1));
  assertEquals(6, splits.size());
}
 
开发者ID:unicredit,项目名称:zSqoop,代码行数:12,代码来源:TestTextSplitter.java

示例8: getSplitter

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的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

示例9: testStringConvertEmpty

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testStringConvertEmpty() {
  TextSplitter splitter = new TextSplitter();
  BigDecimal emptyBigDec = splitter.stringToBigDecimal("");
  assertEquals(BigDecimal.ZERO, emptyBigDec);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestTextSplitter.java

示例10: testBigDecConvertEmpty

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testBigDecConvertEmpty() {
  TextSplitter splitter = new TextSplitter();
  String emptyStr = splitter.bigDecimalToString(BigDecimal.ZERO);
  assertEquals("", emptyStr);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestTextSplitter.java

示例11: testConvertA

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testConvertA() {
  TextSplitter splitter = new TextSplitter();
  String out = splitter.bigDecimalToString(splitter.stringToBigDecimal("A"));
  assertEquals("A", out);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestTextSplitter.java

示例12: testConvertZ

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testConvertZ() {
  TextSplitter splitter = new TextSplitter();
  String out = splitter.bigDecimalToString(splitter.stringToBigDecimal("Z"));
  assertEquals("Z", out);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:TestTextSplitter.java

示例13: testConvertThreeChars

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testConvertThreeChars() {
  TextSplitter splitter = new TextSplitter();
  String out = splitter.bigDecimalToString(
      splitter.stringToBigDecimal("abc"));
  assertEquals("abc", out);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:7,代码来源:TestTextSplitter.java

示例14: testConvertStr

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testConvertStr() {
  TextSplitter splitter = new TextSplitter();
  String out = splitter.bigDecimalToString(
      splitter.stringToBigDecimal("big str"));
  assertEquals("big str", out);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:7,代码来源:TestTextSplitter.java

示例15: testConvertChomped

import com.cloudera.sqoop.mapreduce.db.TextSplitter; //导入依赖的package包/类
public void testConvertChomped() {
  TextSplitter splitter = new TextSplitter();
  String out = splitter.bigDecimalToString(
      splitter.stringToBigDecimal("AVeryLongStringIndeed"));
  assertEquals("AVeryLon", out);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:7,代码来源:TestTextSplitter.java


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