@Override public Void visitFunctionCall(FunctionCall call, StringBuilder sb) throws RuntimeException { ImmutableList<LogicalExpression> args = call.args; sb.append(call.getName()); sb.append("("); for (int i = 0; i < args.size(); i++) { if (i != 0) { sb.append(", "); } args.get(i).accept(this, sb); } sb.append(") "); return null; }
public static LogicalExpression createExpression(String functionName, ExpressionPosition ep, List<LogicalExpression> args){ String name = replaceOpWithFuncName(functionName); if (isBooleanOperator(name)) { return new BooleanOperator(name, args, ep); } else { return new FunctionCall(name, args, ep); } }
public static OjaiFunctionsProcessor process(FunctionCall call) { final OjaiFunctionsProcessor processor = new OjaiFunctionsProcessor(); call.accept(processor, null); return processor; }
@Override public Boolean visitFunctionCall(FunctionCall call, LogicalExpression valueArg) { Matcher matcher = convertFromPattern.matcher(call.getName()); if (matcher.find()) { // convert function call to ConvertExpression ConvertExpression convert = new ConvertExpression(ConvertExpression.CONVERT_FROM, matcher.group(1), call.args.get(0), call.getPosition()); return visitConvertExpression(convert, valueArg); } return false; }
@Override public LogicalExpression visitFunctionCall(FunctionCall call, Void value) throws RuntimeException { List<LogicalExpression> args = Lists.newArrayList(); for (LogicalExpression arg : call.args) { args.add(arg.accept(this, null)); } return new FunctionCall(call.getName(), args, call.getPosition()); }
errorCollector = new ErrorCollectorImpl(); LogicalExpression thenExpression = new FunctionCall(call.getName(), newArgs, call.getPosition()).accept(this, functionLookupContext);
@Override public HoldingContainer visitAnyValueExpression(AnyValueExpression e, ClassGenerator<?> value) throws RuntimeException { List<LogicalExpression> newArgs = Lists.newArrayList(); newArgs.add(e.getInput()); // input_expr FunctionCall fc = new FunctionCall(AnyValueExpression.ANY_VALUE, newArgs, e.getPosition()); return fc.accept(this, value); }
call = new FunctionCall(call.getName(), args, call.getPosition()); errorCollector.addGeneralError(call.getPosition(), "Only ProjectRecordBatch could have complex writer function. You are using complex writer function " + call.getName() + " in a non-project operation!"); FunctionHolderExpression funcExpr = matchedFuncHolder.getExpr(call.getName(), argsWithCast, call.getPosition()); MajorType funcExprMajorType = funcExpr.getMajorType(); if (DecimalUtility.isObsoleteDecimalType(funcExprMajorType.getMinorType())) { return matchedNonDrillFuncHolder.getExpr(call.getName(), extArgsWithCast, call.getPosition());
@Override public Boolean visitFunctionCall(FunctionCall call, LogicalExpression valueArg) { Matcher matcher = convertFromPattern.matcher(call.getName()); if (matcher.find()) { // convert function call to ConvertExpression ConvertExpression convert = new ConvertExpression(ConvertExpression.CONVERT_FROM, matcher.group(1), call.args.get(0), call.getPosition()); return visitConvertExpression(convert, valueArg); } return false; }
@Override public LogicalExpression visitConvertExpression(ConvertExpression e, FunctionLookupContext functionLookupContext) { String convertFunctionName = e.getConvertFunction() + e.getEncodingType(); List<LogicalExpression> newArgs = Lists.newArrayList(); newArgs.add(e.getInput()); //input_expr FunctionCall fc = new FunctionCall(convertFunctionName, newArgs, e.getPosition()); return fc.accept(this, functionLookupContext); }
/** * Converts specified function call to be pushed into maprDB JSON scan. * * @param call function call to be pushed * @return CompareFunctionsProcessor instance which contains converted function call */ public static CompareFunctionsProcessor process(FunctionCall call) { return processWithEvaluator(call, new CompareFunctionsProcessor(call.getName())); }
private static void logFunctionResolutionError(ErrorCollector errorCollector, FunctionCall call) { // add error to collector StringBuilder sb = new StringBuilder(); sb.append("Missing function implementation: "); sb.append("["); sb.append(call.getName()); sb.append("("); boolean first = true; for(LogicalExpression e : call.args) { TypeProtos.MajorType mt = e.getMajorType(); if (first) { first = false; } else { sb.append(", "); } sb.append(mt.getMinorType().name()); sb.append("-"); sb.append(mt.getMode().name()); } sb.append(")"); sb.append("]"); errorCollector.addGeneralError(call.getPosition(), sb.toString()); }
@Override public LogicalExpression createCall(String funcName, List<LogicalExpression> inputFiled) { return new FunctionCall(funcName, inputFiled, ExpressionPosition.UNKNOWN); } };
@Override public HoldingContainer visitConvertExpression(ConvertExpression e, ClassGenerator<?> value) throws RuntimeException { String convertFunctionName = e.getConvertFunction() + e.getEncodingType(); List<LogicalExpression> newArgs = Lists.newArrayList(); newArgs.add(e.getInput()); // input_expr FunctionCall fc = new FunctionCall(convertFunctionName, newArgs, e.getPosition()); return fc.accept(this, value); }
public static OjaiFunctionsProcessor process(FunctionCall call) { final OjaiFunctionsProcessor processor = new OjaiFunctionsProcessor(); call.accept(processor, null); return processor; }
public static CompareFunctionsProcessor createFunctionsProcessorInstance(FunctionCall call, boolean nullComparatorSupported) { String functionName = call.getName(); CompareFunctionsProcessor evaluator = new CompareFunctionsProcessor(functionName); return createFunctionsProcessorInstanceInternal(call, nullComparatorSupported, evaluator); }
private static LogicalExpression getFunctionExpression(String name, HoldingContainer... args) { List<MajorType> argTypes = new ArrayList<MajorType>(args.length); List<LogicalExpression> argExpressions = new ArrayList<LogicalExpression>(args.length); for(HoldingContainer c : args) { argTypes.add(c.getMajorType()); argExpressions.add(new HoldingContainerExpression(c)); } return new FunctionCall(name, argExpressions, ExpressionPosition.UNKNOWN); }
FunctionCall fc = new FunctionCall(castFuncWithType, newArgs, e.getPosition()); return fc.accept(this, functionLookupContext);
public static MaprDBCompareFunctionsProcessor createFunctionsProcessorInstance(FunctionCall call, boolean nullComparatorSupported) { String functionName = call.getName(); MaprDBCompareFunctionsProcessor evaluator = new MaprDBCompareFunctionsProcessor(functionName); return createFunctionsProcessorInstanceInternal(call, nullComparatorSupported, evaluator); }