public static boolean isCustomUDF(ExprNodeGenericFuncDesc expr) { return isCustomUDF(expr.getFuncText()); }
public static boolean isCustomUDF(ExprNodeGenericFuncDesc expr) { return isCustomUDF(expr.getFuncText()); }
private List<RexNode> rewriteCaseChildren(ExprNodeGenericFuncDesc func, List<RexNode> childRexNodeLst) throws SemanticException { List<RexNode> newChildRexNodeLst = new ArrayList<RexNode>(); if (FunctionRegistry.getNormalizedFunctionName(func.getFuncText()).equals("case")) { RexNode firstPred = childRexNodeLst.get(0); int length = childRexNodeLst.size() % 2 == 1 ?
private List<RexNode> rewriteCaseChildren(ExprNodeGenericFuncDesc func, List<RexNode> childRexNodeLst) throws SemanticException { List<RexNode> newChildRexNodeLst = new ArrayList<RexNode>(); if (FunctionRegistry.getNormalizedFunctionName(func.getFuncText()).equals("case")) { RexNode firstPred = childRexNodeLst.get(0); int length = childRexNodeLst.size() % 2 == 1 ?
caseOrWhenexpr.getFuncText(), children); return newCaseOrWhenExpr; } else if (childUDF instanceof GenericUDFCase) { caseOrWhenexpr.getFuncText(), children); return newCaseOrWhenExpr; } else {
if (getFuncText(funcDesc.getFuncText(), 1) == null) { funcArgs.add(dynamicExpr); ExprNodeDesc funcExpr = ExprNodeGenericFuncDesc.newInstance(FunctionRegistry.getFunctionInfo(getFuncText(funcDesc.getFuncText(), srcPos)).getGenericUDF(), funcArgs);
caseOrWhenexpr.getFuncText(), children); return newCaseOrWhenExpr; } else if (childUDF instanceof GenericUDFCase) { caseOrWhenexpr.getFuncText(), children); return newCaseOrWhenExpr; } else {
ExprNodeGenericFuncDesc expr = (ExprNodeGenericFuncDesc) exprDesc; if ("not".equals(expr.getFuncText())) { if (expr.getChildren() != null && expr.getChildren().size() == 1) { ExprNodeDesc child = expr.getChildren().get(0); if (child instanceof ExprNodeGenericFuncDesc) { ExprNodeGenericFuncDesc childExpr = (ExprNodeGenericFuncDesc) child; if ("between".equals(childExpr.getFuncText())) { ExprNodeConstantDesc flag = (ExprNodeConstantDesc) childExpr.getChildren().get(0); List<ExprNodeDesc> newChildren = new ArrayList<>();
ExprNodeGenericFuncDesc expr = (ExprNodeGenericFuncDesc) exprDesc; if ("not".equals(expr.getFuncText())) { if (expr.getChildren() != null && expr.getChildren().size() == 1) { ExprNodeDesc child = expr.getChildren().get(0); if (child instanceof ExprNodeGenericFuncDesc) { ExprNodeGenericFuncDesc childExpr = (ExprNodeGenericFuncDesc) child; if ("between".equals(childExpr.getFuncText())) { ExprNodeConstantDesc flag = (ExprNodeConstantDesc) childExpr.getChildren().get(0); List<ExprNodeDesc> newChildren = new ArrayList<>();
private static void validateCheckExpr(ExprNodeDesc checkExpr) throws SemanticException { if(checkExpr instanceof ExprNodeGenericFuncDesc){ ExprNodeGenericFuncDesc funcDesc = (ExprNodeGenericFuncDesc)checkExpr; boolean isBuiltIn = FunctionRegistry.isBuiltInFuncExpr(funcDesc); boolean isPermanent = FunctionRegistry.isPermanentFunction(funcDesc); if(!isBuiltIn && !isPermanent) { throw new SemanticException(ErrorMsg.INVALID_CSTR_SYNTAX.getMsg("Temporary UDFs are not allowed " + "in Check Constraints")); } if(FunctionRegistry.impliesOrder(funcDesc.getFuncText())) { throw new SemanticException(ErrorMsg.INVALID_CSTR_SYNTAX.getMsg("Window functions are not allowed " + "in Check Constraints")); } } if(checkExpr.getChildren() == null) { return; } for(ExprNodeDesc childExpr:checkExpr.getChildren()){ validateCheckExpr(childExpr); } }
SqlOperator calciteOp = SqlFunctionConverter.getCalciteOperator(func.getFuncText(), func.getGenericUDF(), argTypeBldr.build(), retType); if (calciteOp.getKind() == SqlKind.CASE) {
SqlOperator calciteOp = SqlFunctionConverter.getCalciteOperator(func.getFuncText(), func.getGenericUDF(), argTypeBldr.build(), retType); if (calciteOp.getKind() == SqlKind.CASE) {
public static boolean isCustomUDF(ExprNodeGenericFuncDesc expr) { String udfName = expr.getFuncText(); if (udfName == null) { return false; } FunctionInfo funcInfo; try { funcInfo = FunctionRegistry.getFunctionInfo(udfName); } catch (SemanticException e) { LOG.warn("Failed to load " + udfName, e); funcInfo = null; } if (funcInfo == null) { return false; } boolean isNativeFunc = funcInfo.isNative(); return !isNativeFunc; }
SqlOperator calciteOp = SqlFunctionConverter.getCalciteOperator(func.getFuncText(), func.getGenericUDF(), argTypeBldr.build(), retType); expr = cluster.getRexBuilder().makeCall(calciteOp, childRexNodeLst);