本文整理汇总了Java中org.apache.hadoop.hive.ql.udf.UDFType类的典型用法代码示例。如果您正苦于以下问题:Java UDFType类的具体用法?Java UDFType怎么用?Java UDFType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UDFType类属于org.apache.hadoop.hive.ql.udf包,在下文中一共展示了UDFType类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import org.apache.hadoop.hive.ql.udf.UDFType; //导入依赖的package包/类
private <C,I> void register(Class<? extends I> clazz, ArrayListMultimap<String,Class<? extends I>> methods) {
Description desc = clazz.getAnnotation(Description.class);
String[] names;
if (desc != null) {
names = desc.name().split(",");
for (int i=0; i<names.length; i++) {
names[i] = names[i].trim();
}
}else{
names = new String[]{clazz.getName().replace('.', '_')};
}
UDFType type = clazz.getAnnotation(UDFType.class);
if (type != null && type.deterministic()) {
nonDeterministicUDFs.add(clazz);
}
for(int i=0; i<names.length;i++) {
methods.put(names[i].toLowerCase(), clazz);
}
}
示例2: register
import org.apache.hadoop.hive.ql.udf.UDFType; //导入依赖的package包/类
private <C,I> void register(Class<? extends I> clazz, ArrayListMultimap<String,Class<? extends I>> methods) {
Description desc = clazz.getAnnotation(Description.class);
String[] names;
if (desc != null) {
names = desc.name().split(",");
for (int i=0; i<names.length; i++) {
names[i] = names[i].trim();
}
}else{
names = new String[]{clazz.getName().replace('.', '_')};
}
UDFType type = clazz.getAnnotation(UDFType.class);
if (type != null && !type.deterministic()) {
nonDeterministicUDFs.add(clazz);
}
for(int i=0; i<names.length;i++) {
methods.put(names[i].toLowerCase(), clazz);
}
}
示例3: buildFunctionsFromUDF
import org.apache.hadoop.hive.ql.udf.UDFType; //导入依赖的package包/类
static void buildFunctionsFromUDF(Set<Class<? extends UDF>> classes, List<FunctionDesc> list, String jarurl) {
for (Class<? extends UDF> clazz: classes) {
String [] names;
String value = null, extended = null;
Description desc = clazz.getAnnotation(Description.class);
// Check @Description annotation (if exists)
if (desc != null) {
names = desc.name().split(",");
for (int i=0; i<names.length; i++) {
names[i] = names[i].trim();
}
value = desc.value();
extended = desc.extended();
}
else {
names = new String [] {clazz.getName().replace('.','_')};
}
// actual function descriptor building
FunctionDescBuilder builder = new FunctionDescBuilder();
UDFType type = clazz.getDeclaredAnnotation(UDFType.class);
if (type != null) {
builder.setDeterministic(type.deterministic());
}
builder.setFunctionType(CatalogProtos.FunctionType.UDF);
if (value != null) {
builder.setDescription(value);
}
if (extended != null) {
builder.setExample(extended);
}
UDFInvocationDesc udfInvocation = new UDFInvocationDesc(CatalogProtos.UDFtype.HIVE, clazz.getName(), jarurl, true);
// verify 'evaluate' method and extract return type and parameter types
for (Method method: clazz.getMethods()) {
if (method.getName().equals("evaluate")) {
registerMethod(method, names, udfInvocation, builder, list);
}
}
}
}