incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <sylv...@datastax.com>
Subject Re: cql query not giving any result.
Date Mon, 18 Mar 2013 09:07:29 GMT
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.vivs@gmail.com> wrote:

> Any suggestions?
> -Vivek
>
> On Fri, Mar 15, 2013 at 5:20 PM, Vivek Mishra <mishra.vivs@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.mishra@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 <sylvain@datastax.com>wrote:
>>>
>>>> On Fri, Mar 15, 2013 at 11:43 AM, Kuldeep Mishra <
>>>> kuld.cs.mishra@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.mishra@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
>>>
>>
>>
>

Mime
View raw message