use of com.linkedin.pinot.pql.parsers.Pql2CompilationException in project pinot by linkedin.
the class SelectAstNode method addChild.
@Override
public void addChild(AstNode childNode) {
if (childNode instanceof LimitAstNode) {
if (_hasLimitClause) {
throw new Pql2CompilationException("More than one LIMIT clause specified!");
}
LimitAstNode node = (LimitAstNode) childNode;
_recordLimit = node.getCount();
_offset = node.getOffset();
_hasLimitClause = true;
} else if (childNode instanceof TableNameAstNode) {
TableNameAstNode node = (TableNameAstNode) childNode;
_tableName = node.getTableName();
_resourceName = node.getResourceName();
} else if (childNode instanceof TopAstNode) {
if (_hasTopClause) {
throw new Pql2CompilationException("More than one TOP clause specified!");
}
TopAstNode node = (TopAstNode) childNode;
_topN = node.getCount();
_hasTopClause = true;
} else if (childNode instanceof WhereAstNode) {
if (_hasWhereClause) {
throw new Pql2CompilationException("More than one WHERE clause specified!");
}
super.addChild(childNode);
_hasWhereClause = true;
} else if (childNode instanceof GroupByAstNode) {
if (_hasGroupByClause) {
throw new Pql2CompilationException("More than one GROUP BY clause specified!");
}
super.addChild(childNode);
_hasGroupByClause = true;
} else if (childNode instanceof HavingAstNode) {
if (_hasHavingClause) {
throw new Pql2CompilationException("More than one HAVING clause specified!");
}
super.addChild(childNode);
_hasHavingClause = true;
} else if (childNode instanceof OrderByAstNode) {
if (_hasOrderByClause) {
throw new Pql2CompilationException("More than one ORDER BY clause specified!");
}
super.addChild(childNode);
_hasOrderByClause = true;
} else {
super.addChild(childNode);
}
}
Aggregations