Apply bitand, bitor, bitshiftleft, bitshiftright, and bitmask operations to an output window.
The example creates two schemas named IntNumbersSchema and ResultNumbersSchema.
The example applies bitwise functions to ResultNumbersSchema. Bitwise functions allow you to access and manipulate the individual bits that make up the data.
CREATE SCHEMA IntNumbersSchema (
IntNumber INTEGER
);
CREATE SCHEMA ResultNumbersSchema (
IntNumber INTEGER,
Bit_Shift_Left INTEGER,
Bit_Shift_Right INTEGER,
Bit_Mask INTEGER,
Bit_And INTEGER,
Bit_Or INTEGER
);
CREATE Input Window InNumbers
SCHEMA IntNumbersSchema
Primary Key (IntNumber);
CREATE OUTPUT WINDOW OutNumbers
SCHEMA ResultNumbersSchema
PRIMARY KEY ( IntNumber)
AS
SELECT
i.IntNumber as IntNumber,
bitshiftleft(i.IntNumber, 2) as Bit_Shift_Left,
bitshiftright(i.IntNumber, 2) as Bit_Shift_Right,
bitmask(0, 4) as Bit_Mask,
bitand(i.IntNumber, 4) as Bit_And,
bitor(i.IntNumber, 4) as Bit_Or
FROM
InNumbers i;
ATTACH INPUT ADAPTER InAdapter
TYPE dsv_in
TO InNumbers
PROPERTIES
dir='../exampledata',
file = 'Numbers1000.csv' ,
delimiter = '' ;