final SqlParserPos pos = call.getParserPosition(); throw SqlUtil.newContextException(pos, Static.RESOURCE.functionQuantifierNotAllowed(call.toString()));
SqlCall testCall = resolvedConstructor.createCall( call.getParserPosition(), call.getOperandList()); RelDataType returnType =
/** Creates a copy of a call with a new operator. */ private static SqlCall copy(SqlCall call, SqlOperator operator) { final List<SqlNode> list = call.getOperandList(); return new SqlBasicCall(operator, list.toArray(new SqlNode[list.size()]), call.getParserPosition()); }
/** Creates a copy of a call with a new operator. */ private static SqlCall copy(SqlCall call, SqlOperator operator) { final List<SqlNode> list = call.getOperandList(); return new SqlBasicCall(operator, list.toArray(new SqlNode[0]), call.getParserPosition()); }
/** Creates a copy of a call with a new operator. */ private static SqlCall copy(SqlCall call, SqlOperator operator) { final List<SqlNode> list = call.getOperandList(); return new SqlBasicCall(operator, list.toArray(new SqlNode[0]), call.getParserPosition()); }
@Override public SqlNode rewriteCall(SqlValidator validator, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); final SqlParserPos pos = call.getParserPosition(); return SqlStdOperatorTable.EXTRACT.createCall(pos, new SqlIntervalQualifier(timeUnit, null, SqlParserPos.ZERO), operands.get(0)); }
@Override public SqlNode rewriteCall(SqlValidator validator, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); final SqlParserPos pos = call.getParserPosition(); return SqlStdOperatorTable.EXTRACT.createCall(pos, new SqlIntervalQualifier(timeUnit, null, SqlParserPos.ZERO), operands.get(0)); }
public SqlNode result() { if (update || alwaysCopy) { return call.getOperator().createCall( call.getFunctionQuantifier(), call.getParserPosition(), clonedOperands); } else { return call; } }
@Override public SqlNode result() { if (update) { return call.getOperator().createCall( call.getFunctionQuantifier(), call.getParserPosition(), clonedOperands); } else { return call; } }
public SqlNode result() { if (update || alwaysCopy) { return call.getOperator().createCall( call.getFunctionQuantifier(), call.getParserPosition(), clonedOperands); } else { return call; } }
@Override public SqlNode result() { if (update) { return call.getOperator().createCall( call.getFunctionQuantifier(), call.getParserPosition(), clonedOperands); } else { return call; } }
private SqlTreeNode convertMatchRecognize(SqlCall call) { SqlMatchRecognize matchRecognize = (SqlMatchRecognize) call; SqlNode tableRef = matchRecognize.getTableRef(); SqlTreeNode input = convertFrom(tableRef); SqlNode pattern = matchRecognize.getPattern(); return SqlTreeNodes.cep(call.getParserPosition(), input, pattern); }
public SqlNode rewriteCall(SqlValidator validator, SqlCall call) { List<SqlNode> operands = call.getOperandList(); SqlParserPos pos = call.getParserPosition(); checkOperandCount( validator, getOperandTypeChecker(), call); assert operands.size() == 2; SqlNodeList whenList = new SqlNodeList(pos); SqlNodeList thenList = new SqlNodeList(pos); whenList.add(operands.get(1)); thenList.add(SqlLiteral.createNull(SqlParserPos.ZERO)); return SqlCase.createSwitched(pos, operands.get(0), whenList, thenList, SqlNode.clone(operands.get(0))); } }
public SqlNode rewriteCall(SqlValidator validator, SqlCall call) { List<SqlNode> operands = call.getOperandList(); SqlParserPos pos = call.getParserPosition(); checkOperandCount( validator, getOperandTypeChecker(), call); assert operands.size() == 2; SqlNodeList whenList = new SqlNodeList(pos); SqlNodeList thenList = new SqlNodeList(pos); whenList.add(operands.get(1)); thenList.add(SqlLiteral.createNull(SqlParserPos.ZERO)); return SqlCase.createSwitched(pos, operands.get(0), whenList, thenList, SqlNode.clone(operands.get(0))); } }
if (operands.size() != 2) { throw new SqlParseException( functionCall.getParserPosition(), "Watermark function 'withOffset(<rowtime_field>, <offset>)' only accept two arguments."); } else { throw new SqlParseException( functionCall.getParserPosition(), "Unsupported Watermark Function '" + funcName + "'");
public SqlNode rewriteCall(SqlValidator validator, SqlCall call) { validateQuantifier(validator, call); // check DISTINCT/ALL List<SqlNode> operands = call.getOperandList(); if (operands.size() == 1) { // No CASE needed return operands.get(0); } SqlParserPos pos = call.getParserPosition(); SqlNodeList whenList = new SqlNodeList(pos); SqlNodeList thenList = new SqlNodeList(pos); // todo: optimize when know operand is not null. for (SqlNode operand : Util.skipLast(operands)) { whenList.add( SqlStdOperatorTable.IS_NOT_NULL.createCall(pos, operand)); thenList.add(SqlNode.clone(operand)); } SqlNode elseExpr = Util.last(operands); assert call.getFunctionQuantifier() == null; return SqlCase.createSwitched(pos, null, whenList, thenList, elseExpr); } }
/** * Most dialects that natively support datetime floor will use this. * In those cases the call will look like TRUNC(datetime, 'year'). * * @param writer SqlWriter * @param call SqlCall * @param funName Name of the sql function to call * @param datetimeFirst Specify the order of the datetime & timeUnit * arguments */ public static void unparseDatetimeFunction(SqlWriter writer, SqlCall call, String funName, Boolean datetimeFirst) { SqlFunction func = new SqlFunction(funName, SqlKind.OTHER_FUNCTION, ReturnTypes.ARG0_NULLABLE_VARYING, null, null, SqlFunctionCategory.STRING); SqlCall call1; if (datetimeFirst) { call1 = call; } else { // switch order of operands SqlNode op1 = call.operand(0); SqlNode op2 = call.operand(1); call1 = call.getOperator().createCall(call.getParserPosition(), op2, op1); } SqlUtil.unparseFunctionSyntax(func, writer, call1); } }
/** * Most dialects that natively support datetime floor will use this. * In those cases the call will look like TRUNC(datetime, 'year'). * * @param writer SqlWriter * @param call SqlCall * @param funName Name of the sql function to call * @param datetimeFirst Specify the order of the datetime & timeUnit * arguments */ public static void unparseDatetimeFunction(SqlWriter writer, SqlCall call, String funName, Boolean datetimeFirst) { SqlFunction func = new SqlFunction(funName, SqlKind.OTHER_FUNCTION, ReturnTypes.ARG0_NULLABLE_VARYING, null, null, SqlFunctionCategory.STRING); SqlCall call1; if (datetimeFirst) { call1 = call; } else { // switch order of operands SqlNode op1 = call.operand(0); SqlNode op2 = call.operand(1); call1 = call.getOperator().createCall(call.getParserPosition(), op2, op1); } SqlUtil.unparseFunctionSyntax(func, writer, call1); } }
public SqlNode rewriteCall(SqlValidator validator, SqlCall call) { validateQuantifier(validator, call); // check DISTINCT/ALL List<SqlNode> operands = call.getOperandList(); if (operands.size() == 1) { // No CASE needed return operands.get(0); } SqlParserPos pos = call.getParserPosition(); SqlNodeList whenList = new SqlNodeList(pos); SqlNodeList thenList = new SqlNodeList(pos); // todo: optimize when know operand is not null. for (SqlNode operand : Util.skipLast(operands)) { whenList.add( SqlStdOperatorTable.IS_NOT_NULL.createCall(pos, operand)); thenList.add(SqlNode.clone(operand)); } SqlNode elseExpr = Util.last(operands); assert call.getFunctionQuantifier() == null; return SqlCase.createSwitched(pos, null, whenList, thenList, elseExpr); } }
private SqlTreeNode convertSetOp(SqlCall call) { final SqlTreeNode left = convertQueryRecursive(call.operand(0)); final SqlTreeNode right = convertQueryRecursive(call.operand(1)); switch (call.getKind()) { case UNION: return SqlTreeNodes.union(call.getParserPosition(), ImmutableList.of(left, right)); case INTERSECT: throw Util.unexpected(call.getKind()); case EXCEPT: throw Util.unexpected(call.getKind()); default: throw Util.unexpected(call.getKind()); } }