Support to Bitwise Operators
When using Event Hub with IOT usually we have to send binary data. We would like to use Stream Analytics to transform this binary information into a JSON, but Stream Analytics doesn't support Bitwise Operators.

1 comment
-
Chris Green commented
You can use division by 2, 4, 8, etc. to shift the bits to the right by 1, 2, 3, etc. bits. You'll need to cast the result to bigint to truncate the fractional part.
After shifting, the bit of interest will be rightmost bit (bit zero). Modulo 2 (% 2) will then remove all bits to the left of bit 0.
Combining the above you can extract the value of individual bits e.g. to get the value of bit 3:
cast(valueToCheck / 4 as bigint) % 2