本文整理汇总了Java中org.apache.hadoop.hive.ql.parse.HiveParser.TOK_SELECTDI属性的典型用法代码示例。如果您正苦于以下问题:Java HiveParser.TOK_SELECTDI属性的具体用法?Java HiveParser.TOK_SELECTDI怎么用?Java HiveParser.TOK_SELECTDI使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hive.ql.parse.HiveParser
的用法示例。
在下文中一共展示了HiveParser.TOK_SELECTDI属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isDistinctClauseUsed
private boolean isDistinctClauseUsed(ASTNode node) {
if (node == null) {
return false;
}
if (node.getToken() != null) {
if (node.getToken().getType() == HiveParser.TOK_FUNCTIONDI
|| node.getToken().getType() == HiveParser.TOK_SELECTDI) {
return true;
}
}
for (int i = 0; i < node.getChildCount(); i++) {
if (isDistinctClauseUsed((ASTNode) node.getChild(i))) {
return true;
}
}
return false;
}
示例2: hasMeasuresInDistinctClause
private boolean hasMeasuresInDistinctClause(CubeQueryContext cubeql, ASTNode node, boolean hasDistinct) {
if (node == null) {
return false;
}
int exprTokenType = node.getToken().getType();
boolean isDistinct = hasDistinct;
if (exprTokenType == HiveParser.TOK_FUNCTIONDI || exprTokenType == HiveParser.TOK_SELECTDI) {
isDistinct = true;
} else if (cubeql.isCubeMeasure(node) && isDistinct) {
// Exit for the recursion
return true;
}
for (int i = 0; i < node.getChildCount(); i++) {
if (hasMeasuresInDistinctClause(cubeql, (ASTNode) node.getChild(i), isDistinct)) {
// Return on the first measure in distinct clause
return true;
}
}
return false;
}
示例3: isSelectDistinctStar
/**
* Check if subtree represents select distinct *
*
* @param select
* @return
*/
public static boolean isSelectDistinctStar(ASTNode select) {
if (select.getType() != HiveParser.TOK_SELECTDI) {
return false;
}
if (select.getChildCount() > 1) {
return false;
}
if (select.getChild(0).getType() != HiveParser.TOK_SELEXPR) {
return false;
}
if (select.getChild(0).getChild(0).getType() != HiveParser.TOK_ALLCOLREF) {
return false;
}
return true;
}
示例4: generate
@Override
public boolean generate(ASTNode hiveRoot, CommonTree sqlRoot, ASTNode currentHiveNode,
CommonTree currentSqlNode, TranslateContext context) throws SqlXlateException {
CommonTree parent = (CommonTree) currentSqlNode.getParent();
ASTNode ret;
if (parent.getFirstChildWithType(PantheraParser_PLSQLParser.SQL92_RESERVED_DISTINCT) != null) {
ret = super.newHiveASTNode(HiveParser.TOK_SELECTDI, "TOK_SELECTDI");
} else {
ret = super.newHiveASTNode(HiveParser.TOK_SELECT, "TOK_SELECT");
}
super.attachHiveNode(hiveRoot, currentHiveNode, ret);
return super.generateChildren(hiveRoot, sqlRoot, ret, currentSqlNode, context);
}