private SqlNode convertSqlCall(SqlCall sqlCall) { SqlOperator operator = sqlCall.getOperator(); if (operator != null) { Pair<SqlNode, SqlNode> matched = convMaster.matchSqlFunc(sqlCall); if (matched != null) { Preconditions.checkState(matched.getFirst() instanceof SqlCall); SqlCall sourceTmpl = (SqlCall) matched.getFirst(); Preconditions.checkState(sourceTmpl.operandCount() == sqlCall.operandCount()); SqlNode targetTmpl = matched.getSecond(); boolean isWindowCall = sourceTmpl.getOperator() instanceof SqlOverOperator; SqlParamsFinder sqlParamsFinder = SqlParamsFinder.newInstance(sourceTmpl, sqlCall, isWindowCall); return targetTmpl.accept(new SqlFuncFiller(sqlParamsFinder.getParamNodes(), isWindowCall)); } } return null; }
&& rowConstructor.operandCount() < targetRowType.getFieldCount()) { targetRowType = typeFactory.createStructType( targetRowType.getFieldList() .subList(0, rowConstructor.operandCount())); } else if (targetRowType.isStruct() && rowConstructor.operandCount() != targetRowType.getFieldCount()) { return; if (rowCount >= 2) { SqlCall firstRow = (SqlCall) operands.get(0); final int columnCount = firstRow.operandCount(); if (columnCount != thisRow.operandCount()) { throw newValidationError(node, RESOURCE.incompatibleValueType(
public void validateCall( SqlCall call, SqlValidatorScope scope) { final SqlOperator operator = call.getOperator(); if ((call.operandCount() == 0) && (operator.getSyntax() == SqlSyntax.FUNCTION_ID) && !call.isExpanded() && !conformance.allowNiladicParentheses()) { // For example, "LOCALTIME()" is illegal. (It should be // "LOCALTIME", which would have been handled as a // SqlIdentifier.) throw handleUnresolvedFunction(call, (SqlFunction) operator, ImmutableList.of(), null); } SqlValidatorScope operandScope = scope.getOperandScope(call); if (operator instanceof SqlFunction && ((SqlFunction) operator).getFunctionType() == SqlFunctionCategory.MATCH_RECOGNIZE && !(operandScope instanceof MatchRecognizeScope)) { throw newValidationError(call, Static.RESOURCE.functionMatchRecognizeOnly(call.toString())); } // Delegate validation to the operator. operator.validateCall(call, this, scope, operandScope); }
validateNodeFeature(node); SqlCall call = (SqlCall) node; for (int i = 0; i < call.operandCount(); i++) { registerOperandSubQueries(parentScope, call, i);
if (call.operandCount() > 0) {
alias = call.operand(1).toString(); final boolean needAlias = call.operandCount() > 2; expr = call.operand(0); newExpr =
&& call.operandCount() == 2) { List<SqlNode> list3 = startList(call.operand(0)); list3.add(call.operand(1));
&& call.operandCount() == 2) { List<SqlNode> list3 = startList(call.operand(0)); list3.add(call.operand(1));
&& call.operandCount() == 2) { List<SqlNode> list3 = startList(call.operand(0)); list3.add(call.operand(1));
private int effectiveArgCount(SqlCall call) { switch (call.getKind()) { case GROUPING: return call.operandCount(); case GROUP_ID: return groupExprs.size(); default: throw new AssertionError(call.getKind()); } }
private RelNode convertCursor(Blackboard bb, SubQuery subQuery) { final SqlCall cursorCall = (SqlCall) subQuery.node; assert cursorCall.operandCount() == 1; SqlNode query = cursorCall.operand(0); RelNode converted = convertQuery(query, false, false).rel; int iCursor = bb.cursors.size(); bb.cursors.add(converted); subQuery.expr = new RexInputRef( iCursor, converted.getRowType()); return converted; }
protected void validateUnnest(SqlCall call, SqlValidatorScope scope, RelDataType targetRowType) { for (int i = 0; i < call.operandCount(); i++) { SqlNode expandedItem = expand(call.operand(i), scope); call.setOperand(i, expandedItem); } validateQuery(call, scope, targetRowType); }
@Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { if (call.operandCount() == 1 && call.getOperandList().get(0).getKind() == SqlKind.COLLECTION_TABLE) { // do not create ( ) around the following TABLE clause writer.keyword(getName()); call.operand(0).unparse(writer, 0, 0); } else { SqlUtil.unparseFunctionSyntax(this, writer, call); } } }
public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { writer.keyword("CURSOR"); final SqlWriter.Frame frame = writer.startList("(", ")"); assert call.operandCount() == 1; call.operand(0).unparse(writer, leftPrec, rightPrec); writer.endList(frame); }
public void unparse( SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) { assert call.operandCount() == 1; call.operand(0).unparse(writer, operator.getLeftPrec(), operator.getRightPrec()); writer.keyword(operator.getName()); } },
public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { writer.keyword(getName()); final SqlWriter.Frame frame = writer.startList("(", ")"); assert call.operandCount() == 1; call.operand(0).unparse(writer, leftPrec, rightPrec); writer.endList(frame); }
public void unparse( SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) { assert call.operandCount() == 1; call.operand(0).unparse(writer, operator.getLeftPrec(), operator.getRightPrec()); writer.keyword(operator.getName()); } },
@Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { final SqlWriter.Frame frame = writer.startFunCall(getName()); call.operand(0).unparse(writer, 0, 0); if (call.operandCount() == 2) { call.operand(1).unparse(writer, 0, 0); writer.keyword("ON ERROR"); } writer.endFunCall(frame); } }
@Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { assert call.operandCount() == 2; final SqlWriter.Frame frame = writer.startFunCall("JSON_OBJECTAGG"); writer.keyword("KEY"); call.operand(0).unparse(writer, leftPrec, rightPrec); writer.keyword("VALUE"); call.operand(1).unparse(writer, leftPrec, rightPrec); writer.keyword(nullClause.sql); writer.endFunCall(frame); }
@Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { final SqlWriter.Frame frame = writer.startFunCall(getName()); if (call.operandCount() == 2) { call.operand(0).unparse(writer, 0, 100); writer.sep("TO"); call.operand(1).unparse(writer, 100, 0); } else { call.operand(0).unparse(writer, 0, 0); } writer.endFunCall(frame); }