If you really want to load strings into MonetDB and convert them to
integers on the fly in your query before doing your bitwise operations, you
can have fun with implementing your own function for this (both ways, from
string2int and int2string).
One way is to implement it in C, which is trivial, and then make it become
a UDF in MonetDB (less trivial but instructive):
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/UserDefinedFuncti...
.
Another way is to enable the python integration (
https://www.monetdb.org/blog/embedded-pythonnumpy-monetdb) and then write
your UDF in python without any need to recompile. The UDF in python would
be a one-line: int('1001001',2)
Good luck.
On 10 March 2016 at 22:29, Sjoerd Mullender
Text is about the worst type you could have chosen. Far better is to choose one of the integer types: tinyint, smallint, integer, bigint, depending on the maximum number of bits that you have. If you have a CSV file and the column contains just sequences of 0 and 1, you will need to convert those number to e.g. hexadecimal notation (i.e. something like 0x42ab). Once you have loaded the data as integers, you can use the bitwise operators. & is bitwise AND, | is bitwise OR.
On 03/10/2016 10:01 PM, Shmagi Kavtaradze wrote:
I am new to Monetdb. I am using Postgresql mainly, but want to check Monetdb performace. In Postres I have column of type bit() filled with 0s and 1s. Then I am comparing each row to all other rows with bitwise AND on that column. Monetdb does not have bit() type so I used text. Any ideas how to do bitwise AND in monetdb and what type of column should I use for this? The query I tried:
select a.sentenecid, b.sentenecid, a.sentence AND b.sentence from test a, test b;
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- Sjoerd Mullender
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list