Skip to content

Commit

Permalink
[BugFix] fix mod operator not be parsed correctly (#33073)
Browse files Browse the repository at this point in the history
Signed-off-by: packy <[email protected]>
  • Loading branch information
packy92 authored and wanpengfei-git committed Oct 20, 2023
1 parent 4e22bf1 commit f52aee7
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.util.stream.Stream;

import static com.starrocks.sql.plan.PlanTestBase.assertContains;
import static com.starrocks.sql.plan.PlanTestNoneDBBase.connectContext;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

Expand Down Expand Up @@ -410,8 +411,9 @@ void testWrongVariableName() {
void testModOperator() {
String sql = "select 100 MOD 2";
List<StatementBase> stmts = SqlParser.parse(sql, new SessionVariable());
Analyzer.analyze(stmts.get(0), connectContext);
String newSql = AstToSQLBuilder.toSQL(stmts.get(0));
assertEquals("SELECT 100 % 2", newSql);
assertEquals("SELECT 100 % 2 AS `100 % 2`", newSql);
}

private static Stream<Arguments> keyWordSqls() {
Expand Down

0 comments on commit f52aee7

Please sign in to comment.