FiSupport group by alias parser and eqeq default parser.
Java CI / Test JDK ${{ matrix.java }}, ${{ matrix.os }} (11, ubuntu-latest) (push) Waiting to run Details
Java CI / Test JDK ${{ matrix.java }}, ${{ matrix.os }} (17, ubuntu-latest) (push) Waiting to run Details
Java CI / Test JDK ${{ matrix.java }}, ${{ matrix.os }} (21, ubuntu-latest) (push) Waiting to run Details
Java CI / Test JDK ${{ matrix.java }}, ${{ matrix.os }} (8, ubuntu-latest) (push) Waiting to run Details

This commit is contained in:
林枸 2025-07-16 16:32:43 +08:00 committed by Shaojin Wen
parent ac484261c0
commit 0444f4f532
4 changed files with 18 additions and 1 deletions

View File

@ -91,6 +91,7 @@ public enum SQLBinaryOperator {
RegExp("REGEXP", 110),
NotRegExp("NOT REGEXP", 110),
Equality("=", 110),
EqEq("==", 110),
BitwiseNot("!", 130),
Concat("||", 140),

View File

@ -3657,7 +3657,8 @@ public class SQLExprParser extends SQLParser {
}
protected SQLExpr relationalRestEqeq(SQLExpr expr) {
return expr;
lexer.nextToken();
return new SQLBinaryOpExpr(expr, SQLBinaryOperator.EqEq, expr());
}
protected SQLExpr relationalRestTilde(SQLExpr expr) {

View File

@ -1100,6 +1100,10 @@ public class SQLSelectParser extends SQLParser {
} else {
item = this.exprParser.expr();
}
if (lexer.nextIf(Token.AS)) {
item = new SQLAliasedExpr(item, lexer.stringVal);
lexer.nextToken();
}
if (dialectFeatureEnabled(GroupByItemOrder)) {
if (lexer.token == Token.DESC) {

View File

@ -1,3 +1,14 @@
select if(a=='G', b, c) from test
--------------------
SELECT if(a == 'G', b, c)
FROM test
------------------------------------------------------------------------------------------------------------------------
select a, b, count(1) from test group by a as c, b as d
--------------------
SELECT a, b, count(1)
FROM test
GROUP BY a AS c, b AS d
------------------------------------------------------------------------------------------------------------------------
select c from b where c=1 ${if(len(a)=0,'and 1=1',"and a>0")} ${if(len(a)=0,'and 1=1',"and a>0")}
--------------------
SELECT c