for (int i = 0, count = list.size(); i < count; i++) { SqlNode operand = list.get(i); newOperand = performUnconditionalRewrites( false); if (newOperand != null) { list.getList().set(i, newOperand); final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO); selectList.add(SqlIdentifier.star(SqlParserPos.ZERO)); final SqlNodeList orderList; if (getInnerSelect(node) != null && isAggregate(getInnerSelect(node))) { for (int i = 0; i < orderList.size(); i++) { SqlNode sqlNode = orderList.get(i); SqlNodeList selectList2 = getInnerSelect(node).getSelectList(); for (Ord<SqlNode> sel : Ord.zip(selectList2)) { if (stripAs(sel.e).equalsDeep(sqlNode, Litmus.IGNORE)) { orderList.set(i, SqlLiteral.createExactNumeric(Integer.toString(sel.i + 1), SqlParserPos.ZERO)); final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO); selectList.add(SqlIdentifier.star(SqlParserPos.ZERO)); return new SqlSelect(SqlParserPos.ZERO, null, selectList, call.operand(0), null, null, null, null, null, null, null);
final List<Map.Entry<String, RelDataType>> fieldList = new ArrayList<>(); for (int i = 0; i < selectItems.size(); i++) { SqlNode selectItem = selectItems.get(i); if (selectItem instanceof SqlSelect) { handleScalarSubQuery( new SqlNodeList( expandedSelectItems, selectItems.getParserPosition()); if (shouldExpandIdentifiers()) { select.setSelectList(newSelectList);
/** * Parses a VALUES leaf query expression. */ final public SqlNode TableConstructor() throws ParseException { SqlNodeList rowConstructorList; final Span s; jj_consume_token(VALUES); s = span(); rowConstructorList = RowConstructorList(s); {if (true) return SqlStdOperatorTable.VALUES.createCall( s.end(this), rowConstructorList.toArray());} throw new Error("Missing return statement in function"); }
public SqlNodeList expandStar( SqlNodeList selectList, SqlSelect select, boolean includeSystemVars) { final List<SqlNode> list = new ArrayList<>(); final List<Map.Entry<String, RelDataType>> types = new ArrayList<>(); for (int i = 0; i < selectList.size(); i++) { final SqlNode selectItem = selectList.get(i); final RelDataType originalType = getValidatedNodeTypeIfKnown(selectItem); expandSelectItem( selectItem, select, Util.first(originalType, unknownType), list, catalogReader.nameMatcher().createSet(), types, includeSystemVars); } getRawSelectScope(select).setExpandedSelectList(list); return new SqlNodeList(list, SqlParserPos.ZERO); }
final public SqlNodeList WithList() throws ParseException { SqlWithItem withItem; SqlParserPos pos; SqlNodeList list; jj_consume_token(WITH); list = new SqlNodeList(getPos()); withItem = WithItem(); list.add(withItem); label_22: while (true) { if (jj_2_237(2)) { ; } else { break label_22; } jj_consume_token(COMMA); withItem = WithItem(); list.add(withItem); } {if (true) return list;} throw new Error("Missing return statement in function"); }
e2, using, new SqlNodeList(list.getList(), Span.of(using).end(this)));} } else { {if (true) return new SqlJoin(joinType.getParserPosition(),
call = TimestampAddFunctionCall(); name = call.getOperator().getName(); args = new SqlNodeList(call.getOperandList(), getPos()); break; default: call = TimestampDiffFunctionCall(); name = call.getOperator().getName(); args = new SqlNodeList(call.getOperandList(), getPos()); } else if (jj_2_670(2)) { jj_consume_token(CONVERT); jj_consume_token(LPAREN); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args = new SqlNodeList(getPos()); args.add(e); jj_consume_token(COMMA); tl = JdbcOdbcDataType(); args.add(tl); jj_consume_token(RPAREN); } else if (jj_2_671(2)) { s1 = span(); jj_consume_token(RPAREN); args = new SqlNodeList(s1.pos()); args.add(SqlIdentifier.star(s1.pos())); } else if (jj_2_667(2)) { jj_consume_token(LPAREN);
/** * List of compound identifiers in parentheses. The position extends from the * open parenthesis to the close parenthesis. */ final public Pair<SqlNodeList, SqlNodeList> ParenthesizedCompoundIdentifierList() throws ParseException { final Span s; final List<SqlNode> list = new ArrayList<SqlNode>(); final List<SqlNode> extendList = new ArrayList<SqlNode>(); jj_consume_token(LPAREN); s = span(); CompoundIdentifierTypeCommaList(list, extendList); jj_consume_token(RPAREN); {if (true) return Pair.of(new SqlNodeList(list, s.end(this)), new SqlNodeList(extendList, s.end(this)));} throw new Error("Missing return statement in function"); }
private void validateDefinitions(SqlMatchRecognize mr, MatchRecognizeScope scope) { final Set<String> aliases = catalogReader.nameMatcher().createSet(); for (SqlNode item : mr.getPatternDefList().getList()) { final String alias = alias(item); if (!aliases.add(alias)) { for (SqlNode item : mr.getPatternDefList().getList()) { final String alias = alias(item); SqlNode expand = expand(item, scope); new SqlNodeList(sqlNodes, mr.getPatternDefList().getParserPosition()); inferUnknownTypes(unknownType, scope, list); for (SqlNode node : list) {
public SqlNode visit(SqlNodeList list) { SqlNodeList copy = new SqlNodeList(list.getParserPosition()); for (SqlNode node : list) { copy.add(node.accept(this)); } return copy; }
expandedList.add(expandedItem); groupList = new SqlNodeList(expandedList, groupList.getParserPosition()); select.setGroupBy(groupList); for (SqlNode groupItem : expandedList) { && ((SqlNodeList) groupItem).size() == 0) { continue;
public void validateWithItem(SqlWithItem withItem) { if (withItem.columnList != null) { final RelDataType rowType = getValidatedNodeType(withItem.query); final int fieldCount = rowType.getFieldCount(); if (withItem.columnList.size() != fieldCount) { throw newValidationError(withItem.columnList, RESOURCE.columnCountMismatch()); } SqlValidatorUtil.checkIdentifierListForDuplicates( withItem.columnList.getList(), validationErrorFunction); } else { // Luckily, field names have not been make unique yet. final List<String> fieldNames = getValidatedNodeType(withItem.query).getFieldNames(); final int i = Util.firstDuplicate(fieldNames); if (i >= 0) { throw newValidationError(withItem.query, RESOURCE.duplicateColumnAndNoColumnList(fieldNames.get(i))); } } }
keywordList = new SqlNodeList(keywords, s.addAll(keywords).pos()); jj_consume_token(INTO); table = CompoundIdentifier(); final Pair<SqlNodeList, SqlNodeList> p; p = ParenthesizedCompoundIdentifierList(); if (p.right.size() > 0) { table = extend(table, p.right); if (p.left.size() > 0) { columnList = p.left;
valueList = new SqlNodeList(Collections.singletonList(value), value.getParserPosition()); } else { valueList.toArray());} throw new Error("Missing return statement in function");
@SuppressWarnings("unchecked") public List<ColumnDefinition> fieldList() { return (List<ColumnDefinition>) ((List<? extends SqlNode>) fieldList.getList()); }
SqlNodeList expandedOrderList = new SqlNodeList( expandList, orderList.getParserPosition()); select.setOrderBy(expandedOrderList);