public static boolean isBooleanOperator(String funcName) { String opName = replaceOpWithFuncName(funcName); return opName.equals("booleanAnd") || opName.equals("booleanOr"); }
public static LogicalExpression createBooleanOperator(String functionName, ExpressionPosition ep, List<LogicalExpression> args){ return new BooleanOperator(replaceOpWithFuncName(functionName), args, ep); }
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 boolean isBooleanOperator(String funcName) { String opName = replaceOpWithFuncName(funcName); return opName.equals("booleanAnd") || opName.equals("booleanOr"); }
public static LogicalExpression createBooleanOperator(String functionName, ExpressionPosition ep, List<LogicalExpression> args){ return new BooleanOperator(replaceOpWithFuncName(functionName), args, ep); }
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); } }
drillOpName = calciteOperator.getName(); } else { drillOpName = FunctionCallFactory.replaceOpWithFuncName(calciteOperator.getName());
/** * Given a SqlOperatorBinding, convert it to FunctionCall * @param opBinding the given SqlOperatorBinding * @return FunctionCall the converted FunctionCall */ public static FunctionCall convertSqlOperatorBindingToFunctionCall(final SqlOperatorBinding opBinding) { final List<LogicalExpression> args = Lists.newArrayList(); for (int i = 0; i < opBinding.getOperandCount(); ++i) { final RelDataType type = opBinding.getOperandType(i); final TypeProtos.MinorType minorType = getDrillTypeFromCalciteType(type); TypeProtos.DataMode dataMode = type.isNullable() ? TypeProtos.DataMode.OPTIONAL : TypeProtos.DataMode.REQUIRED; TypeProtos.MajorType.Builder builder = TypeProtos.MajorType.newBuilder() .setMode(dataMode) .setMinorType(minorType); if (Types.isDecimalType(minorType)) { builder .setScale(type.getScale()) .setPrecision(type.getPrecision()); } args.add(new MajorTypeInLogicalExpression(builder.build())); } final String drillFuncName = FunctionCallFactory.replaceOpWithFuncName(opBinding.getOperator().getName()); return new FunctionCall( drillFuncName, args, ExpressionPosition.UNKNOWN); }