@Override public int compare(SqlIdentifier o1, SqlIdentifier o2) { int linegap = o2.getParserPosition().getLineNum() - o1.getParserPosition().getLineNum(); if (linegap != 0) return linegap; return o2.getParserPosition().getColumnNum() - o1.getParserPosition().getColumnNum(); } });
/** * Looks up completion hints for a syntactically correct select SQL that has * been parsed into an expression tree. * * @param select the Select node of the parsed expression tree * @param pos indicates the position in the sql statement we want to get * completion hints for * @param hintList list of {@link SqlMoniker} (sql identifiers) that can * fill in at the indicated position */ void lookupSelectHints( SqlSelect select, SqlParserPos pos, Collection<SqlMoniker> hintList) { IdInfo info = idPositions.get(pos.toString()); if ((info == null) || (info.scope == null)) { SqlNode fromNode = select.getFrom(); final SqlValidatorScope fromScope = getFromScope(select); lookupFromHints(fromNode, fromScope, pos, hintList); } else { lookupNameCompletionHints(info.scope, info.id.names, info.id.getParserPosition(), hintList); } }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_238(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
for (int i = 0; i < id.names.size(); i++) { if (pos.toString().equals( id.getComponent(i).getParserPosition().toString())) { final List<SqlMoniker> objNames = new ArrayList<>(); SqlValidatorUtil.getSchemaObjectMonikers(
inputs[1] = SqlLiteral.createCharString( Util.last(id.names), id.getParserPosition()); SqlBasicCall item_call = new SqlBasicCall( SqlStdOperatorTable.ITEM, inputs, id.getParserPosition()); expandedExpr = item_call;
public SqlNode visit(SqlIdentifier id) { // Aliases, e.g. 'select a as x, b from t order by x'. if (id.isSimple() && getConformance().isSortByAlias()) { String alias = id.getSimple(); final SqlValidatorNamespace selectNs = getNamespace(select); final RelDataType rowType = selectNs.getRowTypeSansSystemColumns(); final SqlNameMatcher nameMatcher = catalogReader.nameMatcher(); RelDataTypeField field = nameMatcher.field(rowType, alias); if (field != null) { return nthSelectItem( field.getIndex(), id.getParserPosition()); } } // No match. Return identifier unchanged. return getScope().fullyQualify(id).identifier; }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_238(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
return false; final SqlParserPos startPosition = identifier.getParserPosition(); switch (identifier.names.size()) { case 1:
final public SqlWithItem WithItem() throws ParseException {SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_240(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if ("" != null) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
/** * Returns the position of the <code>i</code>th component of a compound * identifier, or the position of the whole identifier if that information * is not present. * * @param i Ordinal of component. * @return Position of i'th component */ public SqlParserPos getComponentParserPosition(int i) { assert (i >= 0) && (i < names.size()); return (componentPositions == null) ? getParserPosition() : componentPositions.get(i); }
/** * Returns the position of the <code>i</code>th component of a compound * identifier, or the position of the whole identifier if that information * is not present. * * @param i Ordinal of component. * @return Position of i'th component */ public SqlParserPos getComponentParserPosition(int i) { assert (i >= 0) && (i < names.size()); return (componentPositions == null) ? getParserPosition() : componentPositions.get(i); }
@Override public int compare(SqlIdentifier o1, SqlIdentifier o2) { int linegap = o2.getParserPosition().getLineNum() - o1.getParserPosition().getLineNum(); if (linegap != 0) return linegap; return o2.getParserPosition().getColumnNum() - o1.getParserPosition().getColumnNum(); } });
protected SqlNode expandDynamicStar(SqlIdentifier id, SqlIdentifier fqId) { if (DynamicRecordType.isDynamicStarColName(Util.last(fqId.names)) && !DynamicRecordType.isDynamicStarColName(Util.last(id.names))) { // Convert a column ref into ITEM(*, 'col_name') // for a dynamic star field in dynTable's rowType. SqlNode[] inputs = new SqlNode[2]; inputs[0] = fqId; inputs[1] = SqlLiteral.createCharString( Util.last(id.names), id.getParserPosition()); return new SqlBasicCall( SqlStdOperatorTable.ITEM, inputs, id.getParserPosition()); } return fqId; } }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_368(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_194(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_278(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_243(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_231(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_273(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }
final public SqlWithItem WithItem() throws ParseException { SqlIdentifier id; SqlNodeList columnList = null; SqlNode definition; id = SimpleIdentifier(); if (jj_2_234(2)) { columnList = ParenthesizedSimpleIdentifierList(); } else { ; } jj_consume_token(AS); definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY); {if (true) return new SqlWithItem(id.getParserPosition(), id, columnList, definition);} throw new Error("Missing return statement in function"); }