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


Java Description类代码示例

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


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

示例1: register

import org.apache.hadoop.hive.ql.exec.Description; //导入依赖的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);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:HiveFunctionRegistry.java

示例2: register

import org.apache.hadoop.hive.ql.exec.Description; //导入依赖的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);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:HiveFunctionRegistry.java

示例3: parseOptions

import org.apache.hadoop.hive.ql.exec.Description; //导入依赖的package包/类
@Nonnull
protected final CommandLine parseOptions(String optionValue) throws UDFArgumentException {
    String[] args = optionValue.split("\\s+");
    Options opts = getOptions();
    opts.addOption("help", false, "Show function help");
    CommandLine cl = CommandLineUtils.parseOptions(args, opts);

    if (cl.hasOption("help")) {
        Description funcDesc = getClass().getAnnotation(Description.class);
        final String cmdLineSyntax;
        if (funcDesc == null) {
            cmdLineSyntax = getClass().getSimpleName();
        } else {
            String funcName = funcDesc.name();
            cmdLineSyntax = funcName == null ? getClass().getSimpleName()
                    : funcDesc.value().replace("_FUNC_", funcDesc.name());
        }
        StringWriter sw = new StringWriter();
        sw.write('\n');
        PrintWriter pw = new PrintWriter(sw);
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, cmdLineSyntax, null, opts,
            HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null, true);
        pw.flush();
        String helpMsg = sw.toString();
        throw new UDFArgumentException(helpMsg);
    }

    return cl;
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:31,代码来源:UDAFToOrderedList.java

示例4: parseOptions

import org.apache.hadoop.hive.ql.exec.Description; //导入依赖的package包/类
@Nonnull
protected final CommandLine parseOptions(@Nonnull String optionValue)
        throws UDFArgumentException {
    String[] args = optionValue.split("\\s+");
    Options opts = getOptions();
    opts.addOption("help", false, "Show function help");
    CommandLine cl = CommandLineUtils.parseOptions(args, opts);

    if (cl.hasOption("help")) {
        Description funcDesc = getClass().getAnnotation(Description.class);
        final String cmdLineSyntax;
        if (funcDesc == null) {
            cmdLineSyntax = getClass().getSimpleName();
        } else {
            String funcName = funcDesc.name();
            cmdLineSyntax = funcName == null ? getClass().getSimpleName()
                    : funcDesc.value().replace("_FUNC_", funcDesc.name());
        }
        StringWriter sw = new StringWriter();
        sw.write('\n');
        PrintWriter pw = new PrintWriter(sw);
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(pw, HelpFormatter.DEFAULT_WIDTH, cmdLineSyntax, null, opts,
            HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, null, true);
        pw.flush();
        String helpMsg = sw.toString();
        throw new UDFArgumentException(helpMsg);
    }

    return cl;
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:32,代码来源:UDFWithOptions.java

示例5: buildFunctionsFromUDF

import org.apache.hadoop.hive.ql.exec.Description; //导入依赖的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);
      }
    }
  }
}
 
开发者ID:apache,项目名称:tajo,代码行数:50,代码来源:HiveFunctionLoader.java


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