Re: Object mapper for CQL
There is one High Level Java client for Cassandra which supports CQL is Kundera. You can find it here https://github.com/impetus-opensource/Kundera. Other useful links are https://github.com/impetus-opensource/Kundera/wiki/Getting-Started-in-5-minutes https://github.com/impetus-opensource/Kundera/wiki/Object-mapper How to use CQL https://github.com/impetus-opensource/Kundera/wiki/Cassandra-Specific-Features I hope it would help you. On Sun, Jun 8, 2014 at 7:53 AM, Kevin Burton bur...@spinn3r.com wrote: Looks like the java-driver is working on an object mapper: More modules including a simple object mapper will come shortly. But of course I need one now … I'm curious what others are doing here. I don't want to pass around Row objects in my code if I can avoid it.. Ideally I would just run a query and get back a POJO. Another issue is how are these POJOs generated. Are they generated from the schema? is the schema generated from the POJOs ? From a side file? And granted, there are existing ORMs out there but I don't think any support CQL. -- Founder/CEO Spinn3r.com Location: *San Francisco, CA* Skype: *burtonator* blog: http://burtonator.wordpress.com … or check out my Google+ profile https://plus.google.com/102718274791889610666/posts http://spinn3r.com War is peace. Freedom is slavery. Ignorance is strength. Corporations are people. -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
Re: Added extra column as composite key while creation counter column family
cassandra 1.2.0 Is it a bug in 1.2.0 ? Thanks KK On Wed, Apr 17, 2013 at 2:56 AM, aaron morton aa...@thelastpickle.comwrote: What version are you using ? WIth 1.2.4 … cqlsh:dev CREATE TABLE counters ( ... key text, ... value counter, ... PRIMARY KEY (key) ... ) WITH COMPACT STORAGE; cqlsh:dev describe table counters; CREATE TABLE counters ( key text PRIMARY KEY, value counter ) WITH COMPACT STORAGE AND bloom_filter_fp_chance=0.01 AND caching='KEYS_ONLY' AND comment='' AND dclocal_read_repair_chance=0.00 AND gc_grace_seconds=864000 AND read_repair_chance=0.10 AND replicate_on_write='true' AND populate_io_cache_on_flush='false' AND compaction={'class': 'SizeTieredCompactionStrategy'} AND compression={'sstable_compression': 'SnappyCompressor'}; Cheers - Aaron Morton Freelance Cassandra Consultant New Zealand @aaronmorton http://www.thelastpickle.com On 15/04/2013, at 3:58 PM, Kuldeep Mishra kuld.cs.mis...@gmail.com wrote: Hi, While I creating counter column family a extra column is being added what I do ? Table creation script CREATE TABLE counters ( key text, value counter, PRIMARY KEY (key) ) WITH COMPACT STORAGE after describing column family I am getting following CREATE TABLE counters ( key text, column1 text, value counter, PRIMARY KEY (key, column1) ) WITH COMPACT STORAGE AND bloom_filter_fp_chance=0.01 AND caching='KEYS_ONLY' AND comment='' AND dclocal_read_repair_chance=0.00 AND gc_grace_seconds=864000 AND read_repair_chance=0.10 AND replicate_on_write='true' AND compaction={'class': 'SizeTieredCompactionStrategy'} AND compression={'sstable_compression': 'SnappyCompressor'}; extra column column1 is added Please help -- Thanks and Regards Kuldeep Kumar Mishra +919540965199 -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
Added extra column as composite key while creation counter column family
Hi, While I creating counter column family a extra column is being added what I do ? Table creation script CREATE TABLE counters ( key text, value counter, PRIMARY KEY (key) ) WITH COMPACT STORAGE after describing column family I am getting following CREATE TABLE counters ( key text, * column1 text,* value counter, PRIMARY KEY (key,* column1*) ) WITH COMPACT STORAGE AND bloom_filter_fp_chance=0.01 AND caching='KEYS_ONLY' AND comment='' AND dclocal_read_repair_chance=0.00 AND gc_grace_seconds=864000 AND read_repair_chance=0.10 AND replicate_on_write='true' AND compaction={'class': 'SizeTieredCompactionStrategy'} AND compression={'sstable_compression': 'SnappyCompressor'}; extra column column1 is added Please help -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
Re: Getting NullPointerException while executing query
I am using cassandra 1.2.0, Thanks Kuldeep On Wed, Apr 10, 2013 at 10:40 PM, Sylvain Lebresne sylv...@datastax.comwrote: On which version of Cassandra are you? I can't reproduce the NullPointerException on Cassandra 1.2.3. That being said, that query is not valid, so you will get an error message. There is 2 reasons why it's not valid: 1) in token(deep), deep is not a valid term. So you should have something like: token('deep'). 2) the name column is not the partition key so the token method cannot be applied to it. A valid query with that schema would be for instance: select * from CQLUSER where token(id) token(4) though I don't know if that help in any way for what you aimed to do. -- Sylvain On Wed, Apr 10, 2013 at 9:42 AM, Kuldeep Mishra kuld.cs.mis...@gmail.comwrote: Hi , TABLE - CREATE TABLE CQLUSER ( id int PRIMARY KEY, age int, name text ) Query - select * from CQLUSER where token(name) token(deep); ERROR - Bad Request: Failed parsing statement: [select * from CQLUSER where token(name) token(deep);] reason: NullPointerException null text could not be lexed at line 1, char 15 -- Thanks and Regards Kuldeep Kumar Mishra +919540965199 -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
describe keyspace or column family query not working
Hi , I am trying to execute following query but not working and throwing exception QUERY:-- Cassandra.Client client; client.execute_cql3_query(ByteBuffer.wrap(describe keyspace mykeyspace.getBytes(Constants.CHARSET_UTF8)), Compression.NONE, ConsistencyLevel.ONE); client.execute_cql3_query(ByteBuffer.wrap(describe table mytable.getBytes(Constants.CHARSET_UTF8)), Compression.NONE, ConsistencyLevel.ONE); but both query giving following exception, STACK TRACE InvalidRequestException(why:line 1:0 no viable alternative at input 'describe') at org.apache.cassandra.thrift.Cassandra$execute_cql3_query_result.read(Cassandra.java:37849) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_cql3_query(Cassandra.java:1562) at org.apache.cassandra.thrift.Cassandra$Client.execute_cql3_query(Cassandra.java:1547) Please help.. Thanks and Regards Kuldeep -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
Getting NullPointerException while executing query
Hi , TABLE - CREATE TABLE CQLUSER ( id int PRIMARY KEY, age int, name text ) Query - select * from CQLUSER where token(name) token(deep); ERROR - Bad Request: Failed parsing statement: [select * from CQLUSER where token(name) token(deep);] reason: NullPointerException null text could not be lexed at line 1, char 15 -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
Re: cql query not giving any result.
Hi, Is it possible in Cassandra to make multiple column with same name ?, like in this particular scenario I have two column with same name as key, first one is rowkey and second on is column name . Thanks and Regards Kuldeep On Fri, Mar 15, 2013 at 4:05 PM, Kuldeep Mishra kuld.cs.mis...@gmail.comwrote: Hi , Following cql query not returning any result cqlsh:KunderaExamples select * from DOCTOR where key='kuldeep'; I have enabled secondary indexes on both column. Screen shot is attached Please help -- Thanks and Regards Kuldeep Kumar Mishra +919540965199 -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
Re: cql query not giving any result.
Hi Sylvain, I created it using thrift client, here is column family creation script, Cassandra.Client client; CfDef user_Def = new CfDef(); user_Def.name = DOCTOR; user_Def.keyspace = KunderaExamples; user_Def.setComparator_type(UTF8Type); user_Def.setDefault_validation_class(UTF8Type); user_Def.setKey_validation_class(UTF8Type); ColumnDef key = new ColumnDef(ByteBuffer.wrap(KEY.getBytes()), UTF8Type); key.index_type = IndexType.KEYS; ColumnDef age = new ColumnDef(ByteBuffer.wrap(AGE.getBytes()), UTF8Type); age.index_type = IndexType.KEYS; user_Def.addToColumn_metadata(key); user_Def.addToColumn_metadata(age); client.set_keyspace(KunderaExamples); client.system_add_column_family(user_Def); Thanks KK On Fri, Mar 15, 2013 at 4:24 PM, Sylvain Lebresne sylv...@datastax.comwrote: On Fri, Mar 15, 2013 at 11:43 AM, Kuldeep Mishra kuld.cs.mis...@gmail.com wrote: Hi, Is it possible in Cassandra to make multiple column with same name ?, like in this particular scenario I have two column with same name as key, first one is rowkey and second on is column name . No, it shouldn't be possible and that is your problem. How did you created that table? -- Sylvain Thanks and Regards Kuldeep On Fri, Mar 15, 2013 at 4:05 PM, Kuldeep Mishra kuld.cs.mis...@gmail.com wrote: Hi , Following cql query not returning any result cqlsh:KunderaExamples select * from DOCTOR where key='kuldeep'; I have enabled secondary indexes on both column. Screen shot is attached Please help -- Thanks and Regards Kuldeep Kumar Mishra +919540965199 -- Thanks and Regards Kuldeep Kumar Mishra +919540965199 -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
Re: getting error for decimal type data
ColumnFamily: STUDENT Key Validation Class: org.apache.cassandra.db.marshal.LongType Default column value validator: org.apache.cassandra.db.marshal.BytesType Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type GC grace seconds: 864000 Compaction min/max thresholds: 4/32 Read repair chance: 0.1 DC Local Read repair chance: 0.0 Replicate on write: true Caching: KEYS_ONLY Bloom Filter FP chance: default Built indexes: [STUDENT.STUDENT_AGE_idx, STUDENT.STUDENT_BIG_DECIMAL_idx, STUDENT.STUDENT_PERCENTAGE_idx, STUDENT.STUDENT_ROLL_NUMBER_idx, STUDENT.STUDENT_SEMESTER_idx, STUDENT.STUDENT_STUDENT_NAME_idx, STUDENT.STUDENT_UNIQUE_ID_idx] Column Metadata: Column Name: PERCENTAGE Validation Class: org.apache.cassandra.db.marshal.FloatType Index Name: STUDENT_PERCENTAGE_idx Index Type: KEYS Column Name: AGE Validation Class: org.apache.cassandra.db.marshal.IntegerType Index Name: STUDENT_AGE_idx Index Type: KEYS Column Name: SEMESTER Validation Class: org.apache.cassandra.db.marshal.UTF8Type Index Name: STUDENT_SEMESTER_idx Index Type: KEYS Column Name: ROLL_NUMBER Validation Class: org.apache.cassandra.db.marshal.LongType Index Name: STUDENT_ROLL_NUMBER_idx Index Type: KEYS Column Name: UNIQUE_ID Validation Class: org.apache.cassandra.db.marshal.LongType Index Name: STUDENT_UNIQUE_ID_idx Index Type: KEYS Column Name: STUDENT_NAME Validation Class: org.apache.cassandra.db.marshal.UTF8Type Index Name: STUDENT_STUDENT_NAME_idx Index Type: KEYS *Column Name: BIG_DECIMAL Validation Class: org.apache.cassandra.db.marshal.DecimalType Index Name: STUDENT_BIG_DECIMAL_idx Index Type: KEYS* Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy Compression Options: sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor for value of *BIG_DECIMAL is *2.28542855225E-825373481 Thanks Kuldeep On Tue, Jan 29, 2013 at 1:52 PM, Rishabh Agrawal rishabh.agra...@impetus.co.in wrote: Can you provide specs of the column family using describe. *From:* Kuldeep Mishra [mailto:kuld.cs.mis...@gmail.com] *Sent:* Tuesday, January 29, 2013 12:37 PM *To:* user@cassandra.apache.org *Subject:* getting error for decimal type data while I an trying to list column family data using cassandra-cli then I am getting following problem for decimal type data, any suggestion will be appreciated. Exception in thread main java.lang.OutOfMemoryError: Java heap space at java.lang.AbstractStringBuilder.init(AbstractStringBuilder.java:45) at java.lang.StringBuilder.init(StringBuilder.java:80) at java.math.BigDecimal.getValueString(BigDecimal.java:2885) at java.math.BigDecimal.toPlainString(BigDecimal.java:2869) at org.apache.cassandra.cql.jdbc.JdbcDecimal.getString(JdbcDecimal.java:72) at org.apache.cassandra.db.marshal.DecimalType.getString(DecimalType.java:62) at org.apache.cassandra.cli.CliClient.printSliceList(CliClient.java:2873) at org.apache.cassandra.cli.CliClient.executeList(CliClient.java:1486) at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:272) at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:210) at org.apache.cassandra.cli.CliMain.main(CliMain.java:337) -- Thanks and Regards Kuldeep Kumar Mishra +919540965199 -- NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference. -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
getting error for decimal type data
while I an trying to list column family data using cassandra-cli then I am getting following problem for decimal type data, any suggestion will be appreciated. Exception in thread main java.lang.OutOfMemoryError: Java heap space at java.lang.AbstractStringBuilder.init(AbstractStringBuilder.java:45) at java.lang.StringBuilder.init(StringBuilder.java:80) at java.math.BigDecimal.getValueString(BigDecimal.java:2885) at java.math.BigDecimal.toPlainString(BigDecimal.java:2869) at org.apache.cassandra.cql.jdbc.JdbcDecimal.getString(JdbcDecimal.java:72) at org.apache.cassandra.db.marshal.DecimalType.getString(DecimalType.java:62) at org.apache.cassandra.cli.CliClient.printSliceList(CliClient.java:2873) at org.apache.cassandra.cli.CliClient.executeList(CliClient.java:1486) at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:272) at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:210) at org.apache.cassandra.cli.CliMain.main(CliMain.java:337) -- Thanks and Regards Kuldeep Kumar Mishra +919540965199
Re: error when creating column family using cql3 and persisting data using thrift
Hi Aaron, I am using thrift client. Here is column family creation script:- ``` String colFamily = CREATE COLUMNFAMILY users (key varchar PRIMARY KEY,full_name varchar, birth_date int,state varchar); conn.execute_cql3_query(ByteBuffer.wrap(colFamily.getBytes()), Compression.NONE, ConsistencyLevel.ONE); `` and thrift operation code :- ``` Cassandra.Client conn MapByteBuffer, MapString, ListMutation mutationMap = new HashMapByteBuffer, MapString, ListMutation(); ListMutation insertion_list = new ArrayListMutation(); Mutation mut = new Mutation(); Column column = new Column(ByteBuffer.wrap(full_name.getBytes())); column.setValue(ByteBuffer.wrap(emp.getBytes())); mut.setColumn_or_supercolumn(new ColumnOrSuperColumn().setColumn(column)); insertion_list.add(mut); MapString, ListMutation columnFamilyValues = new HashMapString, ListMutation(); columnFamilyValues.put(users, insertion_list); mutationMap.put(ByteBuffer.wrap(K.getBytes()), columnFamilyValues); conn.batch_mutate(mutationMap, ConsistencyLevel.ONE); `` and error stack trace :- `` InvalidRequestException(why:Not enough bytes to read value of component 0) at org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:20833) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) at org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:964) at org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(Cassandra.java:950) Thanks Kuldeep Mishra On Thu, Jan 17, 2013 at 8:40 AM, aaron morton aa...@thelastpickle.comwrote: The thrift request is not sending a composite type where it should. CQL 3 uses composites in a lot of places. What was your table definition? Are you using a high level client or rolling your own? Cheers - Aaron Morton Freelance Cassandra Developer New Zealand @aaronmorton http://www.thelastpickle.com On 16/01/2013, at 5:32 AM, James Schappet jschap...@gmail.com wrote: I also saw this while testing the https://github.com/boneill42/naughty-or-nice example project. --Jimmy From: Kuldeep Mishra kuld.cs.mis...@gmail.com Reply-To: user@cassandra.apache.org Date: Tuesday, January 15, 2013 10:29 AM To: user@cassandra.apache.org Subject: error when creating column family using cql3 and persisting data using thrift Hi, I am facing following problem, when creating column family using cql3 and trying to persist data using thrift 1.2.0 in cassandra-1.2.0. Details: InvalidRequestException(why:Not enough bytes to read value of component 0) at org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:20833) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) at org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:964) at org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(Cassandra.java:950) at com.impetus.client.cassandra.thrift.ThriftClient.onPersist(ThriftClient.java:157) Please help me. -- Thanks and Regards Kuldeep Kumar Mishra +919540965199 -- Thanks and Regards Kuldeep Kumar Mishra +919540965199