Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.FunctionDesc


    if (!catalog.containFunction(expr.getSignature(), paramTypes)) {
      throw new NoSuchFunctionException(expr.getSignature(), paramTypes);
    }

    FunctionDesc funcDesc = catalog.getFunction(expr.getSignature(), paramTypes);

    try {
    CatalogProtos.FunctionType functionType = funcDesc.getFuncType();
    if (functionType == CatalogProtos.FunctionType.GENERAL
        || functionType == CatalogProtos.FunctionType.UDF) {
      return new GeneralFunctionEval(funcDesc, (GeneralFunction) funcDesc.newInstance(), givenArgs);
    } else if (functionType == CatalogProtos.FunctionType.AGGREGATION
        || functionType == CatalogProtos.FunctionType.UDA) {
      if (!ctx.currentBlock.hasNode(NodeType.GROUP_BY)) {
        ctx.currentBlock.setAggregationRequire();
      }
      return new AggregationFunctionCallEval(funcDesc, (AggFunction) funcDesc.newInstance(), givenArgs);
    } else if (functionType == CatalogProtos.FunctionType.DISTINCT_AGGREGATION
        || functionType == CatalogProtos.FunctionType.DISTINCT_UDA) {
      throw new PlanningException("Unsupported function: " + funcDesc.toString());
    } else {
      throw new PlanningException("Unsupported Function Type: " + functionType.name());
    }
    } catch (InternalException e) {
      throw new PlanningException(e);
View Full Code Here


  ///////////////////////////////////////////////////////////////////////////////////////////////////////////

  @Override
  public EvalNode visitCountRowsFunction(Context ctx, Stack<Expr> stack, CountRowsFunctionExpr expr)
      throws PlanningException {
    FunctionDesc countRows = catalog.getFunction("count", CatalogProtos.FunctionType.AGGREGATION,
        new TajoDataTypes.DataType[] {});
    if (countRows == null) {
      throw new NoSuchFunctionException(countRows.getSignature(), new TajoDataTypes.DataType[]{});
    }

    try {
      ctx.currentBlock.setAggregationRequire();

      return new AggregationFunctionCallEval(countRows, (AggFunction) countRows.newInstance(),
          new EvalNode[] {});
    } catch (InternalException e) {
      throw new NoSuchFunctionException(countRows.getSignature(), new TajoDataTypes.DataType[]{});
    }
  }
View Full Code Here

    if (!catalog.containFunction(setFunction.getSignature(), functionType, paramTypes)) {
      throw new NoSuchFunctionException(setFunction.getSignature(), paramTypes);
    }

    FunctionDesc funcDesc = catalog.getFunction(setFunction.getSignature(), functionType, paramTypes);
    if (!ctx.currentBlock.hasNode(NodeType.GROUP_BY)) {
      ctx.currentBlock.setAggregationRequire();
    }

    try {
      return new AggregationFunctionCallEval(funcDesc, (AggFunction) funcDesc.newInstance(), givenArgs);
    } catch (InternalException e) {
      throw new PlanningException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.tajo.catalog.FunctionDesc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.