Cassandra list<blob> read data incorrectly -
reading list , got wrong data.
create table tt (k text primary key, msg list<blob>); static byte[] msg = new byte[] { 6, 6 }; static byte[] msg1 = new byte[] { 7, 7 }; preparedstatement upsert = session.prepare("update tt set msg = msg + ? k = ?"); session.execute(upsert.bind(collections.singletonlist(bytebuffer.wrap(msg)), key)); upsert = session.prepare("update tt set msg = msg + ? k = ?"); session.execute(upsert.bind(collections.singletonlist(bytebuffer.wrap(msg1)), key)); preparedstatement statement = session.prepare("select msg tt k = ?"); resultset rs = session.execute(statement.bind(key)); (bytebuffer bs : rs.one().getlist("msg", bytebuffer.class)) { (byte b : bs.array()) system.out.print(b + ", "); system.out.println(); }
data stored correctly:
cqlsh:bellrock> select msg tt; msg ------------------ [0x0606, 0x0707]
but outputs as:
0, 0, 0, 2, 0, 0, 0, 2, 6, 6, 0, 0, 0, 2, 7, 7,
0, 0, 0, 2, 0, 0, 0, 2, 6, 6, 0, 0, 0, 2, 7, 7,
cqlsh:ks> show version [cqlsh 5.0.1 | cassandra 2.2.0 | cql spec 3.3.0 | native protocol v4]
driver version: cassandra-driver-core 2.1.7.1
it turned out bug in driver cassandra-driver-core 2.1.7.1 works fine after put in earlier version 2.0.10.1
Comments
Post a Comment