boolean isCubeMeasure(ASTNode node) { String tabname = null; String colname; int nodeType = node.getToken().getType(); if (!(nodeType == HiveParser.TOK_TABLE_OR_COL || nodeType == HiveParser.DOT)) { return false; } if (nodeType == HiveParser.TOK_TABLE_OR_COL) { colname = ((ASTNode) node.getChild(0)).getText(); } else { // node in 'alias.column' format ASTNode tabident = HQLParser.findNodeByPath(node, TOK_TABLE_OR_COL, Identifier); ASTNode colIdent = (ASTNode) node.getChild(1); colname = colIdent.getText(); tabname = tabident.getText(); } String msrname = StringUtils.isBlank(tabname) ? colname : tabname + "." + colname; return isCubeMeasure(msrname); }
public void addExprToAlias(ASTNode expr, ASTNode alias) { exprToAlias.put(HQLParser.getString(expr).trim(), alias.getText().toLowerCase()); }