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


Java PrimitiveTypeInfo.setTypeName方法代码示例

本文整理汇总了Java中org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo.setTypeName方法的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveTypeInfo.setTypeName方法的具体用法?Java PrimitiveTypeInfo.setTypeName怎么用?Java PrimitiveTypeInfo.setTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo的用法示例。


在下文中一共展示了PrimitiveTypeInfo.setTypeName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testThreeArgument

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test
public void testThreeArgument() throws UDFArgumentException, IOException {
    GenericUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[3];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    // stopWords
    argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
    udf.initialize(argOIs);
    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:18,代码来源:KuromojiUDFTest.java

示例2: testFourArgument

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test
public void testFourArgument() throws UDFArgumentException, IOException {
    GenericUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[4];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    // stopWords
    argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
    // stopTags
    argOIs[3] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
    udf.initialize(argOIs);
    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:21,代码来源:KuromojiUDFTest.java

示例3: testFiveArgumentArray

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test
public void testFiveArgumentArray() throws UDFArgumentException, IOException {
    GenericUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[5];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    // stopWords
    argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
    // stopTags
    argOIs[3] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
    // userDictUrl
    argOIs[4] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
    udf.initialize(argOIs);
    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:24,代码来源:KuromojiUDFTest.java

示例4: testFiveArgumenString

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test
public void testFiveArgumenString() throws UDFArgumentException, IOException {
    GenericUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[5];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    // stopWords
    argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
    // stopTags
    argOIs[3] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
    // userDictUrl
    argOIs[4] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    udf.initialize(argOIs);
    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:24,代码来源:KuromojiUDFTest.java

示例5: testTwoArgument

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test
public void testTwoArgument() throws UDFArgumentException, IOException {
    GenericUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[2];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    udf.initialize(argOIs);
    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:15,代码来源:KuromojiUDFTest.java

示例6: testExpectedMode

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
public void testExpectedMode() throws UDFArgumentException, IOException {
    GenericUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[2];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, new Text("normal"));
    udf.initialize(argOIs);
    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:14,代码来源:KuromojiUDFTest.java

示例7: testInvalidMode

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test(expected = UDFArgumentException.class)
public void testInvalidMode() throws UDFArgumentException, IOException {
    GenericUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[2];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, new Text("unsupported mode"));
    udf.initialize(argOIs);
    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:15,代码来源:KuromojiUDFTest.java

示例8: testEvaluateInvalidUserDictURL

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test(expected = UDFArgumentException.class)
public void testEvaluateInvalidUserDictURL() throws IOException, HiveException {
    KuromojiUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[5];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    // stopWords
    argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.writableStringObjectInspector, null);
    // stopTags
    argOIs[3] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.writableStringObjectInspector, null);
    // userDictUrl
    argOIs[4] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, new Text("http://google.com/"));
    udf.initialize(argOIs);

    DeferredObject[] args = new DeferredObject[1];
    args[0] = new DeferredObject() {
        public Text get() throws HiveException {
            return new Text("クロモジのJapaneseAnalyzerを使ってみる。テスト。");
        }

        @Override
        public void prepare(int arg) throws HiveException {}
    };

    List<Text> tokens = udf.evaluate(args);
    Assert.assertNotNull(tokens);

    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:38,代码来源:KuromojiUDFTest.java

示例9: testEvaluateUserDictArray

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test
public void testEvaluateUserDictArray() throws IOException, HiveException {
    KuromojiUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[5];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    // stopWords
    argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.writableStringObjectInspector, null);
    // stopTags
    argOIs[3] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.writableStringObjectInspector, null);
    // userDictArray (from https://raw.githubusercontent.com/atilika/kuromoji/909fd6b32bf4e9dc86b7599de5c9b50ca8f004a1/kuromoji-core/src/test/resources/userdict.txt)
    List<String> userDict = new ArrayList<String>();
    userDict.add("日本経済新聞,日本 経済 新聞,ニホン ケイザイ シンブン,カスタム名詞");
    userDict.add("関西国際空港,関西 国際 空港,カンサイ コクサイ クウコウ,テスト名詞");
    argOIs[4] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.writableStringObjectInspector, userDict);
    udf.initialize(argOIs);

    DeferredObject[] args = new DeferredObject[1];
    args[0] = new DeferredObject() {
        public Text get() throws HiveException {
            return new Text("日本経済新聞。");
        }

        @Override
        public void prepare(int arg) throws HiveException {}
    };

    List<Text> tokens = udf.evaluate(args);

    Assert.assertNotNull(tokens);
    Assert.assertEquals(3, tokens.size());

    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:43,代码来源:KuromojiUDFTest.java

示例10: testEvaluateUserDictURL

import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; //导入方法依赖的package包/类
@Test
public void testEvaluateUserDictURL() throws IOException, HiveException {
    KuromojiUDF udf = new KuromojiUDF();
    ObjectInspector[] argOIs = new ObjectInspector[5];
    // line
    argOIs[0] = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
    // mode
    PrimitiveTypeInfo stringType = new PrimitiveTypeInfo();
    stringType.setTypeName("string");
    argOIs[1] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType, null);
    // stopWords
    argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.writableStringObjectInspector, null);
    // stopTags
    argOIs[3] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
        PrimitiveObjectInspectorFactory.writableStringObjectInspector, null);
    // userDictUrl (Kuromoji official sample user defined dict on GitHub)
    // e.g., "日本経済新聞" will be "日本", "経済", and "新聞"
    argOIs[4] = PrimitiveObjectInspectorFactory.getPrimitiveWritableConstantObjectInspector(
        stringType,
        new Text(
            "https://raw.githubusercontent.com/atilika/kuromoji/909fd6b32bf4e9dc86b7599de5c9b50ca8f004a1/kuromoji-core/src/test/resources/userdict.txt"));
    udf.initialize(argOIs);

    DeferredObject[] args = new DeferredObject[1];
    args[0] = new DeferredObject() {
        public Text get() throws HiveException {
            return new Text("クロモジのJapaneseAnalyzerを使ってみる。日本経済新聞。");
        }

        @Override
        public void prepare(int arg) throws HiveException {}
    };

    List<Text> tokens = udf.evaluate(args);

    Assert.assertNotNull(tokens);
    Assert.assertEquals(7, tokens.size());

    udf.close();
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:43,代码来源:KuromojiUDFTest.java


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