Re: cql query not giving any result.

2013-03-18 Thread Sylvain Lebresne
CQL can't work correctly if 2 (CQL) columns have the same name. Now, to
allow upgrade from thrift, CQL does use some default names like key for
the Row key when there isn't anything else.

Honestly I think the easiest workaround here is probably to disambiguate
things manually. Typically, you could update the column family definition
to set the key_alias (in CfDef) to some name that make sense for you. This
will end up being the name of the Row key for CQL. You may also try issue a
RENAME from CQL to rename the row key, which should work. Typically
something like ALTER KunderaExamples RENAME key TO rowKey.

--
Sylvain



On Sat, Mar 16, 2013 at 4:39 AM, Vivek Mishra mishra.v...@gmail.com wrote:

 Any suggestions?
 -Vivek

 On Fri, Mar 15, 2013 at 5:20 PM, Vivek Mishra mishra.v...@gmail.comwrote:

 Ok. So it's a case  when, CQL returns rowkey value as key and there is
 also column present with name as key.

 Sounds like a bug?

 -Vivek


 On Fri, Mar 15, 2013 at 5:17 PM, Kuldeep Mishra kuld.cs.mis...@gmail.com
  wrote:

 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: cql query not giving any result.

2013-03-18 Thread Vivek Mishra
If this is the case, Why can't we restrict key as a keyword and not to be
used as a column name?

-Vivek

On Mon, Mar 18, 2013 at 2:37 PM, Sylvain Lebresne sylv...@datastax.comwrote:

 CQL can't work correctly if 2 (CQL) columns have the same name. Now, to
 allow upgrade from thrift, CQL does use some default names like key for
 the Row key when there isn't anything else.

 Honestly I think the easiest workaround here is probably to disambiguate
 things manually. Typically, you could update the column family definition
 to set the key_alias (in CfDef) to some name that make sense for you. This
 will end up being the name of the Row key for CQL. You may also try issue a
 RENAME from CQL to rename the row key, which should work. Typically
 something like ALTER KunderaExamples RENAME key TO rowKey.

 --
 Sylvain



 On Sat, Mar 16, 2013 at 4:39 AM, Vivek Mishra mishra.v...@gmail.comwrote:

 Any suggestions?
 -Vivek

 On Fri, Mar 15, 2013 at 5:20 PM, Vivek Mishra mishra.v...@gmail.comwrote:

 Ok. So it's a case  when, CQL returns rowkey value as key and there is
 also column present with name as key.

 Sounds like a bug?

 -Vivek


 On Fri, Mar 15, 2013 at 5:17 PM, Kuldeep Mishra 
 kuld.cs.mis...@gmail.com wrote:

 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.com
  wrote:

 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: cql query not giving any result.

2013-03-18 Thread Sylvain Lebresne
 If this is the case, Why can't we restrict key as a keyword and not to
 be used as a column name?


This is only a problem when upgrading from thrift to CQL. Forbidding key
as a column name in thrift would be weird to say the least.
What could be done is that CQL could, when it picks the default name it
uses, pick one that is not used already. That's definitively possible
and please do open a JIRA ticket for that.

But at the end of the day, if you are going to use CQL, I highly suggest
picking meaningful names for your CQL columns, so you will want
to rename the default name that CQL picks for the row key initially.

--
Sylvain



 -Vivek


 On Mon, Mar 18, 2013 at 2:37 PM, Sylvain Lebresne sylv...@datastax.comwrote:

 CQL can't work correctly if 2 (CQL) columns have the same name. Now, to
 allow upgrade from thrift, CQL does use some default names like key for
 the Row key when there isn't anything else.

 Honestly I think the easiest workaround here is probably to disambiguate
 things manually. Typically, you could update the column family definition
 to set the key_alias (in CfDef) to some name that make sense for you. This
 will end up being the name of the Row key for CQL. You may also try issue a
 RENAME from CQL to rename the row key, which should work. Typically
 something like ALTER KunderaExamples RENAME key TO rowKey.

 --
 Sylvain



 On Sat, Mar 16, 2013 at 4:39 AM, Vivek Mishra mishra.v...@gmail.comwrote:

 Any suggestions?
 -Vivek

 On Fri, Mar 15, 2013 at 5:20 PM, Vivek Mishra mishra.v...@gmail.comwrote:

 Ok. So it's a case  when, CQL returns rowkey value as key and there
 is also column present with name as key.

 Sounds like a bug?

 -Vivek


 On Fri, Mar 15, 2013 at 5:17 PM, Kuldeep Mishra 
 kuld.cs.mis...@gmail.com wrote:

 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.com wrote:

 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: cql query not giving any result.

2013-03-15 Thread Kuldeep Mishra
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.

2013-03-15 Thread Jason Wee
Here is a list of keywords and whether or not the words are reserved. A
reserved keyword cannot be used as an identifier unless you enclose the
word in double quotation marks. Non-reserved keywords have a specific
meaning in certain context but can be used as an identifier outside this
context.

http://www.datastax.com/docs/1.2/cql_cli/cql_lexicon#cql-keywords


On Fri, Mar 15, 2013 at 6:43 PM, Kuldeep Mishra kuld.cs.mis...@gmail.comwrote:

 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.

2013-03-15 Thread Sylvain Lebresne
On Fri, Mar 15, 2013 at 11:43 AM, Kuldeep Mishra
kuld.cs.mis...@gmail.comwrote:

 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.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.

2013-03-15 Thread Kuldeep Mishra
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: cql query not giving any result.

2013-03-15 Thread Vivek Mishra
Ok. So it's a case  when, CQL returns rowkey value as key and there is
also column present with name as key.

Sounds like a bug?

-Vivek

On Fri, Mar 15, 2013 at 5:17 PM, Kuldeep Mishra kuld.cs.mis...@gmail.comwrote:

 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: cql query not giving any result.

2013-03-15 Thread Vivek Mishra
Any suggestions?
-Vivek

On Fri, Mar 15, 2013 at 5:20 PM, Vivek Mishra mishra.v...@gmail.com wrote:

 Ok. So it's a case  when, CQL returns rowkey value as key and there is
 also column present with name as key.

 Sounds like a bug?

 -Vivek


 On Fri, Mar 15, 2013 at 5:17 PM, Kuldeep Mishra 
 kuld.cs.mis...@gmail.comwrote:

 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