jeudi 13 août 2015

Why Cassandra cql query with hexadecimal literal works but textAsBinary does not?

I can do cassandra cql queries using hexadecimal literal, but when I try to use textAsBlob it does not work

For example the following works just fine:

cqlsh:sprich> SELECT * FROM "STOCK_CHECK_RTAM_ITEM_INDEX" WHERE key in (0x3631313230);

 key          | column1        | value

--------------+----------------+------------------------------------

0x3631313230 | 0x000330303100 | 0xf77374b5eced11e3a877005056b37d30

 0x3631313230 | 0x000330303200 | 0xf7757084eced11e3a877005056b37d30

 0x3631313230 | 0x000330303400 | 0xf7712ac8eced11e3a877005056b37d30

But the following two queries do not:

cqlsh:sprich> SELECT * FROM "STOCK_CHECK_RTAM_ITEM_INDEX" WHERE key in (textAsBlob("0x3631313230"));

Bad Request: line 1:84 missing EOF at ')'
text could not be lexed at line 1, char 15

cqlsh:sprich> SELECT * FROM "STOCK_CHECK_RTAM_ITEM_INDEX" WHERE key in (textAsBlob("3631313230"));
Bad Request: line 1:82 missing EOF at ')'
text could not be lexed at line 1, char 15

The following two queries do not give a syntax error but do not return the proper results as well:

cqlsh:sprich> SELECT * FROM "STOCK_CHECK_RTAM_ITEM_INDEX" WHERE key in (textAsBlob('0x3631313230'));

cqlsh:sprich> SELECT * FROM "STOCK_CHECK_RTAM_ITEM_INDEX" WHERE key in (textAsBlob('3631313230'));

Why is textAsBlob is not working? What mistake am I making in the proper use of textAsBlob?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire