Package org.apache.tajo.engine.exception

Examples of org.apache.tajo.engine.exception.UndefinedFunctionException


          block.setHasGrouping();

          return new AggregationFunctionCallEval(countRows, (AggFunction) countRows.newInstance(),
              new EvalNode[] {});
        } catch (InternalException e) {
          throw new UndefinedFunctionException(CatalogUtil.
              getCanonicalName(countRows.getSignature(), new DataType[]{}));
        }
      }
      case GeneralSetFunction: {
        GeneralSetFunctionExpr setFunction = (GeneralSetFunctionExpr) expr;
        Expr[] params = setFunction.getParams();
        EvalNode[] givenArgs = new EvalNode[params.length];
        DataType[] paramTypes = new DataType[params.length];

        FunctionType functionType = setFunction.isDistinct() ?
            FunctionType.DISTINCT_AGGREGATION : FunctionType.AGGREGATION;
        givenArgs[0] = createEvalTree(plan, block, params[0]);
        if (setFunction.getSignature().equalsIgnoreCase("count")) {
          paramTypes[0] = CatalogUtil.newSimpleDataType(TajoDataTypes.Type.ANY);
        } else {
          paramTypes[0] = givenArgs[0].getValueType();
        }

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

        FunctionDesc funcDesc = catalog.getFunction(setFunction.getSignature(), functionType, paramTypes);
        if (!block.hasGroupbyNode()) {
          block.setHasGrouping();
        }
        try {
          return new AggregationFunctionCallEval(funcDesc, (AggFunction) funcDesc.newInstance(), givenArgs);
        } catch (InternalException e) {
          e.printStackTrace();
        }
      }
      break;

      case Function:
        FunctionExpr function = (FunctionExpr) expr;
        // Given parameters
        Expr[] params = function.getParams();
        EvalNode[] givenArgs = new EvalNode[params.length];
        DataType[] paramTypes = new DataType[params.length];

        for (int i = 0; i < params.length; i++) {
            givenArgs[i] = createEvalTree(plan, block, params[i]);
            paramTypes[i] = givenArgs[i].getValueType();
        }

        if (!catalog.containFunction(function.getSignature(), paramTypes)) {
            throw new UndefinedFunctionException(CatalogUtil.getCanonicalName(function.getSignature(), paramTypes));
        }

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

        try {
View Full Code Here

TOP

Related Classes of org.apache.tajo.engine.exception.UndefinedFunctionException

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.