Search in sources :

Example 1 with OdpsStatisticClause

use of com.alibaba.druid.sql.dialect.odps.ast.OdpsStatisticClause in project druid by alibaba.

the class OdpsStatementParser method parseStaticClause.

protected OdpsStatisticClause parseStaticClause() {
    if (identifierEquals("TABLE_COUNT")) {
        lexer.nextToken();
        return new OdpsStatisticClause.TableCount();
    } else if (identifierEquals("NULL_VALUE")) {
        lexer.nextToken();
        OdpsStatisticClause.NullValue null_value = new OdpsStatisticClause.NullValue();
        null_value.setColumn(this.exprParser.name());
        return null_value;
    } else if (identifierEquals("COLUMN_SUM")) {
        lexer.nextToken();
        OdpsStatisticClause.ColumnSum column_sum = new OdpsStatisticClause.ColumnSum();
        column_sum.setColumn(this.exprParser.name());
        return column_sum;
    } else if (identifierEquals("COLUMN_MAX")) {
        lexer.nextToken();
        OdpsStatisticClause.ColumnMax column_max = new OdpsStatisticClause.ColumnMax();
        column_max.setColumn(this.exprParser.name());
        return column_max;
    } else if (identifierEquals("COLUMN_MIN")) {
        lexer.nextToken();
        OdpsStatisticClause.ColumnMin column_min = new OdpsStatisticClause.ColumnMin();
        column_min.setColumn(this.exprParser.name());
        return column_min;
    } else if (identifierEquals("EXPRESSION_CONDITION")) {
        lexer.nextToken();
        OdpsStatisticClause.ExpressionCondition expr_condition = new OdpsStatisticClause.ExpressionCondition();
        expr_condition.setExpr(this.exprParser.expr());
        return expr_condition;
    } else {
        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
    }
}
Also used : ParserException(com.alibaba.druid.sql.parser.ParserException) OdpsStatisticClause(com.alibaba.druid.sql.dialect.odps.ast.OdpsStatisticClause)

Aggregations

OdpsStatisticClause (com.alibaba.druid.sql.dialect.odps.ast.OdpsStatisticClause)1 ParserException (com.alibaba.druid.sql.parser.ParserException)1