kreynolds / cassandra-cql

DBI-like CQL driver for Cassandra in Ruby
Apache License 2.0
67 stars 43 forks source link

cassandra-cql-1.2.1 can't handle insert statement with utf-8 chars #58

Open kenbod opened 11 years ago

kenbod commented 11 years ago

Hi,

I tried to execute the following insert statement with the latest version of the cassandra-cql gem:

UPDATE Event_Filter SET 'utøya' = '{"type":"track","enabled":true,"createDate":1376284277135,"modifiedDate":1376284277135}', 'utoya' = '{"type":"track","enabled":true,"createDate":1376284277135,"modifiedDate":1376284277135}' WHERE KEY = 'Utøya';

and it dies with this exception (generated by thrift):

.../gems/thrift-0.8.0/lib/thrift/transport/framed_transport.rb:84:in write': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError) from .../gems/thrift_client-0.8.4/lib/thrift_client/server.rb:90:inwrite' from .../gems/thrift-0.8.0/lib/thrift/protocol/binary_protocol.rb:112:in write_string' from .../gems/thrift-0.8.0/lib/thrift/client.rb:35:inwrite' from .../gems/thrift-0.8.0/lib/thrift/client.rb:35:in send_message' from .../gems/cassandra-cql-1.2.1/vendor/1.1/gen-rb/cassandra.rb:542:insend_execute_cql_query' from .../gems/cassandra-cql-1.2.1/vendor/1.1/gen-rb/cassandra.rb:537:in execute_cql_query' from .../gems/thrift_client-0.8.4/lib/thrift_client/abstract_thrift_client.rb:165:inblock in handled_proxy' from .../gems/thrift_client-0.8.4/lib/thrift_client/abstract_thrift_client.rb:146:in ensure_socket_alignment' from .../gems/thrift_client-0.8.4/lib/thrift_client/abstract_thrift_client.rb:165:inhandled_proxy' from .../gems/thrift_client-0.8.4/lib/thrift_client/abstract_thrift_client.rb:53:in execute_cql_query' from .../gems/cassandra-cql-1.2.1/lib/cassandra-cql/database.rb:112:inexecute_cql_query' from .../gems/cassandra-cql-1.2.1/lib/cassandra-cql/statement.rb:47:in execute' from .../gems/cassandra-cql-1.2.1/lib/cassandra-cql/database.rb:98:inexecute' from add_utøya.rb:17:in add_event' from add_utøya.rb:28:inmain' from add_utøya.rb:32:in `

'

Any suggestions on how to get this to work? It's amazing to me that thrift doesn't support UTF-8 encoding! Note: The cassandra gem fails on this as well, for the same reason.

I'm wondering if this has been fixed in thrift-0.9? Is there anyway to tell the cassandra-cql gem to make use of the thrift-0.9 library?