Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions fe/src/com/baidu/palo/analysis/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.baidu.palo.catalog.Catalog;
import com.baidu.palo.catalog.Column;
import com.baidu.palo.catalog.Database;
import com.baidu.palo.catalog.InfoSchemaDb;
import com.baidu.palo.catalog.Table;
import com.baidu.palo.cluster.ClusterNamespace;
import com.baidu.palo.catalog.Type;
Expand Down Expand Up @@ -525,6 +526,10 @@ public SlotDescriptor registerColumnRef(TableName tblName, String colName) throw
if (tblName == null) {
d = resolveColumnRef(colName);
} else {
if (InfoSchemaDb.isInfoSchemaDb(tblName.getDb()) ||
(tblName.getDb() == null && InfoSchemaDb.isInfoSchemaDb(getDefaultDb()))) {
tblName = new TableName(tblName.getDb(), tblName.getTbl().toLowerCase());
}
d = resolveColumnRef(tblName, colName);
}
if (d == null && hasAncestors() && isSubquery) {
Expand Down
4 changes: 2 additions & 2 deletions fe/src/com/baidu/palo/analysis/ExprSubstitutionMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public ExprSubstitutionMap() {
}

// Only used to convert show statement to select statement
public ExprSubstitutionMap(boolean check_analyzed) {
public ExprSubstitutionMap(boolean checkAnalyzed) {
this(Lists.<Expr>newArrayList(), Lists.<Expr>newArrayList());
this.checkAnalyzed_ = false;
this.checkAnalyzed_ = checkAnalyzed;
}

public ExprSubstitutionMap(List<Expr> lhs, List<Expr> rhs) {
Expand Down
2 changes: 1 addition & 1 deletion fe/src/com/baidu/palo/analysis/ShowVariablesStmt.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public SelectStmt toSelectStmt(Analyzer analyzer) {
analyze(analyzer);
// Columns
SelectList selectList = new SelectList();
ExprSubstitutionMap aliasMap = new ExprSubstitutionMap();
ExprSubstitutionMap aliasMap = new ExprSubstitutionMap(false);
TableName tableName = null;
if (type == SetType.GLOBAL) {
tableName = new TableName(InfoSchemaDb.getDatabaseName(), "GLOBAL_VARIABLES");
Expand Down
11 changes: 11 additions & 0 deletions fe/src/com/baidu/palo/catalog/InfoSchemaDb.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,15 @@ public Table getTable(String name) {
public static String getFullInfoSchemaDbName(String cluster) {
return ClusterNamespace.getDbFullName(cluster, DATABASE_NAME);
}

public static boolean isInfoSchemaDb(String dbName) {
if (dbName == null) {
return false;
}
String[] ele = dbName.split(ClusterNamespace.CLUSTER_DELIMITER);
if (ele.length == 2) {
dbName = ele[1];
}
return DATABASE_NAME.equalsIgnoreCase(dbName);
}
}