Search in sources :

Example 1 with LiteralString

use of com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString in project cobar by alibaba.

the class MySQLExprParser method userExpression.

private Expression userExpression(String consumed, String consumedUp) throws SQLSyntaxErrorException {
    Expression first = primaryExpression(consumed, consumedUp);
    if (lexer.token() == USR_VAR) {
        if (first instanceof LiteralString) {
            StringBuilder str = new StringBuilder().append('\'').append(((LiteralString) first).getString()).append('\'').append(lexer.stringValue());
            lexer.nextToken();
            return new UserExpression(str.toString()).setCacheEvalRst(cacheEvalRst);
        } else if (first instanceof Identifier) {
            StringBuilder str = new StringBuilder().append(((Identifier) first).getIdText()).append(lexer.stringValue());
            lexer.nextToken();
            return new UserExpression(str.toString()).setCacheEvalRst(cacheEvalRst);
        }
    }
    return first;
}
Also used : Identifier(com.alibaba.cobar.parser.ast.expression.primary.Identifier) LiteralString(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString) SubqueryAllExpression(com.alibaba.cobar.parser.ast.expression.misc.SubqueryAllExpression) MinusExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.MinusExpression) BetweenAndExpression(com.alibaba.cobar.parser.ast.expression.comparison.BetweenAndExpression) BitAndExpression(com.alibaba.cobar.parser.ast.expression.bit.BitAndExpression) ComparisionEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionEqualsExpression) NegativeValueExpression(com.alibaba.cobar.parser.ast.expression.logical.NegativeValueExpression) QueryExpression(com.alibaba.cobar.parser.ast.expression.misc.QueryExpression) CastBinaryExpression(com.alibaba.cobar.parser.ast.expression.type.CastBinaryExpression) InExpression(com.alibaba.cobar.parser.ast.expression.comparison.InExpression) BitInvertExpression(com.alibaba.cobar.parser.ast.expression.bit.BitInvertExpression) BitXORExpression(com.alibaba.cobar.parser.ast.expression.bit.BitXORExpression) FunctionExpression(com.alibaba.cobar.parser.ast.expression.primary.function.FunctionExpression) BitShiftExpression(com.alibaba.cobar.parser.ast.expression.bit.BitShiftExpression) BitOrExpression(com.alibaba.cobar.parser.ast.expression.bit.BitOrExpression) ComparisionGreaterThanOrEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionGreaterThanOrEqualsExpression) MatchExpression(com.alibaba.cobar.parser.ast.expression.primary.MatchExpression) ComparisionIsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionIsExpression) LogicalOrExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalOrExpression) ComparisionGreaterThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionGreaterThanExpression) ComparisionLessOrGreaterThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessOrGreaterThanExpression) SubqueryAnyExpression(com.alibaba.cobar.parser.ast.expression.misc.SubqueryAnyExpression) RegexpExpression(com.alibaba.cobar.parser.ast.expression.string.RegexpExpression) LogicalAndExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalAndExpression) ArithmeticMultiplyExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticMultiplyExpression) ComparisionLessThanOrEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessThanOrEqualsExpression) ComparisionNullSafeEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionNullSafeEqualsExpression) LikeExpression(com.alibaba.cobar.parser.ast.expression.string.LikeExpression) ArithmeticSubtractExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticSubtractExpression) SoundsLikeExpression(com.alibaba.cobar.parser.ast.expression.string.SoundsLikeExpression) ArithmeticIntegerDivideExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticIntegerDivideExpression) CollateExpression(com.alibaba.cobar.parser.ast.expression.type.CollateExpression) LogicalNotExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalNotExpression) Expression(com.alibaba.cobar.parser.ast.expression.Expression) AssignmentExpression(com.alibaba.cobar.parser.ast.expression.misc.AssignmentExpression) CaseWhenOperatorExpression(com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression) LogicalXORExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalXORExpression) UserExpression(com.alibaba.cobar.parser.ast.expression.misc.UserExpression) ArithmeticAddExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticAddExpression) ComparisionNotEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionNotEqualsExpression) RowExpression(com.alibaba.cobar.parser.ast.expression.primary.RowExpression) ComparisionLessThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessThanExpression) ArithmeticModExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticModExpression) ArithmeticDivideExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticDivideExpression) UserExpression(com.alibaba.cobar.parser.ast.expression.misc.UserExpression)

Example 2 with LiteralString

use of com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString in project cobar by alibaba.

the class MySQLExprParser method primaryExpression.

private Expression primaryExpression(final String consumed, String consumedUp) throws SQLSyntaxErrorException {
    if (consumed != null) {
        return startedFromIdentifier(consumed, consumedUp);
    }
    String tempStr;
    String tempStrUp;
    StringBuilder tempSb;
    Number tempNum;
    Expression tempExpr;
    Expression tempExpr2;
    List<Expression> tempExprList;
    switch(lexer.token()) {
        case PLACE_HOLDER:
            tempStr = lexer.stringValue();
            tempStrUp = lexer.stringValueUppercase();
            lexer.nextToken();
            return createPlaceHolder(tempStr, tempStrUp);
        case LITERAL_BIT:
            tempStr = lexer.stringValue();
            lexer.nextToken();
            return new LiteralBitField(null, tempStr).setCacheEvalRst(cacheEvalRst);
        case LITERAL_HEX:
            LiteralHexadecimal hex = new LiteralHexadecimal(null, lexer.getSQL(), lexer.getOffsetCache(), lexer.getSizeCache(), charset);
            lexer.nextToken();
            return hex.setCacheEvalRst(cacheEvalRst);
        case LITERAL_BOOL_FALSE:
            lexer.nextToken();
            return new LiteralBoolean(false).setCacheEvalRst(cacheEvalRst);
        case LITERAL_BOOL_TRUE:
            lexer.nextToken();
            return new LiteralBoolean(true).setCacheEvalRst(cacheEvalRst);
        case LITERAL_NULL:
            lexer.nextToken();
            return new LiteralNull().setCacheEvalRst(cacheEvalRst);
        case LITERAL_NCHARS:
            tempSb = new StringBuilder();
            do {
                lexer.appendStringContent(tempSb);
            } while (lexer.nextToken() == LITERAL_CHARS);
            return new LiteralString(null, tempSb.toString(), true).setCacheEvalRst(cacheEvalRst);
        case LITERAL_CHARS:
            tempSb = new StringBuilder();
            do {
                lexer.appendStringContent(tempSb);
            } while (lexer.nextToken() == LITERAL_CHARS);
            return new LiteralString(null, tempSb.toString(), false).setCacheEvalRst(cacheEvalRst);
        case LITERAL_NUM_PURE_DIGIT:
            tempNum = lexer.integerValue();
            lexer.nextToken();
            return new LiteralNumber(tempNum).setCacheEvalRst(cacheEvalRst);
        case LITERAL_NUM_MIX_DIGIT:
            tempNum = lexer.decimalValue();
            lexer.nextToken();
            return new LiteralNumber(tempNum).setCacheEvalRst(cacheEvalRst);
        case QUESTION_MARK:
            int index = lexer.paramIndex();
            lexer.nextToken();
            return createParam(index);
        case KW_CASE:
            lexer.nextToken();
            return caseWhenExpression();
        case KW_INTERVAL:
            lexer.nextToken();
            return intervalExpression();
        case KW_EXISTS:
            lexer.nextToken();
            match(PUNC_LEFT_PAREN);
            tempExpr = subQuery();
            match(PUNC_RIGHT_PAREN);
            return new ExistsPrimary((QueryExpression) tempExpr).setCacheEvalRst(cacheEvalRst);
        case USR_VAR:
            tempStr = lexer.stringValue();
            tempExpr = new UsrDefVarPrimary(tempStr).setCacheEvalRst(cacheEvalRst);
            if (lexer.nextToken() == OP_ASSIGN) {
                lexer.nextToken();
                tempExpr2 = expression();
                return new AssignmentExpression(tempExpr, tempExpr2);
            }
            return tempExpr;
        case SYS_VAR:
            return systemVariale();
        case KW_MATCH:
            lexer.nextToken();
            return matchExpression();
        case PUNC_LEFT_PAREN:
            lexer.nextToken();
            if (lexer.token() == KW_SELECT) {
                tempExpr = subQuery();
                match(PUNC_RIGHT_PAREN);
                return tempExpr;
            }
            tempExpr = expression();
            switch(lexer.token()) {
                case PUNC_RIGHT_PAREN:
                    lexer.nextToken();
                    return tempExpr;
                case PUNC_COMMA:
                    lexer.nextToken();
                    tempExprList = new LinkedList<Expression>();
                    tempExprList.add(tempExpr);
                    tempExprList = expressionList(tempExprList);
                    return new RowExpression(tempExprList).setCacheEvalRst(cacheEvalRst);
                default:
                    throw err("unexpected token: " + lexer.token());
            }
        case KW_UTC_DATE:
            lexer.nextToken();
            if (lexer.token() == PUNC_LEFT_PAREN) {
                lexer.nextToken();
                match(PUNC_RIGHT_PAREN);
            }
            return new UtcDate(null).setCacheEvalRst(cacheEvalRst);
        case KW_UTC_TIME:
            lexer.nextToken();
            if (lexer.token() == PUNC_LEFT_PAREN) {
                lexer.nextToken();
                match(PUNC_RIGHT_PAREN);
            }
            return new UtcTime(null).setCacheEvalRst(cacheEvalRst);
        case KW_UTC_TIMESTAMP:
            lexer.nextToken();
            if (lexer.token() == PUNC_LEFT_PAREN) {
                lexer.nextToken();
                match(PUNC_RIGHT_PAREN);
            }
            return new UtcTimestamp(null).setCacheEvalRst(cacheEvalRst);
        case KW_CURRENT_DATE:
            lexer.nextToken();
            if (lexer.token() == PUNC_LEFT_PAREN) {
                lexer.nextToken();
                match(PUNC_RIGHT_PAREN);
            }
            return new Curdate().setCacheEvalRst(cacheEvalRst);
        case KW_CURRENT_TIME:
            lexer.nextToken();
            if (lexer.token() == PUNC_LEFT_PAREN) {
                lexer.nextToken();
                match(PUNC_RIGHT_PAREN);
            }
            return new Curtime().setCacheEvalRst(cacheEvalRst);
        case KW_CURRENT_TIMESTAMP:
        case KW_LOCALTIME:
        case KW_LOCALTIMESTAMP:
            lexer.nextToken();
            if (lexer.token() == PUNC_LEFT_PAREN) {
                lexer.nextToken();
                match(PUNC_RIGHT_PAREN);
            }
            return new Now().setCacheEvalRst(cacheEvalRst);
        case KW_CURRENT_USER:
            lexer.nextToken();
            if (lexer.token() == PUNC_LEFT_PAREN) {
                lexer.nextToken();
                match(PUNC_RIGHT_PAREN);
            }
            return new CurrentUser().setCacheEvalRst(cacheEvalRst);
        case KW_DEFAULT:
            if (lexer.nextToken() == PUNC_LEFT_PAREN) {
                return ordinaryFunction(lexer.stringValue(), lexer.stringValueUppercase());
            }
            return new DefaultValue().setCacheEvalRst(cacheEvalRst);
        case KW_DATABASE:
        case KW_IF:
        case KW_INSERT:
        case KW_LEFT:
        case KW_REPEAT:
        case KW_REPLACE:
        case KW_RIGHT:
        case KW_SCHEMA:
        case KW_VALUES:
            tempStr = lexer.stringValue();
            tempStrUp = lexer.stringValueUppercase();
            String tempStrUp2 = MySQLToken.keyWordToString(lexer.token());
            if (!tempStrUp2.equals(tempStrUp)) {
                tempStrUp = tempStr = tempStrUp2;
            }
            if (lexer.nextToken() == PUNC_LEFT_PAREN) {
                return ordinaryFunction(tempStr, tempStrUp);
            }
            throw err("keyword not followed by '(' is not expression: " + tempStr);
        case KW_MOD:
            lexer.nextToken();
            match(PUNC_LEFT_PAREN);
            tempExpr = expression();
            match(PUNC_COMMA);
            tempExpr2 = expression();
            match(PUNC_RIGHT_PAREN);
            return new ArithmeticModExpression(tempExpr, tempExpr2).setCacheEvalRst(cacheEvalRst);
        case KW_CHAR:
            lexer.nextToken();
            match(PUNC_LEFT_PAREN);
            return functionChar();
        case KW_CONVERT:
            lexer.nextToken();
            match(PUNC_LEFT_PAREN);
            return functionConvert();
        case IDENTIFIER:
            tempStr = lexer.stringValue();
            tempStrUp = lexer.stringValueUppercase();
            lexer.nextToken();
            return startedFromIdentifier(tempStr, tempStrUp);
        case OP_ASTERISK:
            lexer.nextToken();
            return new Wildcard(null).setCacheEvalRst(cacheEvalRst);
        default:
            throw err("unrecognized token as first token of primary: " + lexer.token());
    }
}
Also used : LiteralHexadecimal(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralHexadecimal) LiteralString(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString) CurrentUser(com.alibaba.cobar.parser.ast.expression.primary.function.info.CurrentUser) LiteralBitField(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralBitField) Curtime(com.alibaba.cobar.parser.ast.expression.primary.function.datetime.Curtime) LiteralString(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString) UtcTimestamp(com.alibaba.cobar.parser.ast.expression.primary.function.datetime.UtcTimestamp) UtcTime(com.alibaba.cobar.parser.ast.expression.primary.function.datetime.UtcTime) DefaultValue(com.alibaba.cobar.parser.ast.expression.primary.DefaultValue) Curdate(com.alibaba.cobar.parser.ast.expression.primary.function.datetime.Curdate) LiteralNumber(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralNumber) AssignmentExpression(com.alibaba.cobar.parser.ast.expression.misc.AssignmentExpression) Wildcard(com.alibaba.cobar.parser.ast.expression.primary.Wildcard) QueryExpression(com.alibaba.cobar.parser.ast.expression.misc.QueryExpression) LiteralBoolean(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralBoolean) UtcDate(com.alibaba.cobar.parser.ast.expression.primary.function.datetime.UtcDate) ExistsPrimary(com.alibaba.cobar.parser.ast.expression.primary.ExistsPrimary) RowExpression(com.alibaba.cobar.parser.ast.expression.primary.RowExpression) ArithmeticModExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticModExpression) UsrDefVarPrimary(com.alibaba.cobar.parser.ast.expression.primary.UsrDefVarPrimary) SubqueryAllExpression(com.alibaba.cobar.parser.ast.expression.misc.SubqueryAllExpression) MinusExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.MinusExpression) BetweenAndExpression(com.alibaba.cobar.parser.ast.expression.comparison.BetweenAndExpression) BitAndExpression(com.alibaba.cobar.parser.ast.expression.bit.BitAndExpression) ComparisionEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionEqualsExpression) NegativeValueExpression(com.alibaba.cobar.parser.ast.expression.logical.NegativeValueExpression) QueryExpression(com.alibaba.cobar.parser.ast.expression.misc.QueryExpression) CastBinaryExpression(com.alibaba.cobar.parser.ast.expression.type.CastBinaryExpression) InExpression(com.alibaba.cobar.parser.ast.expression.comparison.InExpression) BitInvertExpression(com.alibaba.cobar.parser.ast.expression.bit.BitInvertExpression) BitXORExpression(com.alibaba.cobar.parser.ast.expression.bit.BitXORExpression) FunctionExpression(com.alibaba.cobar.parser.ast.expression.primary.function.FunctionExpression) BitShiftExpression(com.alibaba.cobar.parser.ast.expression.bit.BitShiftExpression) BitOrExpression(com.alibaba.cobar.parser.ast.expression.bit.BitOrExpression) ComparisionGreaterThanOrEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionGreaterThanOrEqualsExpression) MatchExpression(com.alibaba.cobar.parser.ast.expression.primary.MatchExpression) ComparisionIsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionIsExpression) LogicalOrExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalOrExpression) ComparisionGreaterThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionGreaterThanExpression) ComparisionLessOrGreaterThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessOrGreaterThanExpression) SubqueryAnyExpression(com.alibaba.cobar.parser.ast.expression.misc.SubqueryAnyExpression) RegexpExpression(com.alibaba.cobar.parser.ast.expression.string.RegexpExpression) LogicalAndExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalAndExpression) ArithmeticMultiplyExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticMultiplyExpression) ComparisionLessThanOrEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessThanOrEqualsExpression) ComparisionNullSafeEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionNullSafeEqualsExpression) LikeExpression(com.alibaba.cobar.parser.ast.expression.string.LikeExpression) ArithmeticSubtractExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticSubtractExpression) SoundsLikeExpression(com.alibaba.cobar.parser.ast.expression.string.SoundsLikeExpression) ArithmeticIntegerDivideExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticIntegerDivideExpression) CollateExpression(com.alibaba.cobar.parser.ast.expression.type.CollateExpression) LogicalNotExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalNotExpression) Expression(com.alibaba.cobar.parser.ast.expression.Expression) AssignmentExpression(com.alibaba.cobar.parser.ast.expression.misc.AssignmentExpression) CaseWhenOperatorExpression(com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression) LogicalXORExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalXORExpression) UserExpression(com.alibaba.cobar.parser.ast.expression.misc.UserExpression) ArithmeticAddExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticAddExpression) ComparisionNotEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionNotEqualsExpression) RowExpression(com.alibaba.cobar.parser.ast.expression.primary.RowExpression) ComparisionLessThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessThanExpression) ArithmeticModExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticModExpression) ArithmeticDivideExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticDivideExpression) LiteralNull(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralNull) Now(com.alibaba.cobar.parser.ast.expression.primary.function.datetime.Now) LiteralNumber(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralNumber)

Example 3 with LiteralString

use of com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString in project cobar by alibaba.

the class MySQLDDLParser method columnDefinition.

// column_definition:
// data_type [NOT NULL | NULL] [DEFAULT default_value]
// [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]
// [COMMENT 'string']
// [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]
// [reference_definition]
private ColumnDefinition columnDefinition() throws SQLSyntaxErrorException {
    DataType dataType = dataType();
    boolean notNull = false;
    Expression defaultVal = null;
    boolean autoIncrement = false;
    ColumnDefinition.SpecialIndex sindex = null;
    ColumnDefinition.ColumnFormat format = null;
    LiteralString comment = null;
    if (lexer.token() == KW_NOT) {
        lexer.nextToken();
        match(LITERAL_NULL);
        notNull = true;
    } else if (lexer.token() == LITERAL_NULL) {
        lexer.nextToken();
    }
    if (lexer.token() == KW_DEFAULT) {
        lexer.nextToken();
        defaultVal = exprParser.expression();
        if (!(defaultVal instanceof Literal)) {
            throw new SQLSyntaxErrorException("default value of column must be a literal: " + defaultVal);
        }
    }
    if (lexer.token() == IDENTIFIER && "AUTO_INCREMENT".equals(lexer.stringValueUppercase())) {
        lexer.nextToken();
        autoIncrement = true;
    }
    switch(lexer.token()) {
        case KW_UNIQUE:
            if (lexer.nextToken() == KW_KEY) {
                lexer.nextToken();
            }
            sindex = ColumnDefinition.SpecialIndex.UNIQUE;
            break;
        case KW_PRIMARY:
            lexer.nextToken();
        case KW_KEY:
            match(KW_KEY);
            sindex = ColumnDefinition.SpecialIndex.PRIMARY;
            break;
    }
    if (lexer.token() == IDENTIFIER && "COMMENT".equals(lexer.stringValueUppercase())) {
        lexer.nextToken();
        comment = (LiteralString) exprParser.expression();
    }
    if (lexer.token() == IDENTIFIER && "COLUMN_FORMAT".equals(lexer.stringValueUppercase())) {
        switch(lexer.nextToken()) {
            case KW_DEFAULT:
                lexer.nextToken();
                format = ColumnDefinition.ColumnFormat.DEFAULT;
                break;
            case IDENTIFIER:
                SpecialIdentifier si = specialIdentifiers.get(lexer.stringValueUppercase());
                if (si != null) {
                    switch(si) {
                        case FIXED:
                            lexer.nextToken();
                            format = ColumnDefinition.ColumnFormat.FIXED;
                            break;
                        case DYNAMIC:
                            lexer.nextToken();
                            format = ColumnDefinition.ColumnFormat.DYNAMIC;
                            break;
                    }
                }
        }
    }
    return new ColumnDefinition(dataType, notNull, defaultVal, autoIncrement, sindex, comment, format);
}
Also used : LiteralString(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString) Expression(com.alibaba.cobar.parser.ast.expression.Expression) Literal(com.alibaba.cobar.parser.ast.expression.primary.literal.Literal) SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) DataType(com.alibaba.cobar.parser.ast.fragment.ddl.datatype.DataType) ColumnDefinition(com.alibaba.cobar.parser.ast.fragment.ddl.ColumnDefinition)

Example 4 with LiteralString

use of com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString in project cobar by alibaba.

the class MySQLDDLParser method tableOption.

private boolean tableOption(TableOptions options) throws SQLSyntaxErrorException {
    Identifier id = null;
    Expression expr = null;
    os: switch(lexer.token()) {
        case KW_CHARACTER:
            lexer.nextToken();
            match(KW_SET);
            if (lexer.token() == OP_EQUALS) {
                lexer.nextToken();
            }
            id = identifier();
            options.setCharSet(id);
            break;
        case KW_COLLATE:
            lexer.nextToken();
            if (lexer.token() == OP_EQUALS) {
                lexer.nextToken();
            }
            id = identifier();
            options.setCollation(id);
            break;
        case KW_DEFAULT:
            // | [DEFAULT] COLLATE [=] collation_name
            switch(lexer.nextToken()) {
                case KW_CHARACTER:
                    lexer.nextToken();
                    match(KW_SET);
                    if (lexer.token() == OP_EQUALS) {
                        lexer.nextToken();
                    }
                    id = identifier();
                    options.setCharSet(id);
                    break os;
                case KW_COLLATE:
                    lexer.nextToken();
                    if (lexer.token() == OP_EQUALS) {
                        lexer.nextToken();
                    }
                    id = identifier();
                    options.setCollation(id);
                    break os;
                case IDENTIFIER:
                    SpecialIdentifier si = specialIdentifiers.get(lexer.stringValueUppercase());
                    if (si != null) {
                        switch(si) {
                            case CHARSET:
                                lexer.nextToken();
                                if (lexer.token() == OP_EQUALS) {
                                    lexer.nextToken();
                                }
                                id = identifier();
                                options.setCharSet(id);
                                break os;
                        }
                    }
                default:
                    lexer.addCacheToke(KW_DEFAULT);
                    return false;
            }
        case KW_INDEX:
            // | INDEX DIRECTORY [=] 'absolute path to directory'
            lexer.nextToken();
            if (lexer.token() == IDENTIFIER && "DIRECTORY".equals(lexer.stringValueUppercase())) {
                if (lexer.nextToken() == OP_EQUALS) {
                    lexer.nextToken();
                }
                options.setIndexDir((LiteralString) exprParser.expression());
                break;
            }
            lexer.addCacheToke(KW_INDEX);
            return true;
        case KW_UNION:
            // | UNION [=] (tbl_name[,tbl_name]...)
            if (lexer.nextToken() == OP_EQUALS) {
                lexer.nextToken();
            }
            match(PUNC_LEFT_PAREN);
            List<Identifier> union = new ArrayList<Identifier>(2);
            for (int j = 0; lexer.token() != PUNC_RIGHT_PAREN; ++j) {
                if (j > 0)
                    match(PUNC_COMMA);
                id = identifier();
                union.add(id);
            }
            match(PUNC_RIGHT_PAREN);
            options.setUnion(union);
            break os;
        case IDENTIFIER:
            SpecialIdentifier si = specialIdentifiers.get(lexer.stringValueUppercase());
            if (si != null) {
                switch(si) {
                    case CHARSET:
                        // CHARSET [=] charset_name
                        lexer.nextToken();
                        if (lexer.token() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        id = identifier();
                        options.setCharSet(id);
                        break os;
                    case ENGINE:
                        // ENGINE [=] engine_name
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        id = identifier();
                        options.setEngine(id);
                        break os;
                    case AUTO_INCREMENT:
                        // | AUTO_INCREMENT [=] value
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        expr = exprParser.expression();
                        options.setAutoIncrement(expr);
                        break os;
                    case AVG_ROW_LENGTH:
                        // | AVG_ROW_LENGTH [=] value
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        expr = exprParser.expression();
                        options.setAvgRowLength(expr);
                        break os;
                    case CHECKSUM:
                        // | CHECKSUM [=] {0 | 1}
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        switch(lexer.token()) {
                            case LITERAL_BOOL_FALSE:
                                lexer.nextToken();
                                options.setCheckSum(false);
                            case LITERAL_BOOL_TRUE:
                                lexer.nextToken();
                                options.setCheckSum(true);
                                break;
                            case LITERAL_NUM_PURE_DIGIT:
                                int intVal = lexer.integerValue().intValue();
                                lexer.nextToken();
                                if (intVal == 0) {
                                    options.setCheckSum(false);
                                } else {
                                    options.setCheckSum(true);
                                }
                                break;
                            default:
                                throw new SQLSyntaxErrorException("table option of CHECKSUM error");
                        }
                        break os;
                    case DELAY_KEY_WRITE:
                        // | DELAY_KEY_WRITE [=] {0 | 1}
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        switch(lexer.token()) {
                            case LITERAL_BOOL_FALSE:
                                lexer.nextToken();
                                options.setDelayKeyWrite(false);
                            case LITERAL_BOOL_TRUE:
                                lexer.nextToken();
                                options.setDelayKeyWrite(true);
                                break;
                            case LITERAL_NUM_PURE_DIGIT:
                                int intVal = lexer.integerValue().intValue();
                                lexer.nextToken();
                                if (intVal == 0) {
                                    options.setDelayKeyWrite(false);
                                } else {
                                    options.setDelayKeyWrite(true);
                                }
                                break;
                            default:
                                throw new SQLSyntaxErrorException("table option of DELAY_KEY_WRITE error");
                        }
                        break os;
                    case COMMENT:
                        // | COMMENT [=] 'string'
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        options.setComment((LiteralString) exprParser.expression());
                        break os;
                    case CONNECTION:
                        // | CONNECTION [=] 'connect_string'
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        options.setConnection((LiteralString) exprParser.expression());
                        break os;
                    case DATA:
                        // | DATA DIRECTORY [=] 'absolute path to directory'
                        lexer.nextToken();
                        matchIdentifier("DIRECTORY");
                        if (lexer.token() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        options.setDataDir((LiteralString) exprParser.expression());
                        break os;
                    case INSERT_METHOD:
                        // | INSERT_METHOD [=] { NO | FIRST | LAST }
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        switch(matchIdentifier("NO", "FIRST", "LAST")) {
                            case 0:
                                options.setInsertMethod(TableOptions.InsertMethod.NO);
                                break;
                            case 1:
                                options.setInsertMethod(TableOptions.InsertMethod.FIRST);
                                break;
                            case 2:
                                options.setInsertMethod(TableOptions.InsertMethod.LAST);
                                break;
                        }
                        break os;
                    case KEY_BLOCK_SIZE:
                        // | KEY_BLOCK_SIZE [=] value
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        options.setKeyBlockSize(exprParser.expression());
                        break os;
                    case MAX_ROWS:
                        // | MAX_ROWS [=] value
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        options.setMaxRows(exprParser.expression());
                        break os;
                    case MIN_ROWS:
                        // | MIN_ROWS [=] value
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        options.setMinRows(exprParser.expression());
                        break os;
                    case PACK_KEYS:
                        // | PACK_KEYS [=] {0 | 1 | DEFAULT}
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        switch(lexer.token()) {
                            case LITERAL_BOOL_FALSE:
                                lexer.nextToken();
                                options.setPackKeys(TableOptions.PackKeys.FALSE);
                                break;
                            case LITERAL_BOOL_TRUE:
                                lexer.nextToken();
                                options.setPackKeys(TableOptions.PackKeys.TRUE);
                                break;
                            case LITERAL_NUM_PURE_DIGIT:
                                int intVal = lexer.integerValue().intValue();
                                lexer.nextToken();
                                if (intVal == 0) {
                                    options.setPackKeys(TableOptions.PackKeys.FALSE);
                                } else {
                                    options.setPackKeys(TableOptions.PackKeys.TRUE);
                                }
                                break;
                            case KW_DEFAULT:
                                lexer.nextToken();
                                options.setPackKeys(TableOptions.PackKeys.DEFAULT);
                                break;
                            default:
                                throw new SQLSyntaxErrorException("table option of PACK_KEYS error");
                        }
                        break os;
                    case PASSWORD:
                        // | PASSWORD [=] 'string'
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        options.setPassword((LiteralString) exprParser.expression());
                        break os;
                    case ROW_FORMAT:
                        // {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}
                        if (lexer.nextToken() == OP_EQUALS) {
                            lexer.nextToken();
                        }
                        switch(lexer.token()) {
                            case KW_DEFAULT:
                                lexer.nextToken();
                                options.setRowFormat(TableOptions.RowFormat.DEFAULT);
                                break os;
                            case IDENTIFIER:
                                SpecialIdentifier sid = specialIdentifiers.get(lexer.stringValueUppercase());
                                if (sid != null) {
                                    switch(sid) {
                                        case DYNAMIC:
                                            lexer.nextToken();
                                            options.setRowFormat(TableOptions.RowFormat.DYNAMIC);
                                            break os;
                                        case FIXED:
                                            lexer.nextToken();
                                            options.setRowFormat(TableOptions.RowFormat.FIXED);
                                            break os;
                                        case COMPRESSED:
                                            lexer.nextToken();
                                            options.setRowFormat(TableOptions.RowFormat.COMPRESSED);
                                            break os;
                                        case REDUNDANT:
                                            lexer.nextToken();
                                            options.setRowFormat(TableOptions.RowFormat.REDUNDANT);
                                            break os;
                                        case COMPACT:
                                            lexer.nextToken();
                                            options.setRowFormat(TableOptions.RowFormat.COMPACT);
                                            break os;
                                    }
                                }
                            default:
                                throw new SQLSyntaxErrorException("table option of ROW_FORMAT error");
                        }
                }
            }
        default:
            return false;
    }
    return true;
}
Also used : Identifier(com.alibaba.cobar.parser.ast.expression.primary.Identifier) LiteralString(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString) Expression(com.alibaba.cobar.parser.ast.expression.Expression) SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList)

Example 5 with LiteralString

use of com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString in project cobar by alibaba.

the class MySQLExprParser method startedFromIdentifier.

/**
 * last token consumed is {@link MySQLToken#IDENTIFIER}, MUST NOT be
 * <code>null</code>
 */
private Expression startedFromIdentifier(final String consumed, String consumedUp) throws SQLSyntaxErrorException {
    Expression tempExpr;
    Expression tempExpr2;
    List<Expression> tempExprList;
    String tempStr;
    StringBuilder tempSb;
    boolean tempGroupDistinct;
    switch(lexer.token()) {
        case PUNC_DOT:
            for (tempExpr = new Identifier(null, consumed, consumedUp).setCacheEvalRst(cacheEvalRst); lexer.token() == PUNC_DOT; ) {
                switch(lexer.nextToken()) {
                    case IDENTIFIER:
                        tempExpr = new Identifier((Identifier) tempExpr, lexer.stringValue(), lexer.stringValueUppercase()).setCacheEvalRst(cacheEvalRst);
                        lexer.nextToken();
                        break;
                    case OP_ASTERISK:
                        lexer.nextToken();
                        return new Wildcard((Identifier) tempExpr).setCacheEvalRst(cacheEvalRst);
                    default:
                        throw err("expect IDENTIFIER or '*' after '.', but is " + lexer.token());
                }
            }
            return tempExpr;
        case LITERAL_BIT:
            if (consumed.charAt(0) != '_') {
                return new Identifier(null, consumed, consumedUp).setCacheEvalRst(cacheEvalRst);
            }
            tempStr = lexer.stringValue();
            lexer.nextToken();
            return new LiteralBitField(consumed, tempStr).setCacheEvalRst(cacheEvalRst);
        case LITERAL_HEX:
            if (consumed.charAt(0) != '_') {
                return new Identifier(null, consumed, consumedUp).setCacheEvalRst(cacheEvalRst);
            }
            LiteralHexadecimal hex = new LiteralHexadecimal(consumed, lexer.getSQL(), lexer.getOffsetCache(), lexer.getSizeCache(), charset);
            lexer.nextToken();
            return hex.setCacheEvalRst(cacheEvalRst);
        case LITERAL_CHARS:
            if (consumed.charAt(0) != '_') {
                return new Identifier(null, consumed, consumedUp).setCacheEvalRst(cacheEvalRst);
            }
            tempSb = new StringBuilder();
            do {
                lexer.appendStringContent(tempSb);
            } while (lexer.nextToken() == LITERAL_CHARS);
            return new LiteralString(consumed, tempSb.toString(), false).setCacheEvalRst(cacheEvalRst);
        case PUNC_LEFT_PAREN:
            consumedUp = Identifier.unescapeName(consumedUp);
            switch(functionManager.getParsingStrategy(consumedUp)) {
                case GET_FORMAT:
                    // GET_FORMAT({DATE|TIME|DATETIME},
                    // {'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'})
                    lexer.nextToken();
                    int gfi = matchIdentifier("DATE", "TIME", "DATETIME", "TIMESTAMP");
                    match(PUNC_COMMA);
                    Expression getFormatArg = expression();
                    match(PUNC_RIGHT_PAREN);
                    switch(gfi) {
                        case 0:
                            return new GetFormat(GetFormat.FormatType.DATE, getFormatArg);
                        case 1:
                            return new GetFormat(GetFormat.FormatType.TIME, getFormatArg);
                        case 2:
                        case 3:
                            return new GetFormat(GetFormat.FormatType.DATETIME, getFormatArg);
                    }
                    throw err("unexpected format type for GET_FORMAT()");
                case CAST:
                    lexer.nextToken();
                    tempExpr = expression();
                    match(KW_AS);
                    Pair<String, Pair<Expression, Expression>> type = type4specialFunc();
                    match(PUNC_RIGHT_PAREN);
                    Pair<Expression, Expression> info = type.getValue();
                    if (info != null) {
                        return new Cast(tempExpr, type.getKey(), info.getKey(), info.getValue()).setCacheEvalRst(cacheEvalRst);
                    } else {
                        return new Cast(tempExpr, type.getKey(), null, null).setCacheEvalRst(cacheEvalRst);
                    }
                case POSITION:
                    lexer.nextToken();
                    tempExprList = new ArrayList<Expression>(2);
                    tempExprList.add(expression());
                    match(KW_IN);
                    tempExprList.add(expression());
                    match(PUNC_RIGHT_PAREN);
                    return new Locate(tempExprList).setCacheEvalRst(cacheEvalRst);
                case SUBSTRING:
                    lexer.nextToken();
                    tempExprList = new ArrayList<Expression>(3);
                    tempExprList.add(expression());
                    match(PUNC_COMMA, KW_FROM);
                    tempExprList.add(expression());
                    switch(lexer.token()) {
                        case PUNC_COMMA:
                        case KW_FOR:
                            lexer.nextToken();
                            tempExprList.add(expression());
                        default:
                            match(PUNC_RIGHT_PAREN);
                    }
                    return new Substring(tempExprList).setCacheEvalRst(cacheEvalRst);
                case ROW:
                    lexer.nextToken();
                    tempExprList = expressionList(new LinkedList<Expression>());
                    return new RowExpression(tempExprList).setCacheEvalRst(cacheEvalRst);
                case TRIM:
                    Direction direction;
                    switch(lexer.nextToken()) {
                        case KW_BOTH:
                            lexer.nextToken();
                            direction = Direction.BOTH;
                            break;
                        case KW_LEADING:
                            lexer.nextToken();
                            direction = Direction.LEADING;
                            break;
                        case KW_TRAILING:
                            lexer.nextToken();
                            direction = Direction.TRAILING;
                            break;
                        default:
                            direction = Direction.DEFAULT;
                    }
                    if (direction == Direction.DEFAULT) {
                        tempExpr = expression();
                        if (lexer.token() == KW_FROM) {
                            lexer.nextToken();
                            tempExpr2 = expression();
                            match(PUNC_RIGHT_PAREN);
                            return new Trim(direction, tempExpr, tempExpr2).setCacheEvalRst(cacheEvalRst);
                        }
                        match(PUNC_RIGHT_PAREN);
                        return new Trim(direction, null, tempExpr).setCacheEvalRst(cacheEvalRst);
                    }
                    if (lexer.token() == KW_FROM) {
                        lexer.nextToken();
                        tempExpr = expression();
                        match(PUNC_RIGHT_PAREN);
                        return new Trim(direction, null, tempExpr).setCacheEvalRst(cacheEvalRst);
                    }
                    tempExpr = expression();
                    match(KW_FROM);
                    tempExpr2 = expression();
                    match(PUNC_RIGHT_PAREN);
                    return new Trim(direction, tempExpr, tempExpr2).setCacheEvalRst(cacheEvalRst);
                case AVG:
                    if (lexer.nextToken() == KW_DISTINCT) {
                        tempGroupDistinct = true;
                        lexer.nextToken();
                    } else {
                        tempGroupDistinct = false;
                    }
                    tempExpr = expression();
                    match(PUNC_RIGHT_PAREN);
                    return new Avg(tempExpr, tempGroupDistinct).setCacheEvalRst(cacheEvalRst);
                case MAX:
                    if (lexer.nextToken() == KW_DISTINCT) {
                        tempGroupDistinct = true;
                        lexer.nextToken();
                    } else {
                        tempGroupDistinct = false;
                    }
                    tempExpr = expression();
                    match(PUNC_RIGHT_PAREN);
                    return new Max(tempExpr, tempGroupDistinct).setCacheEvalRst(cacheEvalRst);
                case MIN:
                    if (lexer.nextToken() == KW_DISTINCT) {
                        tempGroupDistinct = true;
                        lexer.nextToken();
                    } else {
                        tempGroupDistinct = false;
                    }
                    tempExpr = expression();
                    match(PUNC_RIGHT_PAREN);
                    return new Min(tempExpr, tempGroupDistinct).setCacheEvalRst(cacheEvalRst);
                case SUM:
                    if (lexer.nextToken() == KW_DISTINCT) {
                        tempGroupDistinct = true;
                        lexer.nextToken();
                    } else {
                        tempGroupDistinct = false;
                    }
                    tempExpr = expression();
                    match(PUNC_RIGHT_PAREN);
                    return new Sum(tempExpr, tempGroupDistinct).setCacheEvalRst(cacheEvalRst);
                case COUNT:
                    if (lexer.nextToken() == KW_DISTINCT) {
                        lexer.nextToken();
                        tempExprList = expressionList(new LinkedList<Expression>());
                        return new Count(tempExprList).setCacheEvalRst(cacheEvalRst);
                    }
                    tempExpr = expression();
                    match(PUNC_RIGHT_PAREN);
                    return new Count(tempExpr).setCacheEvalRst(cacheEvalRst);
                case GROUP_CONCAT:
                    if (lexer.nextToken() == KW_DISTINCT) {
                        lexer.nextToken();
                        tempGroupDistinct = true;
                    } else {
                        tempGroupDistinct = false;
                    }
                    for (tempExprList = new LinkedList<Expression>(); ; ) {
                        tempExpr = expression();
                        tempExprList.add(tempExpr);
                        if (lexer.token() == PUNC_COMMA) {
                            lexer.nextToken();
                        } else {
                            break;
                        }
                    }
                    boolean isDesc = false;
                    List<Expression> appendedColumnNames = null;
                    // order by
                    tempExpr = null;
                    // literalChars
                    tempStr = null;
                    switch(lexer.token()) {
                        case KW_ORDER:
                            lexer.nextToken();
                            match(KW_BY);
                            tempExpr = expression();
                            if (lexer.token() == KW_ASC) {
                                lexer.nextToken();
                            } else if (lexer.token() == KW_DESC) {
                                isDesc = true;
                                lexer.nextToken();
                            }
                            for (appendedColumnNames = new LinkedList<Expression>(); lexer.token() == PUNC_COMMA; ) {
                                lexer.nextToken();
                                appendedColumnNames.add(expression());
                            }
                            if (lexer.token() != KW_SEPARATOR) {
                                break;
                            }
                        case KW_SEPARATOR:
                            lexer.nextToken();
                            tempSb = new StringBuilder();
                            lexer.appendStringContent(tempSb);
                            tempStr = LiteralString.getUnescapedString(tempSb.toString());
                            match(LITERAL_CHARS);
                            break;
                    }
                    match(PUNC_RIGHT_PAREN);
                    return new GroupConcat(tempGroupDistinct, tempExprList, tempExpr, isDesc, appendedColumnNames, tempStr).setCacheEvalRst(cacheEvalRst);
                case CHAR:
                    lexer.nextToken();
                    return functionChar();
                case CONVERT:
                    lexer.nextToken();
                    return functionConvert();
                case EXTRACT:
                    lexer.nextToken();
                    return extract();
                case TIMESTAMPDIFF:
                    lexer.nextToken();
                    return timestampdiff();
                case TIMESTAMPADD:
                    lexer.nextToken();
                    return timestampadd();
                case _ORDINARY:
                    return ordinaryFunction(consumed, consumedUp);
                case _DEFAULT:
                    return new Identifier(null, consumed, consumedUp).setCacheEvalRst(cacheEvalRst);
                default:
                    throw err("unexpected function parsing strategy for id of " + consumed);
            }
        default:
            return new Identifier(null, consumed, consumedUp).setCacheEvalRst(cacheEvalRst);
    }
}
Also used : Cast(com.alibaba.cobar.parser.ast.expression.primary.function.cast.Cast) LiteralHexadecimal(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralHexadecimal) LiteralString(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString) Max(com.alibaba.cobar.parser.ast.expression.primary.function.groupby.Max) GroupConcat(com.alibaba.cobar.parser.ast.expression.primary.function.groupby.GroupConcat) LiteralBitField(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralBitField) Locate(com.alibaba.cobar.parser.ast.expression.primary.function.string.Locate) LiteralString(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString) Count(com.alibaba.cobar.parser.ast.expression.primary.function.groupby.Count) Direction(com.alibaba.cobar.parser.ast.expression.primary.function.string.Trim.Direction) Identifier(com.alibaba.cobar.parser.ast.expression.primary.Identifier) Wildcard(com.alibaba.cobar.parser.ast.expression.primary.Wildcard) Pair(com.alibaba.cobar.parser.util.Pair) Substring(com.alibaba.cobar.parser.ast.expression.primary.function.string.Substring) GetFormat(com.alibaba.cobar.parser.ast.expression.primary.function.datetime.GetFormat) Trim(com.alibaba.cobar.parser.ast.expression.primary.function.string.Trim) RowExpression(com.alibaba.cobar.parser.ast.expression.primary.RowExpression) Sum(com.alibaba.cobar.parser.ast.expression.primary.function.groupby.Sum) LinkedList(java.util.LinkedList) Avg(com.alibaba.cobar.parser.ast.expression.primary.function.groupby.Avg) Min(com.alibaba.cobar.parser.ast.expression.primary.function.groupby.Min) SubqueryAllExpression(com.alibaba.cobar.parser.ast.expression.misc.SubqueryAllExpression) MinusExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.MinusExpression) BetweenAndExpression(com.alibaba.cobar.parser.ast.expression.comparison.BetweenAndExpression) BitAndExpression(com.alibaba.cobar.parser.ast.expression.bit.BitAndExpression) ComparisionEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionEqualsExpression) NegativeValueExpression(com.alibaba.cobar.parser.ast.expression.logical.NegativeValueExpression) QueryExpression(com.alibaba.cobar.parser.ast.expression.misc.QueryExpression) CastBinaryExpression(com.alibaba.cobar.parser.ast.expression.type.CastBinaryExpression) InExpression(com.alibaba.cobar.parser.ast.expression.comparison.InExpression) BitInvertExpression(com.alibaba.cobar.parser.ast.expression.bit.BitInvertExpression) BitXORExpression(com.alibaba.cobar.parser.ast.expression.bit.BitXORExpression) FunctionExpression(com.alibaba.cobar.parser.ast.expression.primary.function.FunctionExpression) BitShiftExpression(com.alibaba.cobar.parser.ast.expression.bit.BitShiftExpression) BitOrExpression(com.alibaba.cobar.parser.ast.expression.bit.BitOrExpression) ComparisionGreaterThanOrEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionGreaterThanOrEqualsExpression) MatchExpression(com.alibaba.cobar.parser.ast.expression.primary.MatchExpression) ComparisionIsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionIsExpression) LogicalOrExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalOrExpression) ComparisionGreaterThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionGreaterThanExpression) ComparisionLessOrGreaterThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessOrGreaterThanExpression) SubqueryAnyExpression(com.alibaba.cobar.parser.ast.expression.misc.SubqueryAnyExpression) RegexpExpression(com.alibaba.cobar.parser.ast.expression.string.RegexpExpression) LogicalAndExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalAndExpression) ArithmeticMultiplyExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticMultiplyExpression) ComparisionLessThanOrEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessThanOrEqualsExpression) ComparisionNullSafeEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionNullSafeEqualsExpression) LikeExpression(com.alibaba.cobar.parser.ast.expression.string.LikeExpression) ArithmeticSubtractExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticSubtractExpression) SoundsLikeExpression(com.alibaba.cobar.parser.ast.expression.string.SoundsLikeExpression) ArithmeticIntegerDivideExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticIntegerDivideExpression) CollateExpression(com.alibaba.cobar.parser.ast.expression.type.CollateExpression) LogicalNotExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalNotExpression) Expression(com.alibaba.cobar.parser.ast.expression.Expression) AssignmentExpression(com.alibaba.cobar.parser.ast.expression.misc.AssignmentExpression) CaseWhenOperatorExpression(com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression) LogicalXORExpression(com.alibaba.cobar.parser.ast.expression.logical.LogicalXORExpression) UserExpression(com.alibaba.cobar.parser.ast.expression.misc.UserExpression) ArithmeticAddExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticAddExpression) ComparisionNotEqualsExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionNotEqualsExpression) RowExpression(com.alibaba.cobar.parser.ast.expression.primary.RowExpression) ComparisionLessThanExpression(com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessThanExpression) ArithmeticModExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticModExpression) ArithmeticDivideExpression(com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticDivideExpression)

Aggregations

LiteralString (com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString)6 Expression (com.alibaba.cobar.parser.ast.expression.Expression)5 ArithmeticAddExpression (com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticAddExpression)3 ArithmeticDivideExpression (com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticDivideExpression)3 ArithmeticIntegerDivideExpression (com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticIntegerDivideExpression)3 ArithmeticModExpression (com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticModExpression)3 ArithmeticMultiplyExpression (com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticMultiplyExpression)3 ArithmeticSubtractExpression (com.alibaba.cobar.parser.ast.expression.arithmeic.ArithmeticSubtractExpression)3 MinusExpression (com.alibaba.cobar.parser.ast.expression.arithmeic.MinusExpression)3 BitAndExpression (com.alibaba.cobar.parser.ast.expression.bit.BitAndExpression)3 BitInvertExpression (com.alibaba.cobar.parser.ast.expression.bit.BitInvertExpression)3 BitOrExpression (com.alibaba.cobar.parser.ast.expression.bit.BitOrExpression)3 BitShiftExpression (com.alibaba.cobar.parser.ast.expression.bit.BitShiftExpression)3 BitXORExpression (com.alibaba.cobar.parser.ast.expression.bit.BitXORExpression)3 BetweenAndExpression (com.alibaba.cobar.parser.ast.expression.comparison.BetweenAndExpression)3 ComparisionEqualsExpression (com.alibaba.cobar.parser.ast.expression.comparison.ComparisionEqualsExpression)3 ComparisionGreaterThanExpression (com.alibaba.cobar.parser.ast.expression.comparison.ComparisionGreaterThanExpression)3 ComparisionGreaterThanOrEqualsExpression (com.alibaba.cobar.parser.ast.expression.comparison.ComparisionGreaterThanOrEqualsExpression)3 ComparisionIsExpression (com.alibaba.cobar.parser.ast.expression.comparison.ComparisionIsExpression)3 ComparisionLessOrGreaterThanExpression (com.alibaba.cobar.parser.ast.expression.comparison.ComparisionLessOrGreaterThanExpression)3