Commit graph

33 commits

Author SHA1 Message Date
Jussi Saurio
913367409e Merge 'Parse hex integers 2' from Anton Harniakou
Continuation of #1329

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1347
2025-04-16 11:13:01 +03:00
Jussi Saurio
cc8f89e8e0 Merge 'Fix Unary Negate Operation on Blobs' from Pedro Muniz
Fixing stuff that appears in Fuzz testing.
# Before
<img width="668" alt="image" src="https://github.com/user-
attachments/assets/f1f59b63-5173-4932-98b2-774803cb8a8e" />
```
limbo> EXPLAIN SELECT -x'';
addr  opcode             p1    p2    p3    p4             p5  comment
----  -----------------  ----  ----  ----  -------------  --  -------
0     Init               0     5     0                    0   Start at 5
1     Blob               0     2     0                    0   r[2]= (len=0)
2     Multiply           3     2     1                    0   r[1]=r[3]*r[2]
3     ResultRow          1     1     0                    0   output=r[1]
4     Halt               0     0     0                    0
5     Integer            -1    3     0                    0   r[3]=-1
6     Goto               0     1     0                    0
```
# After
<img width="175" alt="image" src="https://github.com/user-
attachments/assets/9f361dc3-b243-4d69-bdd2-d6a2bbc0bf20" />
```
limbo> EXPLAIN SELECT -x'';
addr  opcode             p1    p2    p3    p4             p5  comment
----  -----------------  ----  ----  ----  -------------  --  -------
0     Init               0     5     0                    0   Start at 5
1     Blob               0     2     0                    0   r[2]= (len=0)
2     Subtract           3     2     1                    0   r[1]=r[3]-r[2]
3     ResultRow          1     1     0                    0   output=r[1]
4     Halt               0     0     0                    0
5     Integer            0     3     0                    0   r[3]=0
6     Goto               0     1     0                    0
```
# Sqlite
```
sqlite> SELECT -x'';
0
sqlite> EXPLAIN SELECT -x'';
addr  opcode         p1    p2    p3    p4             p5  comment
----  -------------  ----  ----  ----  -------------  --  -------------
0     Init           0     4     0                    0   Start at 4
1     Subtract       3     2     1                    0   r[1]=r[2]-r[3]
2     ResultRow      1     1     0                    0   output=r[1]
3     Halt           0     0     0                    0
4     Integer        0     2     0                    0   r[2]=0
5     Blob           0     3     0                    0   r[3]= (len=0)
6     Goto           0     1     0                    0
```

Closes #1333
2025-04-15 14:42:54 +03:00
Jussi Saurio
6463448fdc Merge 'Fix incompatibility AND Operation' from Pedro Muniz
Sqlite reference implementation: https://github.com/sqlite/sqlite/blob/8
37dc09bce7de8971c7488b70cf5da93c60fbed0/src/vdbe.c#L2558
We did not support blobs before and our ordering of the match statements
were incorrect when one of the arguments was NULL

Closes #1337
2025-04-15 14:37:29 +03:00
Anton Harniakou
3c06ddadde Parse hex integers in unary operators
Unary operators ~ and - should work with hex integers
2025-04-14 21:13:39 +03:00
pedrocarlo
e1ddf5ffcc Fix Unary Negate Operation on Blobs 2025-04-14 12:05:00 -03:00
Jussi Saurio
79b08a80ab Merge 'Parse hexidecimal integers' from Anton Harniakou
Fixes #1304
Maybe I should add tests?

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1329
2025-04-14 11:49:10 +03:00
pedrocarlo
af456513d1 Fix incompatibility AND Expression 2025-04-13 22:38:43 -03:00
Anton Harniakou
499d9b8d45 Add integration tests for hex numbers 2025-04-13 21:50:48 +03:00
pedrocarlo
1297cb107c bit-not and boolean-not
Co-authored-by: Diego Reis <79876389+diegoreis42@users.noreply.github.com>
2025-04-13 02:45:12 -03:00
jachewz
ebf467d04e rename math.test % operator tests from mod- to remainder- 2025-04-07 22:03:48 +10:00
jachewz
db15661b7e fix: i64 % -1 overflow panic 2025-04-07 22:03:48 +10:00
jachewz
a72b75e193 fix: remainder operator rhs text 2025-04-07 22:03:48 +10:00
Ihor Andrianov
8b9f34af71
fix tests and return nan as null 2025-03-29 14:46:11 +02:00
Levy A.
5eae685fa8 add tests 2025-03-26 07:04:03 -03:00
l.gualtieri
a9ad5a56b9 fix bug #1155 2025-03-23 16:51:10 +01:00
PThorpe92
b31363aecb
More improvements/cleanups to vdbe around casting 2025-02-24 21:31:26 -05:00
PThorpe92
66f0835d51
Add tests for corrected behavior around casting 2025-02-24 11:21:25 -05:00
psvri
e616bd5361 Implement Not 2025-01-20 00:21:23 +05:30
psvri
d3f28c51f4 Implement ShiftRight 2025-01-15 21:21:51 +05:30
psvri
5b4d82abbf Implement ShiftLeft 2025-01-15 18:54:07 +05:30
psvri
18137c932e Fix integer overflow output to be same result as sqlite3 2025-01-04 18:14:09 +05:30
psvri
2b879a4f40 Fix arithmetic operations for text values 2025-01-04 00:34:04 +05:30
PThorpe92
82de59dd88
Add compatability tests for mod operator 2024-12-27 15:39:02 -05:00
Lauri Virtanen
a1c77af8a8
Limit sin and mod tests rows 2024-12-17 00:14:26 +02:00
Lauri Virtanen
aa82164717
Add FIXME comments about floating point comparison tolerance 2024-12-17 00:14:25 +02:00
Lauri Virtanen
e69ee80fac
Support log(X) and log(B,X) math functions 2024-12-17 00:14:25 +02:00
Lauri Virtanen
89d0289444
Support pi() function 2024-12-17 00:14:25 +02:00
Lauri Virtanen
5e426a7624
Support binary math functions 2024-12-16 22:29:05 +02:00
Lauri Virtanen
f69fdc1645
Support unary math functions 2024-12-16 19:31:20 +02:00
PThorpe92
16595f39f5
Add support for unary op negation of aggregates 2024-12-11 15:38:21 -05:00
PThorpe92
d5391dc716
Add vdbe bitwise operators: and, or, not 2024-12-11 11:06:22 -05:00
jussisaurio
bb8ba7fb01 add tests for arithmetic on two aggregates with no from clause 2024-11-26 17:31:51 +02:00
Lauri Virtanen
1b2835b316
Add math operator compatibility tests 2024-11-24 22:12:23 +02:00