Commit 1bec017
committed
[CALCITE-7639] Simplify shift helpers: endsImmediatelyBefore, Math.floorMod, unsigned-amount tests
Address further review feedback:
* SqlParserPos: replace the symmetric adjacent(SqlParserPos) with the
directional endsImmediatelyBefore(SqlParserPos), which is more precise
for the right-shift token check and is now used directly by the parser.
* SqlFunctions: replace the hand-rolled ((y % w) + w) % w shift-amount
normalization with Math.floorMod(y, w) throughout leftShift/rightShift.
* SqlOperatorTest: add tests showing a BIGINT shift amount is accepted
while an unsigned shift amount is rejected at validation, for both the
>> operator and the RIGHTSHIFT function.1 parent 3fd6f5e commit 1bec017
5 files changed
Lines changed: 53 additions & 54 deletions
File tree
- core/src
- main
- codegen/templates
- java/org/apache/calcite
- runtime
- sql/parser
- test/java/org/apache/calcite/sql/parser
- testkit/src/main/java/org/apache/calcite/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8497 | 8497 | | |
8498 | 8498 | | |
8499 | 8499 | | |
8500 | | - | |
| 8500 | + | |
8501 | 8501 | | |
8502 | 8502 | | |
8503 | 8503 | | |
| |||
Lines changed: 16 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3780 | 3780 | | |
3781 | 3781 | | |
3782 | 3782 | | |
3783 | | - | |
| 3783 | + | |
3784 | 3784 | | |
3785 | 3785 | | |
3786 | 3786 | | |
| |||
3794 | 3794 | | |
3795 | 3795 | | |
3796 | 3796 | | |
3797 | | - | |
| 3797 | + | |
3798 | 3798 | | |
3799 | 3799 | | |
3800 | 3800 | | |
| |||
3806 | 3806 | | |
3807 | 3807 | | |
3808 | 3808 | | |
3809 | | - | |
| 3809 | + | |
3810 | 3810 | | |
3811 | 3811 | | |
3812 | 3812 | | |
| |||
3828 | 3828 | | |
3829 | 3829 | | |
3830 | 3830 | | |
3831 | | - | |
| 3831 | + | |
3832 | 3832 | | |
3833 | 3833 | | |
3834 | 3834 | | |
| |||
3875 | 3875 | | |
3876 | 3876 | | |
3877 | 3877 | | |
3878 | | - | |
| 3878 | + | |
3879 | 3879 | | |
3880 | 3880 | | |
3881 | 3881 | | |
| |||
3886 | 3886 | | |
3887 | 3887 | | |
3888 | 3888 | | |
3889 | | - | |
| 3889 | + | |
3890 | 3890 | | |
3891 | 3891 | | |
3892 | 3892 | | |
| |||
3897 | 3897 | | |
3898 | 3898 | | |
3899 | 3899 | | |
3900 | | - | |
| 3900 | + | |
3901 | 3901 | | |
3902 | 3902 | | |
3903 | 3903 | | |
| |||
3908 | 3908 | | |
3909 | 3909 | | |
3910 | 3910 | | |
3911 | | - | |
| 3911 | + | |
3912 | 3912 | | |
3913 | 3913 | | |
3914 | 3914 | | |
| |||
3922 | 3922 | | |
3923 | 3923 | | |
3924 | 3924 | | |
3925 | | - | |
| 3925 | + | |
3926 | 3926 | | |
3927 | 3927 | | |
3928 | 3928 | | |
| |||
3936 | 3936 | | |
3937 | 3937 | | |
3938 | 3938 | | |
3939 | | - | |
| 3939 | + | |
3940 | 3940 | | |
3941 | 3941 | | |
3942 | 3942 | | |
| |||
3948 | 3948 | | |
3949 | 3949 | | |
3950 | 3950 | | |
3951 | | - | |
| 3951 | + | |
3952 | 3952 | | |
3953 | 3953 | | |
3954 | 3954 | | |
| |||
3970 | 3970 | | |
3971 | 3971 | | |
3972 | 3972 | | |
3973 | | - | |
| 3973 | + | |
3974 | 3974 | | |
3975 | 3975 | | |
3976 | 3976 | | |
| |||
4017 | 4017 | | |
4018 | 4018 | | |
4019 | 4019 | | |
4020 | | - | |
| 4020 | + | |
4021 | 4021 | | |
4022 | 4022 | | |
4023 | 4023 | | |
| |||
4028 | 4028 | | |
4029 | 4029 | | |
4030 | 4030 | | |
4031 | | - | |
| 4031 | + | |
4032 | 4032 | | |
4033 | 4033 | | |
4034 | 4034 | | |
| |||
4039 | 4039 | | |
4040 | 4040 | | |
4041 | 4041 | | |
4042 | | - | |
| 4042 | + | |
4043 | 4043 | | |
4044 | 4044 | | |
4045 | 4045 | | |
| |||
4050 | 4050 | | |
4051 | 4051 | | |
4052 | 4052 | | |
4053 | | - | |
| 4053 | + | |
4054 | 4054 | | |
4055 | 4055 | | |
4056 | 4056 | | |
| |||
Lines changed: 3 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | 267 | | |
283 | 268 | | |
284 | | - | |
| 269 | + | |
| 270 | + | |
285 | 271 | | |
286 | 272 | | |
287 | 273 | | |
288 | 274 | | |
289 | 275 | | |
290 | | - | |
| 276 | + | |
291 | 277 | | |
292 | 278 | | |
293 | 279 | | |
| |||
Lines changed: 18 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
41 | 41 | | |
42 | | - | |
43 | | - | |
| 42 | + | |
44 | 43 | | |
45 | | - | |
46 | | - | |
| 44 | + | |
| 45 | + | |
47 | 46 | | |
48 | | - | |
49 | | - | |
| 47 | + | |
| 48 | + | |
50 | 49 | | |
51 | | - | |
52 | | - | |
| 50 | + | |
| 51 | + | |
53 | 52 | | |
54 | | - | |
| 53 | + | |
55 | 54 | | |
56 | | - | |
57 | | - | |
| 55 | + | |
58 | 56 | | |
59 | 57 | | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17206 | 17206 | | |
17207 | 17207 | | |
17208 | 17208 | | |
| 17209 | + | |
| 17210 | + | |
| 17211 | + | |
| 17212 | + | |
| 17213 | + | |
| 17214 | + | |
| 17215 | + | |
| 17216 | + | |
| 17217 | + | |
17209 | 17218 | | |
17210 | 17219 | | |
17211 | 17220 | | |
| |||
17323 | 17332 | | |
17324 | 17333 | | |
17325 | 17334 | | |
| 17335 | + | |
| 17336 | + | |
| 17337 | + | |
| 17338 | + | |
| 17339 | + | |
| 17340 | + | |
17326 | 17341 | | |
17327 | 17342 | | |
17328 | 17343 | | |
| |||
0 commit comments