Commit 774fc26
authored
[improve](syntax) compatiable with mysql MOD syntax (#58432)
### What problem does this PR solve?
This PR improves compatibility with MySQL arithmetic expression syntax,
allow user use `%` and `MOD` to represent modular semantics.
Note that the `MOD` is a non-reserved keyword, can be used in arithmetic
expressions, MOD function name or to represent aliases in as statements.
before:
```sql
SELECT 10 MOD 3 as mod;
ERROR 1105 (HY000): errCode = 2, detailMessage =
mismatched input '3' expecting {<EOF>, ';'}(line 1, pos 19)
```
after:
```sql
mysql> SELECT 10 MOD 3 as mod;
+------+
| mod |
+------+
| 1 |
+------+
```
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [x] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->1 parent f1b6e16 commit 774fc26
File tree
5 files changed
+18
-1
lines changed- fe/fe-core/src/main
- antlr4/org/apache/doris/nereids
- java/org/apache/doris/nereids/parser
- regression-test
- data/nereids_p0/operator
- suites/nereids_p0/operator
5 files changed
+18
-1
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
| 617 | + | |
617 | 618 | | |
618 | 619 | | |
619 | 620 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1598 | 1598 | | |
1599 | 1599 | | |
1600 | 1600 | | |
1601 | | - | |
| 1601 | + | |
1602 | 1602 | | |
1603 | 1603 | | |
1604 | 1604 | | |
| |||
2102 | 2102 | | |
2103 | 2103 | | |
2104 | 2104 | | |
| 2105 | + | |
2105 | 2106 | | |
2106 | 2107 | | |
2107 | 2108 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3035 | 3035 | | |
3036 | 3036 | | |
3037 | 3037 | | |
| 3038 | + | |
| 3039 | + | |
3038 | 3040 | | |
3039 | 3041 | | |
3040 | 3042 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
79 | 82 | | |
0 commit comments