hector return Cassandra column names with trailing space

44 views
Skip to first unread message

shamsul haque

unread,
Jan 14, 2014, 9:45:44 AM1/14/14
to hector...@googlegroups.com
Hi,
I have just started with Cassandra, created a simple ColumnFamily and some data using command given on Getting started on Cassandra download page, by executing below queries.

CREATE TABLE users (
   user_id int PRIMARY KEY,
   fname text,
   lname text
);

INSERT INTO users (user_id,  fname, lname)
   VALUES (1745, 'john', 'smith');
INSERT INTO users (user_id,  fname, lname)
   VALUES (1744, 'john', 'doe');
INSERT INTO users (user_id,  fname, lname)
   VALUES (1746, 'john', 'smith');

But when i fetch data using Hector API from Cassandra in Column name it contain blank space like column name fname will be: ' fname '. And for my queries from Java Hector API i need to use same column name with blank space to fetch or save data.

My Hector code for fetching data:

RangeSlicesQuery<String, String, String> rangeSlicesQuery 
                = HFactory.createRangeSlicesQuery(keyspace, STR, STR, STR);
            rangeSlicesQuery.setColumnFamily(columnFamily)
            .setColumnNames(" fname ", " lname ")
            .setKeys("6", "5")
            .setRowCount(row_count);
QueryResult<OrderedRows<String, String, String>> result = rangeSlicesQuery.execute();

as i use column name in .setColumnNames(" fname ", " lname ") it gets data with same column names with blank space, if i will replace this with this .setColumnNames("fname", "lname") it will not get data.

Anybody have any idea, what i have done wrong, or what do i do to remove those trailing space.
Thanks
Reply all
Reply to author
Forward
0 new messages