public static GenericUDAFEvaluator getEvaluator(String aggregationFunctionName, TypeInfo typeInfo) throws SemanticException { GenericUDAFResolver resolver = FunctionRegistry.getGenericUDAFResolver(aggregationFunctionName); TypeInfo[] parameters = new TypeInfo[] { typeInfo }; GenericUDAFEvaluator evaluator = resolver.getEvaluator(parameters); return evaluator; }
boolean isAllColumns) throws SemanticException { GenericUDAFResolver udafResolver = getGenericUDAFResolver(name); if (udafResolver == null) { return null;
boolean isAllColumns) throws SemanticException { GenericUDAFResolver udafResolver = getGenericUDAFResolver(name); if (udafResolver == null) { return null;
FunctionRegistry.getGenericUDAFResolver(aggr.getGenericUDAFName()); if (udaf instanceof GenericUDAFSum) {
String functionName = SemanticAnalyzer.unescapeIdentifier(expressionTree.getChild(0) .getText()); GenericUDAFResolver udafResolver = FunctionRegistry.getGenericUDAFResolver(functionName); if (udafResolver != null) {
FunctionRegistry.getGenericUDAFResolver(aggr.getGenericUDAFName()); if (udaf instanceof GenericUDAFSum) {
String functionName = SemanticAnalyzer.unescapeIdentifier(expressionTree.getChild(0) .getText()); GenericUDAFResolver udafResolver = FunctionRegistry.getGenericUDAFResolver(functionName); if (udafResolver != null) {
static void checkForSubqueries(ASTNode node, boolean disallow) throws SemanticException { // allow NOT but throw an error for rest if(node.getType() == HiveParser.TOK_SUBQUERY_EXPR && disallow) { throw new CalciteSubquerySemanticException(ErrorMsg.UNSUPPORTED_SUBQUERY_EXPRESSION.getMsg( "Invalid subquery. Subquery in UDAF is not allowed.")); } if (node.getType() == HiveParser.TOK_FUNCTION || node.getType() == HiveParser.TOK_FUNCTIONDI || node.getType() == HiveParser.TOK_FUNCTIONSTAR) { if (node.getChild(0).getType() == HiveParser.Identifier) { String functionName = SemanticAnalyzer.unescapeIdentifier(node.getChild(0).getText()); GenericUDAFResolver udafResolver = FunctionRegistry.getGenericUDAFResolver(functionName); if (udafResolver != null) { disallow = disallow || true; } } } for(int i=0; i<node.getChildCount(); i++) { checkForSubqueries((ASTNode)node.getChild(i), disallow); } } /*
throw new SemanticException(ErrorMsg.MISSING_OVER_CLAUSE.getMsg(functionName)); if (FunctionRegistry.getGenericUDAFResolver(functionName) != null) { if(containsLeadLagUDF(expressionTree) && !parentIsWindowSpec) { throw new SemanticException(ErrorMsg.MISSING_OVER_CLAUSE.getMsg(functionName));
throw new SemanticException(ErrorMsg.MISSING_OVER_CLAUSE.getMsg(functionName)); if (FunctionRegistry.getGenericUDAFResolver(functionName) != null) { if(containsLeadLagUDF(expressionTree)) { throw new SemanticException(ErrorMsg.MISSING_OVER_CLAUSE.getMsg(functionName));
boolean isAllColumns) throws SemanticException { GenericUDAFResolver udafResolver = getGenericUDAFResolver(name); if (udafResolver == null) { return null;
boolean isAllColumns) throws SemanticException { GenericUDAFResolver udafResolver = getGenericUDAFResolver(name); if (udafResolver == null) { return null;
public static boolean isNonAggregateFunctionAST(ASTNode node) { int exprTokenType = node.getType(); if (exprTokenType == HiveParser.TOK_FUNCTION || exprTokenType == HiveParser.TOK_FUNCTIONDI || exprTokenType == HiveParser.TOK_FUNCTIONSTAR) { assert (node.getChildCount() != 0); if (node.getChild(0).getType() == HiveParser.Identifier) { String functionName = BaseSemanticAnalyzer.unescapeIdentifier(node.getChild(0).getText()); try { if (FunctionRegistry.getGenericUDAFResolver(functionName) == null) { return true; } } catch (SemanticException e) { log.error("Error trying to find whether {} is udf node.", getString(node), e); return false; } } } return false; }
public static boolean isAggregateAST(ASTNode node) { int exprTokenType = node.getType(); if (exprTokenType == HiveParser.TOK_FUNCTION || exprTokenType == HiveParser.TOK_FUNCTIONDI || exprTokenType == HiveParser.TOK_FUNCTIONSTAR) { assert (node.getChildCount() != 0); if (node.getChild(0).getType() == HiveParser.Identifier) { String functionName = BaseSemanticAnalyzer.unescapeIdentifier(node.getChild(0).getText()); try { if (FunctionRegistry.getGenericUDAFResolver(functionName) != null) { return true; } } catch (SemanticException e) { log.error("Error trying to find whether {} is aggregate.", getString(node), e); return false; } } } return false; }
public static boolean isAggregateAST(ASTNode node) { int exprTokenType = node.getType(); if (exprTokenType == HiveParser.TOK_FUNCTION || exprTokenType == HiveParser.TOK_FUNCTIONDI || exprTokenType == HiveParser.TOK_FUNCTIONSTAR) { assert (node.getChildCount() != 0); if (node.getChild(0).getType() == HiveParser.Identifier) { String functionName = BaseSemanticAnalyzer.unescapeIdentifier(node.getChild(0).getText()); try { if (FunctionRegistry.getGenericUDAFResolver(functionName) != null) { return true; } } catch (SemanticException e) { log.error("Error trying to find whether {} is aggregate.", getString(node), e); return false; } } } return false; }
public static boolean isNonAggregateFunctionAST(ASTNode node) { int exprTokenType = node.getType(); if (exprTokenType == HiveParser.TOK_FUNCTION || exprTokenType == HiveParser.TOK_FUNCTIONDI || exprTokenType == HiveParser.TOK_FUNCTIONSTAR) { assert (node.getChildCount() != 0); if (node.getChild(0).getType() == HiveParser.Identifier) { String functionName = BaseSemanticAnalyzer.unescapeIdentifier(node.getChild(0).getText()); try { if (FunctionRegistry.getGenericUDAFResolver(functionName) == null) { return true; } } catch (SemanticException e) { log.error("Error trying to find whether {} is udf node.", getString(node), e); return false; } } } return false; }
FunctionRegistry.getGenericUDAFResolver(functionName.toString()); if (resolver == null) { throw new HiveException("Could not find function with name " +
static int checkAggOrWindowing(ASTNode expressionTree) throws SemanticException { int exprTokenType = expressionTree.getToken().getType(); if (exprTokenType == HiveParser.TOK_FUNCTION || exprTokenType == HiveParser.TOK_FUNCTIONDI || exprTokenType == HiveParser.TOK_FUNCTIONSTAR) { assert (expressionTree.getChildCount() != 0); if (expressionTree.getChild(expressionTree.getChildCount()-1).getType() == HiveParser.TOK_WINDOWSPEC) { return 2; } if (expressionTree.getChild(0).getType() == HiveParser.Identifier) { String functionName = SemanticAnalyzer.unescapeIdentifier(expressionTree.getChild(0) .getText()); if (FunctionRegistry.getGenericUDAFResolver(functionName) != null) { return 1; } } } int r = 0; for (int i = 0; i < expressionTree.getChildCount(); i++) { int c = checkAggOrWindowing((ASTNode) expressionTree.getChild(i)); r = Math.max(r, c); } return r; }
String functionName = unescapeIdentifier(expressionTree.getChild(0) .getText()); if (FunctionRegistry.getGenericUDAFResolver(functionName) != null) { aggregations.put(expressionTree.toStringTree(), expressionTree); FunctionInfo fi = FunctionRegistry.getFunctionInfo(functionName);
throw new SemanticException(ErrorMsg.MISSING_OVER_CLAUSE.getMsg(functionName)); if (FunctionRegistry.getGenericUDAFResolver(functionName) != null) { if(containsLeadLagUDF(expressionTree)) { throw new SemanticException(ErrorMsg.MISSING_OVER_CLAUSE.getMsg(functionName));