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); }
public final SqlNode visit(SqlCall call) { SqlValidatorScope oldScope = scopes.peek(); SqlValidatorScope newScope = oldScope.getOperandScope(call); scopes.push(newScope); SqlNode result = visitScoped(call); scopes.pop(); return result; }
public final SqlNode visit(SqlCall call) { SqlValidatorScope oldScope = scopes.peek(); SqlValidatorScope newScope = oldScope.getOperandScope(call); scopes.push(newScope); SqlNode result = visitScoped(call); scopes.pop(); return result; }
protected List<RelDataType> constructArgTypeList( SqlValidator validator, SqlValidatorScope scope, SqlCall call, List<SqlNode> args, boolean convertRowArgToColumnList) { // Scope for operands. Usually the same as 'scope'. final SqlValidatorScope operandScope = scope.getOperandScope(call); final ImmutableList.Builder<RelDataType> argTypeBuilder = ImmutableList.builder(); for (SqlNode operand : args) { RelDataType nodeType; // for row arguments that should be converted to ColumnList // types, set the nodeType to a ColumnList type but defer // validating the arguments of the row constructor until we know // for sure that the row argument maps to a ColumnList type if (operand.getKind() == SqlKind.ROW && convertRowArgToColumnList) { RelDataTypeFactory typeFactory = validator.getTypeFactory(); nodeType = typeFactory.createSqlType(SqlTypeName.COLUMN_LIST); ((SqlValidatorImpl) validator).setValidatedNodeType(operand, nodeType); } else { nodeType = validator.deriveType(operandScope, operand); } argTypeBuilder.add(nodeType); } return argTypeBuilder.build(); }
protected List<RelDataType> constructArgTypeList( SqlValidator validator, SqlValidatorScope scope, SqlCall call, List<SqlNode> args, boolean convertRowArgToColumnList) { // Scope for operands. Usually the same as 'scope'. final SqlValidatorScope operandScope = scope.getOperandScope(call); final ImmutableList.Builder<RelDataType> argTypeBuilder = ImmutableList.builder(); for (SqlNode operand : args) { RelDataType nodeType; // for row arguments that should be converted to ColumnList // types, set the nodeType to a ColumnList type but defer // validating the arguments of the row constructor until we know // for sure that the row argument maps to a ColumnList type if (operand.getKind() == SqlKind.ROW && convertRowArgToColumnList) { RelDataTypeFactory typeFactory = validator.getTypeFactory(); nodeType = typeFactory.createSqlType(SqlTypeName.COLUMN_LIST); ((SqlValidatorImpl) validator).setValidatedNodeType(operand, nodeType); } else { nodeType = validator.deriveType(operandScope, operand); } argTypeBuilder.add(nodeType); } return argTypeBuilder.build(); }
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); }
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); }
SqlValidatorScope newScope = scope.getOperandScope(call); scopes.push(newScope);
SqlValidatorScope newScope = scope.getOperandScope(call); scopes.push(newScope);
SqlValidatorScope newScope = scope.getOperandScope(call); scopes.push(newScope);
boolean convertRowArgToColumnList) { final SqlValidatorScope operandScope = scope.getOperandScope(call);
boolean convertRowArgToColumnList) { final SqlValidatorScope operandScope = scope.getOperandScope(call);