throw new SemanticException(SemanticAnalyzer.generateErrorMessage(expr,
ErrorMsg.INVALID_COLUMN
.getMsg("All column reference is not supported in the context")));
RowResolver input = ctx.getInputRR();
ExprNodeColumnListDesc columnList = new ExprNodeColumnListDesc();
assert expr.getChildCount() <= 1;
if (expr.getChildCount() == 1) {
// table aliased (select a.*, for example)
ASTNode child = (ASTNode) expr.getChild(0);
assert child.getType() == HiveParser.TOK_TABNAME;
assert child.getChildCount() == 1;
String tableAlias = BaseSemanticAnalyzer.unescapeIdentifier(child.getChild(0).getText());
HashMap<String, ColumnInfo> columns = input.getFieldMap(tableAlias);
if (columns == null) {
throw new SemanticException(ErrorMsg.INVALID_TABLE_ALIAS.getMsg(child));
}
for (Map.Entry<String, ColumnInfo> colMap : columns.entrySet()) {
ColumnInfo colInfo = colMap.getValue();
if (!colInfo.getIsVirtualCol()) {
columnList.addColumn(new ExprNodeColumnDesc(colInfo.getType(),
colInfo.getInternalName(), colInfo.getTabAlias(), false));
}
}
} else {
// all columns (select *, for example)
for (ColumnInfo colInfo : input.getColumnInfos()) {
if (!colInfo.getIsVirtualCol()) {
columnList.addColumn(new ExprNodeColumnDesc(colInfo.getType(),
colInfo.getInternalName(), colInfo.getTabAlias(), false));
}
}
}
return columnList;