incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vivek Mishra <mishra.v...@gmail.com>
Subject Re: Bulk Loader in cassandra : String as row keys in cassandra
Date Fri, 11 Oct 2013 11:17:22 GMT
Change key_validation_class to UTF8Type and

usersWriter.newRow(ByteBufferUtil.bytes(String.valueOf(lineNumber)));



On Fri, Oct 11, 2013 at 4:42 PM, ashish sanadhya <sanadhyaashu@gmail.com>wrote:

> Here i mean that key_validation_class=AsciiType or key_validation_class=UTF8Type
> but I am unable to create an sstable for this column family
>
> create column family Users1
>       with key_validation_class=UTF8Type
>
>        and comparator=AsciiType
>       AND column_metadata = [
>       {column_name: timestamp1, validation_class: AsciiType}
>       {column_name: symbol, validation_class: AsciiType}
>       {column_name: Bid_Price, validation_class:AsciiType}
>       {column_name: Ask_Price, validation_class:AsciiType}
>       ];
>
> how do i get from this usersWriter.newRow(String.
> valueOf(lineNumber));  ?
> thanks.
>
>
>
> On Fri, Oct 11, 2013 at 4:30 PM, Vivek Mishra <mishra.vivs@gmail.com>wrote:
>
>> I am not able to get your meaning for "*string as row keys" ? *
>> *
>> *
>> Row key values will be of type "key_validation_class"  only
>> *
>> *
>>
>> On Fri, Oct 11, 2013 at 4:25 PM, ashish sanadhya <sanadhyaashu@gmail.com>wrote:
>>
>>> Hi vivek key_validation_class=UTF8Type will do ,but i certainly want
>>> *string as row keys, *so will it work ?? *
>>> *
>>>
>>>
>>> On Fri, Oct 11, 2013 at 4:17 PM, Vivek Mishra <mishra.vivs@gmail.com>wrote:
>>>
>>>> Also, please use ByteBufferUtils for byte conversions.
>>>>
>>>>
>>>> On Fri, Oct 11, 2013 at 4:17 PM, Vivek Mishra <mishra.vivs@gmail.com>wrote:
>>>>
>>>>> but i have changed my **key_validation_class=AsciiType** in order to
>>>>> make **string as row keys**
>>>>>
>>>>> why not key_validation_class=UTF8Type ?
>>>>>
>>>>> -Vivek
>>>>>
>>>>>
>>>>> On Fri, Oct 11, 2013 at 3:55 PM, ashish sanadhya <
>>>>> sanadhyaashu@gmail.com> wrote:
>>>>>
>>>>>> I have done with bulk loader with
>>>>>> key_validation_class=LexicalUUIDType for new row with the help of
this
>>>>>> [code][1] but i have changed my **key_validation_class=AsciiType**
in order
>>>>>> to make **string as row keys**
>>>>>>
>>>>>>       create column family Users1
>>>>>>       with key_validation_class=AsciiType
>>>>>>        and comparator=AsciiType
>>>>>>       AND column_metadata = [
>>>>>>       {column_name: timestamp1, validation_class: AsciiType}
>>>>>>       {column_name: symbol, validation_class: AsciiType}
>>>>>>       {column_name: Bid_Price, validation_class:AsciiType}
>>>>>>       {column_name: Ask_Price, validation_class:AsciiType}
>>>>>>       ];
>>>>>>
>>>>>>
>>>>>> i have tried all possible changes to code in order to make row keys
>>>>>> as string type but getting an error or even without **usersWriter.newRow**
>>>>>> not able to write into sstable
>>>>>>
>>>>>>
>>>>>>       while ((line = reader.readLine()) != null)
>>>>>>         {
>>>>>>              if (entry.parse(line, lineNumber))
>>>>>>             {
>>>>>>                 //usersWriter.newRow(uuid);
>>>>>>                 usersWriter.newRow(String.valueOf(lineNumber));
>>>>>>                 usersWriter.addColumn(bytes("symbol"),
>>>>>> bytes(entry.symbol), timestamp);
>>>>>>                 usersWriter.addColumn(bytes("timestamp1"),
>>>>>> bytes(entry.timestamp1), timestamp);
>>>>>>                 usersWriter.addColumn(bytes("Bid_Price"),
>>>>>> bytes(entry.Bid_Price), timestamp);
>>>>>>                 usersWriter.addColumn(bytes("Ask_Price"),
>>>>>> bytes(entry.Ask_Price), timestamp);
>>>>>>             }
>>>>>>             lineNumber++;
>>>>>>         }
>>>>>>
>>>>>>   getting an error as expected it is only taking **ByteBuffer**
>>>>>>
>>>>>>      usersWriter.newRow(String.valueOf(lineNumber));
>>>>>>                            ^
>>>>>>      required: ByteBuffer
>>>>>>      found: String
>>>>>>      reason: actual argument String cannot be converted to ByteBuffer
>>>>>> by method invocation  conversion
>>>>>>
>>>>>> Any help to make string as row keys in sstable for the above column
>>>>>> family definition.thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   [1]:
>>>>>> http://www.datastax.com/wp-content/uploads/2011/08/DataImportExample.java
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Mime
View raw message