Skip to content

Commit c37e666

Browse files
committed
test: cover arithmetic negation in bitwise expressions
Signed-off-by: Amogh Ramesh <[email protected]>
1 parent cfcd150 commit c37e666

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎datafusion/sqllogictest/test_files/scalar.slt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,21 @@ from (values (NULL::INT, 7), (3, 7)) as t(a, b);
14551455
7 7 0
14561456
NULL NULL NULL
14571457

1458+
# arithmetic negation is not bitwise NOT
1459+
query IIIIII
1460+
select
1461+
i,
1462+
(-i) & i,
1463+
i | (-i),
1464+
(-i) ^ i,
1465+
-(i & j),
1466+
-(i | j)
1467+
from (values (5, 3), (6, 3)) as t(i, j)
1468+
order by i;
1469+
----
1470+
5 1 -1 -2 -1 -7
1471+
6 2 -2 -4 -2 -7
1472+
14581473
# bitwise xor with other operators
14591474
query II rowsort
14601475
select 2 * c - 1 ^ 856 + d + 3, d ^ 7 >> 4 from signed_integers;

0 commit comments

Comments
 (0)