Search in sources :

Example 6 with Pql2CompilationException

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);
    }
}
Also used : Pql2CompilationException(com.linkedin.pinot.pql.parsers.Pql2CompilationException)

Aggregations

Pql2CompilationException (com.linkedin.pinot.pql.parsers.Pql2CompilationException)6 Selection (com.linkedin.pinot.common.request.Selection)2 FilterQueryTree (com.linkedin.pinot.common.utils.request.FilterQueryTree)2 AggregationInfo (com.linkedin.pinot.common.request.AggregationInfo)1 FilterOperator (com.linkedin.pinot.common.request.FilterOperator)1 SelectionSort (com.linkedin.pinot.common.request.SelectionSort)1 TreeSet (java.util.TreeSet)1