mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve sql parser trino support
This commit is contained in:
+12
@@ -16,9 +16,12 @@
|
||||
package com.alibaba.druid.sql.dialect.presto.visitor;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLLimit;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLDecimalExpr;
|
||||
import com.alibaba.druid.sql.dialect.phoenix.visitor.PhoenixASTVisitor;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* presto 的输出的视图信息
|
||||
*
|
||||
@@ -44,4 +47,13 @@ public class PrestoOutputVisitor extends SQLASTOutputVisitor implements PhoenixA
|
||||
x.getRowCount().accept(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean visit(SQLDecimalExpr x) {
|
||||
BigDecimal value = x.getValue();
|
||||
print0(ucase ? "DECIMAL '" : "decimal '");
|
||||
print(value.toString());
|
||||
print('\'');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1612,6 +1612,9 @@ public class SQLExprParser extends SQLParser {
|
||||
accept(Token.RPAREN);
|
||||
|
||||
return groupingSets;
|
||||
} else if (lexer.token == Token.LITERAL_CHARS && expr instanceof SQLIdentifierExpr && ((SQLIdentifierExpr) expr).hashCode64() == FnvHash.Constants.DECIMAL) {
|
||||
expr = new SQLDecimalExpr(lexer.stringVal());
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
if (lexer.token == Token.LPAREN &&
|
||||
!(expr instanceof SQLIntegerExpr) && !(expr instanceof SQLHexExpr)) {
|
||||
|
||||
Reference in New Issue
Block a user