protected void validateWhereClause(SqlSelect select) { // validate WHERE clause final SqlNode where = select.getWhere(); if (where == null) { return; } final SqlValidatorScope whereScope = getWhereScope(select); final SqlNode expandedWhere = expand(where, whereScope); select.setWhere(expandedWhere); validateWhereOrOn(whereScope, expandedWhere, "WHERE"); }
SqlNode expanded = expand(selectItem, scope); final String alias = deriveAlias(
SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem);
private List<Map.Entry<String, RelDataType>> validateMeasure(SqlMatchRecognize mr, MatchRecognizeScope scope, boolean allRows) { final List<String> aliases = new ArrayList<>(); final List<SqlNode> sqlNodes = new ArrayList<>(); final SqlNodeList measures = mr.getMeasureList(); final List<Map.Entry<String, RelDataType>> fields = new ArrayList<>(); for (SqlNode measure : measures) { assert measure instanceof SqlCall; final String alias = deriveAlias(measure, aliases.size()); aliases.add(alias); SqlNode expand = expand(measure, scope); expand = navigationInMeasure(expand, allRows); setOriginal(expand, measure); inferUnknownTypes(unknownType, scope, expand); final RelDataType type = deriveType(scope, expand); setValidatedNodeType(measure, type); fields.add(Pair.of(alias, type)); sqlNodes.add( SqlStdOperatorTable.AS.createCall(SqlParserPos.ZERO, expand, new SqlIdentifier(alias, SqlParserPos.ZERO))); } SqlNodeList list = new SqlNodeList(sqlNodes, measures.getParserPosition()); inferUnknownTypes(unknownType, scope, list); for (SqlNode node : list) { validateExpr(node, scope); } mr.setOperand(SqlMatchRecognize.OPERAND_MEASURES, list); return fields; }
(SqlNodeList) expand(window.getOrderList(), windowScope); window.setOrderList(expandedOrderList); expandedOrderList.validate(this, windowScope); (SqlNodeList) expand(window.getPartitionList(), windowScope); window.setPartitionList(expandedPartitionList); expandedPartitionList.validate(this, windowScope);
for (SqlNode item : mr.getPatternDefList().getList()) { final String alias = alias(item); SqlNode expand = expand(item, scope); expand = navigationInDefine(expand, alias); setOriginal(expand, item);
SqlNode expand = expand(interval, scope); RelDataType type = deriveType(scope, expand); setValidatedNodeType(interval, type);
case ON: Preconditions.checkArgument(condition != null); SqlNode expandedCondition = expand(condition, joinScope); join.setOperand(5, expandedCondition); condition = join.getCondition();
protected void validateWhereClause(SqlSelect select) { // validate WHERE clause final SqlNode where = select.getWhere(); if (where == null) { return; } final SqlValidatorScope whereScope = getWhereScope(select); final SqlNode expandedWhere = expand(where, whereScope); select.setWhere(expandedWhere); validateWhereOrOn(whereScope, expandedWhere, "WHERE"); }
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); }
protected void validateWhereClause(SqlSelect select) { // validate WHERE clause final SqlNode where = select.getWhere(); if (where == null) { return; } final SqlValidatorScope whereScope = getWhereScope(select); final SqlNode expandedWhere = expand(where, whereScope); select.setWhere(expandedWhere); validateWhereOrOn(whereScope, expandedWhere, "WHERE"); }
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); }
public boolean checkAggregateExpr(SqlNode expr, boolean deep) { // Fully-qualify any identifiers in expr. if (deep) { expr = validator.expand(expr, this); } // Make sure expression is valid, throws if not. Pair<ImmutableList<SqlNode>, ImmutableList<SqlNode>> pair = getGroupExprs(); final AggChecker aggChecker = new AggChecker(validator, this, pair.left, pair.right, distinct); if (deep) { expr.accept(aggChecker); } // Return whether expression exactly matches one of the group // expressions. return aggChecker.isGroupExpr(expr); }
public boolean checkAggregateExpr(SqlNode expr, boolean deep) { // Fully-qualify any identifiers in expr. if (deep) { expr = validator.expand(expr, this); } // Make sure expression is valid, throws if not. Pair<ImmutableList<SqlNode>, ImmutableList<SqlNode>> pair = getGroupExprs(); final AggChecker aggChecker = new AggChecker(validator, this, pair.left, pair.right, distinct); if (deep) { expr.accept(aggChecker); } // Return whether expression exactly matches one of the group // expressions. return aggChecker.isGroupExpr(expr); }
SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem);
SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem);
private List<Map.Entry<String, RelDataType>> validateMeasure(SqlMatchRecognize mr, MatchRecognizeScope scope, boolean allRows) { final List<String> aliases = new ArrayList<>(); final List<SqlNode> sqlNodes = new ArrayList<>(); final SqlNodeList measures = mr.getMeasureList(); final List<Map.Entry<String, RelDataType>> fields = new ArrayList<>(); for (SqlNode measure : measures) { assert measure instanceof SqlCall; final String alias = deriveAlias(measure, aliases.size()); aliases.add(alias); SqlNode expand = expand(measure, scope); expand = navigationInMeasure(expand, allRows); setOriginal(expand, measure); inferUnknownTypes(unknownType, scope, expand); final RelDataType type = deriveType(scope, expand); setValidatedNodeType(measure, type); fields.add(Pair.of(alias, type)); sqlNodes.add( SqlStdOperatorTable.AS.createCall(SqlParserPos.ZERO, expand, new SqlIdentifier(alias, SqlParserPos.ZERO))); } SqlNodeList list = new SqlNodeList(sqlNodes, measures.getParserPosition()); inferUnknownTypes(unknownType, scope, list); for (SqlNode node : list) { validateExpr(node, scope); } mr.setOperand(SqlMatchRecognize.OPERAND_MEASURES, list); return fields; }
private List<Map.Entry<String, RelDataType>> validateMeasure(SqlMatchRecognize mr, MatchRecognizeScope scope, boolean allRows) { final List<String> aliases = new ArrayList<>(); final List<SqlNode> sqlNodes = new ArrayList<>(); final SqlNodeList measures = mr.getMeasureList(); final List<Map.Entry<String, RelDataType>> fields = new ArrayList<>(); for (SqlNode measure : measures) { assert measure instanceof SqlCall; final String alias = deriveAlias(measure, aliases.size()); aliases.add(alias); SqlNode expand = expand(measure, scope); expand = navigationInMeasure(expand, allRows); setOriginal(expand, measure); inferUnknownTypes(unknownType, scope, expand); final RelDataType type = deriveType(scope, expand); setValidatedNodeType(measure, type); fields.add(Pair.of(alias, type)); sqlNodes.add( SqlStdOperatorTable.AS.createCall(SqlParserPos.ZERO, expand, new SqlIdentifier(alias, SqlParserPos.ZERO))); } SqlNodeList list = new SqlNodeList(sqlNodes, measures.getParserPosition()); inferUnknownTypes(unknownType, scope, list); for (SqlNode node : list) { validateExpr(node, scope); } mr.setOperand(SqlMatchRecognize.OPERAND_MEASURES, list); return fields; }
for (SqlNode item : mr.getPatternDefList().getList()) { final String alias = alias(item); SqlNode expand = expand(item, scope); expand = navigationInDefine(expand, alias); setOriginal(expand, item);
for (SqlNode item : mr.getPatternDefList().getList()) { final String alias = alias(item); SqlNode expand = expand(item, scope); expand = navigationInDefine(expand, alias); setOriginal(expand, item);