Ejemplo n.º 1
0
  /**
   * Get the GenericUDAF evaluator for the name and argumentClasses.
   *
   * @param name the name of the UDAF
   * @param argumentOIs
   * @param isDistinct
   * @param isAllColumns
   * @return The UDAF evaluator
   */
  @SuppressWarnings("deprecation")
  public GenericUDAFEvaluator getGenericUDAFEvaluator(
      String name, List<ObjectInspector> argumentOIs, boolean isDistinct, boolean isAllColumns)
      throws SemanticException {

    GenericUDAFResolver udafResolver = getGenericUDAFResolver(name);
    if (udafResolver == null) {
      return null;
    }

    GenericUDAFEvaluator udafEvaluator;
    ObjectInspector args[] = new ObjectInspector[argumentOIs.size()];
    // Can't use toArray here because Java is dumb when it comes to
    // generics + arrays.
    for (int ii = 0; ii < argumentOIs.size(); ++ii) {
      args[ii] = argumentOIs.get(ii);
    }

    GenericUDAFParameterInfo paramInfo =
        new SimpleGenericUDAFParameterInfo(args, isDistinct, isAllColumns);
    if (udafResolver instanceof GenericUDAFResolver2) {
      udafEvaluator = ((GenericUDAFResolver2) udafResolver).getEvaluator(paramInfo);
    } else {
      udafEvaluator = udafResolver.getEvaluator(paramInfo.getParameters());
    }
    return udafEvaluator;
  }
Ejemplo n.º 2
0
 public WindowFunctionInfo(
     FunctionType functionType,
     String functionName,
     GenericUDAFResolver resolver,
     FunctionResource[] resources) {
   super(functionType, functionName, resolver, resources);
   WindowFunctionDescription def =
       AnnotationUtils.getAnnotation(resolver.getClass(), WindowFunctionDescription.class);
   supportsWindow = def == null ? true : def.supportsWindow();
   pivotResult = def == null ? false : def.pivotResult();
   impliesOrder = def == null ? false : def.impliesOrder();
 }