本文整理汇总了Java中org.apache.hadoop.hive.ql.udf.generic.GenericUDF.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java GenericUDF.initialize方法的具体用法?Java GenericUDF.initialize怎么用?Java GenericUDF.initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hive.ql.udf.generic.GenericUDF
的用法示例。
在下文中一共展示了GenericUDF.initialize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: matchAndCreateUDFHolder
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的package包/类
private HiveFuncHolder matchAndCreateUDFHolder(String udfName,
Class<? extends UDF> udfClazz,
MajorType[] argTypes,
ObjectInspector[] argOIs) {
try {
GenericUDF udfInstance = new GenericUDFBridge(udfName, false/* is operator */, udfClazz.getName());
ObjectInspector returnOI = udfInstance.initialize(argOIs);
return new HiveFuncHolder(
udfName,
udfClazz,
argTypes,
returnOI,
Types.optional(ObjectInspectorHelper.getDrillType(returnOI)),
nonDeterministicUDFs.contains(udfClazz));
} catch (Exception e) { /*ignore this*/ }
return null;
}
示例2: matchAndCreateUDFHolder
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的package包/类
private HiveFuncHolder matchAndCreateUDFHolder(String udfName,
Class<? extends UDF> udfClazz,
CompleteType[] argTypes,
ObjectInspector[] argOIs) {
try {
GenericUDF udfInstance = new GenericUDFBridge(udfName, false/* is operator */, udfClazz.getName());
ObjectInspector returnOI = udfInstance.initialize(argOIs);
return new HiveFuncHolder(
udfName,
udfClazz,
argTypes,
returnOI,
CompleteType.fromMinorType(ObjectInspectorHelper.getMinorType(returnOI)),
nonDeterministicUDFs.contains(udfClazz));
} catch (Exception e) { /*ignore this*/ }
return null;
}
示例3: testThreeArgument
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的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();
}
示例4: testFourArgument
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的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();
}
示例5: testFiveArgumentArray
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的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();
}
示例6: testFiveArgumenString
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的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();
}
示例7: testOneArgument
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的package包/类
@Test
public void testOneArgument() throws UDFArgumentException, IOException {
GenericUDF udf = new SmartcnUDF();
ObjectInspector[] argOIs = new ObjectInspector[1];
// line
argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
udf.initialize(argOIs);
udf.close();
}
示例8: testTwoArgument
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的package包/类
@Test
public void testTwoArgument() throws UDFArgumentException, IOException {
GenericUDF udf = new SmartcnUDF();
ObjectInspector[] argOIs = new ObjectInspector[2];
// line
argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
// stopWords
argOIs[1] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
PrimitiveObjectInspectorFactory.javaStringObjectInspector, null);
udf.initialize(argOIs);
udf.close();
}
示例9: testOneArgument
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的package包/类
@Test
public void testOneArgument() throws UDFArgumentException, IOException {
GenericUDF udf = new KuromojiUDF();
ObjectInspector[] argOIs = new ObjectInspector[1];
// line
argOIs[0] = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
udf.initialize(argOIs);
udf.close();
}
示例10: testTwoArgument
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的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();
}
示例11: testExpectedMode
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的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();
}
示例12: testInvalidMode
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; //导入方法依赖的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();
}