Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CE20E10B29 for ; Fri, 11 Oct 2013 10:48:06 +0000 (UTC) Received: (qmail 89671 invoked by uid 500); 11 Oct 2013 10:48:03 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 89653 invoked by uid 500); 11 Oct 2013 10:48:02 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 89645 invoked by uid 99); 11 Oct 2013 10:48:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Oct 2013 10:48:02 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mishra.vivs@gmail.com designates 209.85.215.181 as permitted sender) Received: from [209.85.215.181] (HELO mail-ea0-f181.google.com) (209.85.215.181) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Oct 2013 10:47:57 +0000 Received: by mail-ea0-f181.google.com with SMTP id d10so1804716eaj.12 for ; Fri, 11 Oct 2013 03:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Btv/hFjKAoU1cxlJTCiuIQ3/iVg4+yHAaso6l/PJcb8=; b=Ujydn0DyVFy5mMKf1jUNE8Pl+ZLtk9aBqbOm0fQD0K9Saepny3nIzsbx+p4VGbxAIy LajMX7henmtj3c4qTP5wDh9uz8pOi+E1jc2Me68usfqq1O+7aYKE+eL1HVHP2GavRFsY IrLFg4xDkxlNTDUFnObXn0lqrIiyhaSi3rX3t0vWnaP6YBGNfpB8/iTsZoxb+B8GL8wy BnoWreuIiulnMpIobX9JXbZLWyuKj58JmvyEXfSpURv+oC/mCqIZS7FB7xj9VnvutoXC 1Z9snN2qPCEM1c3RyjvUnK1qlO0holXfllVyo1TySCkXneTEUfEM5j3zW6GyuAfxGmBr vtEQ== MIME-Version: 1.0 X-Received: by 10.14.7.2 with SMTP id 2mr318500eeo.90.1381488456688; Fri, 11 Oct 2013 03:47:36 -0700 (PDT) Received: by 10.223.180.68 with HTTP; Fri, 11 Oct 2013 03:47:36 -0700 (PDT) In-Reply-To: References: Date: Fri, 11 Oct 2013 16:17:36 +0530 Message-ID: Subject: Re: Bulk Loader in cassandra : String as row keys in cassandra From: Vivek Mishra To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=001a11c1af44b8ebd304e874d88f X-Virus-Checked: Checked by ClamAV on apache.org --001a11c1af44b8ebd304e874d88f Content-Type: text/plain; charset=ISO-8859-1 Also, please use ByteBufferUtils for byte conversions. On Fri, Oct 11, 2013 at 4:17 PM, Vivek Mishra 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 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 >> > > --001a11c1af44b8ebd304e874d88f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
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=3DAsciiType** in order to make **string as row keys**

why not=A0key_validation_class=3DUTF8Type ?

-Vi= vek


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=3DL= exicalUUIDType for new row with the help of this [code][1] but i have chang= ed my **key_validation_class=3DAsciiType** in order to make **string as row= keys**
=A0=A0=A0=A0=A0
=A0=A0=A0=A0=A0 create column family Users1
=A0=A0= =A0=A0=A0 with key_validation_class=3DAsciiType
=A0=A0=A0=A0=A0=A0 and c= omparator=3DAsciiType
=A0=A0=A0=A0=A0 AND column_metadata =3D [
=A0= =A0=A0=A0=A0 {column_name: timestamp1, validation_class: AsciiType}
=A0=A0=A0=A0=A0 {column_name: symbol, validation_class: AsciiType}
=A0= =A0=A0=A0=A0 {column_name: Bid_Price, validation_class:AsciiType}
=A0=A0= =A0=A0=A0 {column_name: Ask_Price, validation_class:AsciiType}
=A0=A0=A0= =A0=A0 ];

=A0
i have tried all possible changes to code in order = to make row keys as string type but getting an error or even without **user= sWriter.newRow** not able to write into sstable

=A0
=A0=A0=A0=A0=A0 while ((line =3D reader.readLine()) !=3D null)=A0=A0=A0=A0=A0=A0=A0 {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (entry= .parse(line, lineNumber))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 {=A0=A0
= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //usersWriter.newRow(uuid);=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 usersWriter.newRow(String.v= alueOf(lineNumber));
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 usersWriter.addColumn(bytes(&= quot;symbol"), bytes(entry.symbol), timestamp);
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 usersWriter.addColumn(bytes("timestamp1&qu= ot;), bytes(entry.timestamp1), timestamp);
=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 usersWriter.addColumn(bytes("Bid_Price"), byte= s(entry.Bid_Price), timestamp);
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 usersWriter.addColumn(bytes(&= quot;Ask_Price"), bytes(entry.Ask_Price), timestamp);
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 }
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 lineNumber++;<= br>=A0=A0=A0=A0=A0=A0=A0 }

=A0 getting an error as expected it is on= ly taking **ByteBuffer**
=A0=A0=A0=A0
=A0=A0=A0=A0 usersWriter.newRow(String.valueOf(lineNumber)= );
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 ^
=A0=A0=A0=A0 required: ByteBuffer
=A0=A0=A0=A0 found: Str= ing
=A0=A0=A0=A0 reason: actual argument String cannot be converted to B= yteBuffer by method invocation=A0 conversion

Any help to make string as row keys in sstable for the above column fam= ily definition.thanks.






=A0 [1]: http://www.datastax.com/wp-content/uploads/2011/08/DataImportE= xample.java


--001a11c1af44b8ebd304e874d88f--