Support for bitwise operators

I’m trying to translate SQL server queries that use bitwise AND (&) and bitwise NOT (~) operators but have not found a way to perform them in dremio. Does dremio support bitwise operators?

The following SQL server snippet is sample logic that I’m trying to rewrite:
WHEN CAST(varbinary_value AS INT) & 0x80 = 0x80
THEN do_something
ELSE something_else

@ttquan

have you tried to use bitwise_or and bitwise_and? Does it not work?

@balaji.ramaswamy
Thanks for pointing me in the right direction. Based on examples that I’ve found, looks like bitwise_and() takes integer as input. The variable I’m working with is varbinary, so performing

bitwise_and(cast(varbinary_value AS Integer), 128)

doesn’t work due to the invalid cast. I’m totally new with dremio so apologize for these basic questions.

@ttquan

What is the Varbinary value? Can you give me an example?

@balaji.ramaswamy

Below are some examples of the varbinary value:
0x805A
0xCF6902
0x9782DEDB
0x00
0x07
0x258C
0xFC