public RelDataType resolveColumn(String name, SqlNode ctx) { final SqlValidatorNamespace selectNs = validator.getNamespace(select); final RelDataType rowType = selectNs.getRowType(); final RelDataTypeField field = validator.catalogReader.field(rowType, name); if (field != null) { return field.getType(); } final SqlValidatorScope selectScope = validator.getSelectScope(select); return selectScope.resolveColumn(name, ctx); }
public SqlIdentifier fullyQualify(SqlIdentifier identifier) { // If it's a simple identifier, look for an alias. if (identifier.isSimple() && validator.getConformance().isSortByAlias()) { String name = identifier.names.get(0); final SqlValidatorNamespace selectNs = validator.getNamespace(select); final RelDataType rowType = selectNs.getRowType(); if (validator.catalogReader.field(rowType, name) != null) { return identifier; } } return super.fullyQualify(identifier); }