public SqlMoniker lookupQualifiedName(SqlNode topNode, SqlParserPos pos) { final String posString = pos.toString(); IdInfo info = idPositions.get(posString); if (info != null) { final SqlQualified qualified = info.scope.fullyQualify(info.id); return new SqlIdentifierMoniker(qualified.identifier); } else { return null; } }
public void validateIdentifier(SqlIdentifier id, SqlValidatorScope scope) { final SqlQualified fqId = scope.fullyQualify(id); if (expandColumnReferences) { // NOTE jvs 9-Apr-2007: this doesn't cover ORDER BY, which has its // own ideas about qualification. id.assignNamesFrom(fqId.identifier); } else { Util.discard(fqId); } }
private Pair<String, String> findTableColumnPair(SqlIdentifier identifier, SqlValidatorScope scope) { SqlCall call = SqlUtil.makeCall(getOperatorTable(), identifier); if (call != null) { return null; } SqlQualified qualified = scope.fullyQualify(identifier); List<String> names = qualified.identifier.names; if (names.size() < 2) { return null; } return new Pair<>(names.get(names.size() - 2), Util.last(names)); }
/** * Returns the <code>ordinal</code>th item in the select list. */ private SqlNode nthSelectItem(int ordinal, final SqlParserPos pos) { // TODO: Don't expand the list every time. Maybe keep an expanded // version of each expression -- select lists and identifiers -- in // the validator. SqlNodeList expandedSelectList = expandStar( select.getSelectList(), select, false); SqlNode expr = expandedSelectList.get(ordinal); expr = stripAs(expr); if (expr instanceof SqlIdentifier) { expr = getScope().fullyQualify((SqlIdentifier) expr).identifier; } // Create a copy of the expression with the position of the order // item. return expr.clone(pos); }
id = scope.fullyQualify(id).identifier;
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; }
return call.accept(this); final SqlIdentifier fqId = getScope().fullyQualify(id).identifier; SqlNode expandedExpr = fqId;
expr = getScope().fullyQualify((SqlIdentifier) expr).identifier;
public SqlMoniker lookupQualifiedName(SqlNode topNode, SqlParserPos pos) { final String posString = pos.toString(); IdInfo info = idPositions.get(posString); if (info != null) { final SqlQualified qualified = info.scope.fullyQualify(info.id); return new SqlIdentifierMoniker(qualified.identifier); } else { return null; } }
public SqlMoniker lookupQualifiedName(SqlNode topNode, SqlParserPos pos) { final String posString = pos.toString(); IdInfo info = idPositions.get(posString); if (info != null) { final SqlQualified qualified = info.scope.fullyQualify(info.id); return new SqlIdentifierMoniker(qualified.identifier); } else { return null; } }
public void validateIdentifier(SqlIdentifier id, SqlValidatorScope scope) { final SqlQualified fqId = scope.fullyQualify(id); if (expandColumnReferences) { // NOTE jvs 9-Apr-2007: this doesn't cover ORDER BY, which has its // own ideas about qualification. id.assignNamesFrom(fqId.identifier); } else { Util.discard(fqId); } }
public void validateIdentifier(SqlIdentifier id, SqlValidatorScope scope) { final SqlQualified fqId = scope.fullyQualify(id); if (expandColumnReferences) { // NOTE jvs 9-Apr-2007: this doesn't cover ORDER BY, which has its // own ideas about qualification. id.assignNamesFrom(fqId.identifier); } else { Util.discard(fqId); } }
@Override public SqlValidatorTable getTable() { final SqlNode toUnnest = unnest.operand(0); if (toUnnest instanceof SqlIdentifier) { // When operand of SqlIdentifier type does not have struct, fake a table // for UnnestNamespace final SqlIdentifier id = (SqlIdentifier) toUnnest; final SqlQualified qualified = this.scope.fullyQualify(id); return qualified.namespace.getTable(); } return null; }
@Override public SqlValidatorTable getTable() { final SqlNode toUnnest = unnest.operand(0); if (toUnnest instanceof SqlIdentifier) { // When operand of SqlIdentifier type does not have struct, fake a table // for UnnestNamespace final SqlIdentifier id = (SqlIdentifier) toUnnest; final SqlQualified qualified = this.scope.fullyQualify(id); return qualified.namespace.getTable(); } return null; }
private Pair<String, String> findTableColumnPair(SqlIdentifier identifier, SqlValidatorScope scope) { SqlCall call = SqlUtil.makeCall(getOperatorTable(), identifier); if (call != null) { return null; } SqlQualified qualified = scope.fullyQualify(identifier); List<String> names = qualified.identifier.names; if (names.size() < 2) { return null; } return new Pair<>(names.get(names.size() - 2), Util.last(names)); }
private Pair<String, String> findTableColumnPair(SqlIdentifier identifier, SqlValidatorScope scope) { SqlCall call = SqlUtil.makeCall(getOperatorTable(), identifier); if (call != null) { return null; } SqlQualified qualified = scope.fullyQualify(identifier); List<String> names = qualified.identifier.names; if (names.size() < 2) { return null; } return new Pair<>(names.get(names.size() - 2), Util.last(names)); }
public SqlNode visit(SqlIdentifier id) { // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlCall call = SqlUtil.makeCall(getScope().getValidator().getOperatorTable(), id); if (call != null) { return call; } return getScope().fullyQualify(id).identifier; }
public SqlNode visit(SqlIdentifier id) { // First check for builtin functions which don't have parentheses, // like "LOCALTIME". final SqlCall call = SqlUtil.makeCall(getScope().getValidator().getOperatorTable(), id); if (call != null) { return call; } return getScope().fullyQualify(id).identifier; }
@Override public SqlNode visit(SqlIdentifier id) { // First check for builtin functions which don't have // parentheses, like "LOCALTIME". SqlCall call = SqlUtil.makeCall( validator.getOperatorTable(), id); if (call != null) { return call.accept(this); } final SqlIdentifier fqId = getScope().fullyQualify(id).identifier; SqlNode expandedExpr = expandDynamicStar(id, fqId); validator.setOriginal(expandedExpr, id); return expandedExpr; }
@Override public SqlNode visit(SqlIdentifier id) { // First check for builtin functions which don't have // parentheses, like "LOCALTIME". SqlCall call = SqlUtil.makeCall( validator.getOperatorTable(), id); if (call != null) { return call.accept(this); } final SqlIdentifier fqId = getScope().fullyQualify(id).identifier; SqlNode expandedExpr = expandDynamicStar(id, fqId); validator.setOriginal(expandedExpr, id); return expandedExpr; }