Re: Assume Keys in cqlsh?

2012-08-18 Thread paul cannon
"assume" isn't in CQL, that's right--however, it IS in cqlsh.  You're just
using it wrong.  Try:

ASSUME  KEY values are text;

Remember, in CQL, row keys are just another column, so you need to treat
"KEY" (if that's the name of your key column) as a normal column.  "HELP
ASSUME" in cqlsh might help you out more (or it might not).

p

On Sat, Aug 11, 2012 at 2:59 PM, Tyler Hobbs  wrote:

> As far as I know, "assume" isn't a CQL feature, it's only part of
> cassandra-cli.
>
>
> On Tue, Aug 7, 2012 at 10:16 PM, Jason Hill wrote:
>
>> Hello,
>>
>> I'm using:
>>
>> [cqlsh 2.0.0 | Cassandra 1.0.10 | CQL spec 2.0.0 | Thrift protocol
>> 19.20.0]
>>
>> I have a column family with a key that is a blob so I query it like this:
>>
>> SELECT FIRST 10 1..1344385804 FROM  WHERE KEY =
>> '436170616369747943616c63756c61746f727c33';
>>
>> Is there any way to avoid the hex I'm using for the key?
>>
>> I tried the following
>>
>> ASSUME  KEYS ARE text;
>>
>> but it gave this error:
>>
>> Improper assume command.
>>
>>
>> I'm thinking I've missed something here and hope a kind soul would
>> point me to a solution.
>>
>> Cheers,
>> Jason
>>
>
>
>
> --
> Tyler Hobbs
> DataStax 
>
>


Re: CQL connections

2012-08-18 Thread paul cannon
People are aware of the need, but I don't think it's on any roadmaps yet,
and there are other "necessary features" that have been getting more
attention so far. I hope that I or someone else can get to it fairly soon,
but I don't have any guarantees to give. In the meantime, patches are
welcome!

p

On Fri, Aug 10, 2012 at 3:14 PM, Data Craftsman 木匠 <
database.crafts...@gmail.com> wrote:

> I want to know it too.
>
> http://www.datastax.com/support-forums/topic/when-will-pycassa-support-cql
>
> Connection pool and load balance is a necessary feature for multi-user
> production application.
>
> Thanks,
> Charlie | DBA
>
> On Fri, Aug 10, 2012 at 6:47 AM, David McNelis  wrote:
> > In using CQL (the python library, at least), I didn't see a way to pass
> in
> > multiple nodes as hosts.  With other libraries (like Hector and Pycassa)
> I
> > can set multiple hosts and my app will work with anyone on that list.  Is
> > there something similar going on in the background with CQL?
> >
> > If not, then is anyone aware of plans to do so?
>


Re: cqlsh commands

2012-06-21 Thread paul cannon
What do you mean when you say you can't display the related documentations
using the help command?  What does cqlsh do instead?  I don't know about
any bugs in that area.

p

On Wed, Jun 20, 2012 at 6:47 AM, Thierry Templier <
thierry.templ...@restlet.com> wrote:

> Hello,
>
> I'm using cqlsh tool to create column families and it works fine. However
> I don't know how to use the following commands:
>
> Documented commands (type help ):
> ==**==
> ASSUME  CAPTURE  DESC  DESCRIBE  EXIT  HELP  SELECT  SHOW  SOURCE  USE
>
> Moreover I can't display the related documentations using the help command.
>
> Thanks very much for your help.
> Thierry
>


Re: Number format in cqlsh

2012-06-12 Thread paul cannon
No, but a way could be added pretty easily. File a ticket on Jira?

p

On Tuesday, June 12, 2012, Leonid Ilyevsky wrote:

> Is there a way to control the floating numbers format in the cqlsh output?
> I need more digits than it gives by default (in my tests, I see only one
> digit after the point).
>
> This email, along with any attachments, is confidential and may be legally
> privileged or otherwise protected from disclosure. Any unauthorized
> dissemination, copying or use of the contents of this email is strictly
> prohibited and may be in violation of law. If you are not the intended
> recipient, any disclosure, copying, forwarding or distribution of this
> email is strictly prohibited and this email and any attachments should be
> deleted immediately.  This email and any attachments do not constitute an
> offer to sell or a solicitation of an offer to purchase any interest in any
> investment vehicle sponsored by Moon Capital Management LP ("Moon
> Capital"). Moon Capital does not provide legal, accounting or tax advice.
> Any statement regarding legal, accounting or tax matters was not intended
> or written to be relied upon by any person as advice. Moon Capital does not
> waive confidentiality or privilege as a result of this email.
>


Re: Correct way to set strategy options in cqlsh?

2012-05-23 Thread paul cannon
I agree, this is a bug.  I opened
https://issues.apache.org/jira/browse/CASSANDRA-4278 to track it.

The workaround for now is to use the CLI or the thrift interface to create
your keyspace.

p

On Wed, May 23, 2012 at 8:29 AM, Damick, Jeffrey  wrote:

>  Since this is the EC2MultiRegionSnitch, how do you suggest I change
> name?  It needs to match the datacenter name that is bound to aws region
> names, so it seems like this is a bug to me..
>
>
>
>
>
> On 5/23/12 2:33 AM, "Romain HARDOUIN"  wrote:
>
>
> You *must* remove the hyphen.
> According to the csql 2.0 documentation, here is the correct syntax to
> create keyspace:
>
>  ::= "CREATE" "KEYSPACE" 
> "WITH"  "=" 
> ( "AND"  "="  )*
>;
>  ::= 
>   |  ":" 
>   |  ":" 
>   ;
>  ::= 
>  | 
>  | 
>  ;
>
> The string "strategy_options:us-west=1;" matches the following syntax:
>
>  ":"  = 
>
> Thus, "us-west" is an *identifier*, and again according to the
> documentation:
> An  is a letter followed by any sequence of letters, digits,
> or the underscore (_).
>
>


Re: C 1.1 & CQL 2.0 or 3.0?

2012-05-16 Thread paul cannon
Ah, I know why. CQL 3 downcases all your identifiers by default. Wouldn't
have been a problem if you had created it with CQL 3, cause then the name
would be "mykeyspace" and it would match what you're asking for.  But since
your keyspace was created with some capital letters in its name, you just
need to quote the name in CQL 3:

cqlsh> use "Mykeyspace";

p

On Wed, May 16, 2012 at 3:33 AM, Cyril Auburtin wrote:

> well yes, since I can retrieve the keyspace and all CF (not SCF, it's
> normal in cql?) with cqlsh (v2),
>
> tic@mPC:~$ cqlsh 1xx.xx.xxx.xx 9165
> Connected to Test Cluster at 1xx.xx.xxx.xx:9165.
> [cqlsh 2.2.0 | Cassandra 1.1.0 | CQL spec 2.0.0 | Thrift protocol 19.30.0]
> Use HELP for help.
> cqlsh> use Mykeyspace;
> cqlsh:Mykeyspace> select * from Application;
> cqlsh:Mykeyspace> exit;
> tic@myPC:~$ cqlsh -3 1xx.xx.xxx.xx 9165
> Connected to Test Cluster at 1xx.xx.xxx.xx:9165.
> [cqlsh 2.2.0 | Cassandra 1.1.0 | CQL spec 3.0.0 | Thrift protocol 19.30.0]
> Use HELP for help.
> cqlsh> use Mykeyspace;
> Bad Request: Keyspace 'mykeyspace' does not exist
> cqlsh>
>
> 2012/5/14 paul cannon 
>
>> This should not be the case- a keyspace is a keyspace, however created.
>>  I haven't been able to reproduce this; are you sure that the cassandra-cli
>> and cqlsh are connecting to the same instance?  Maybe you should create a
>> Jira ticket.
>>
>> p
>>
>>
>> On Fri, May 11, 2012 at 2:05 PM, cyril auburtin > > wrote:
>>
>>> yes it seems so
>>>
>>> as long as I create (more than just create keyspace mykeyspace) it with
>>> cassandra cli, by creating CF, then I can't connect to it with cqlsh -3
>>>
>>> I'll need to translate it in cql3 then
>>>
>>> 2012/5/11 Jason Wellonen 
>>>
>>>> **
>>>> I think you need to create the keyspace under the context of a v3
>>>> connection.  Maybe someone else can confirm?
>>>>
>>>>
>>>>  --
>>>> *From:* cyril auburtin [mailto:cyril.aubur...@gmail.com]
>>>> *Sent:* Friday, May 11, 2012 11:46 AM
>>>> *To:* user@cassandra.apache.org
>>>> *Subject:* Re: C 1.1 & CQL 2.0 or 3.0?
>>>>
>>>> thx just: can't connect to keyspace with cql 3.0
>>>>
>>>>  tic@my:~$ cqlsh
>>>> Connected to My Cluster at 127.0.0.1:4201.
>>>> [cqlsh 2.2.0 | Cassandra 1.1.0 | CQL spec 2.0.0 | Thrift protocol
>>>> 19.30.0]
>>>> Use HELP for help.
>>>> cqlsh> use mykeyspace;
>>>> cqlsh:mykeyspace> exit;
>>>> tic@my:~$ cqlsh -3
>>>> Connected to My Cluster at 127.0.0.1:4201.
>>>> [cqlsh 2.2.0 | Cassandra 1.1.0 | CQL spec 3.0.0 | Thrift protocol
>>>> 19.30.0]
>>>> Use HELP for help.
>>>> cqlsh> use mykeyspace;
>>>> Bad Request: Keyspace 'mykeyspace' does not exist
>>>> cqlsh>
>>>>
>>>> ??
>>>> 2012/5/11 Jason Wellonen 
>>>>
>>>>> **
>>>>> Version 2 is the default for your connection.
>>>>>
>>>>> Are you using cqlsh?  If so, use the "-3" parameter for version 3...
>>>>>
>>>>>
>>>>>  --
>>>>> *From:* cyril auburtin [mailto:cyril.aubur...@gmail.com]
>>>>> *Sent:* Friday, May 11, 2012 10:51 AM
>>>>> *To:* user@cassandra.apache.org
>>>>> *Subject:* C 1.1 & CQL 2.0 or 3.0?
>>>>>
>>>>>  I have C* 1.1 but it seems to only come with cql 2.0
>>>>>  INFO 19:35:21,579 Cassandra version: 1.1.0
>>>>>  INFO 19:35:21,581 Thrift API version: 19.30.0
>>>>>  INFO 19:35:21,583 CQL supported versions: 2.0.0,3.0.0-beta1 (default:
>>>>> 2.0.0)
>>>>>
>>>>> the problem is I would like to create such CF :
>>>>>
>>>>> CREATE COLUMNFAMILY TaggedPosts (
>>>>>  ... tag text,
>>>>>  ... post uuid,
>>>>>  ... blog_rowentries_rowkey text,
>>>>>  ... PRIMARY KEY (tag, post)
>>>>>  ... ) WITH COMPACT STORAGE;
>>>>>
>>>>> and for me, (cql 2.0) it returns this error
>>>>>
>>>>> Bad Request: line 6:0 mismatched input ')' expecting EOF
>>>>>
>>>>> Is it due to the cql version? how to upgrade to 3.0, since I already
>>>>> have the lastest cassandra release?
>>>>>
>>>>
>>>>
>>>
>>
>


Re: CQL 3.0 Features

2012-05-16 Thread paul cannon
Sylvain has a draft on
https://issues.apache.org/jira/browse/CASSANDRA-3779, and that should
be an official cassandra project doc "real soon now".  If
you're asking about Datastax's reference docs for CQL 3, they will probably
be released once Datastax Enterprise or Datastax Community is released with
Cassandra 1.1.

p

On Wed, May 16, 2012 at 10:57 AM, Roland Mechler wrote:

> http://www.datastax.com/dev/blog/whats-new-in-cql-3-0
>
> It's my understanding that that the actual reference documentation for 3.0
> should be ready soon. Anyone know when?
>
> -Roland
>
>
> On Wed, May 16, 2012 at 12:04 AM, Tamil selvan R.S 
> wrote:
>
>> Hi,
>>  Is there a tutorial or reference on CQL 3.0 Features. In cassandra
>> download site the reference is still pointing to 2.0
>>  Specifically Composite Types
>> Regards,
>> Tamil.s
>>
>
>


Re: C 1.1 & CQL 2.0 or 3.0?

2012-05-14 Thread paul cannon
This should not be the case- a keyspace is a keyspace, however created.  I
haven't been able to reproduce this; are you sure that the cassandra-cli
and cqlsh are connecting to the same instance?  Maybe you should create a
Jira ticket.

p

On Fri, May 11, 2012 at 2:05 PM, cyril auburtin wrote:

> yes it seems so
>
> as long as I create (more than just create keyspace mykeyspace) it with
> cassandra cli, by creating CF, then I can't connect to it with cqlsh -3
>
> I'll need to translate it in cql3 then
>
> 2012/5/11 Jason Wellonen 
>
>> **
>> I think you need to create the keyspace under the context of a v3
>> connection.  Maybe someone else can confirm?
>>
>>
>>  --
>> *From:* cyril auburtin [mailto:cyril.aubur...@gmail.com]
>> *Sent:* Friday, May 11, 2012 11:46 AM
>> *To:* user@cassandra.apache.org
>> *Subject:* Re: C 1.1 & CQL 2.0 or 3.0?
>>
>> thx just: can't connect to keyspace with cql 3.0
>>
>>  tic@my:~$ cqlsh
>> Connected to My Cluster at 127.0.0.1:4201.
>> [cqlsh 2.2.0 | Cassandra 1.1.0 | CQL spec 2.0.0 | Thrift protocol 19.30.0]
>> Use HELP for help.
>> cqlsh> use mykeyspace;
>> cqlsh:mykeyspace> exit;
>> tic@my:~$ cqlsh -3
>> Connected to My Cluster at 127.0.0.1:4201.
>> [cqlsh 2.2.0 | Cassandra 1.1.0 | CQL spec 3.0.0 | Thrift protocol 19.30.0]
>> Use HELP for help.
>> cqlsh> use mykeyspace;
>> Bad Request: Keyspace 'mykeyspace' does not exist
>> cqlsh>
>>
>> ??
>> 2012/5/11 Jason Wellonen 
>>
>>> **
>>> Version 2 is the default for your connection.
>>>
>>> Are you using cqlsh?  If so, use the "-3" parameter for version 3...
>>>
>>>
>>>  --
>>> *From:* cyril auburtin [mailto:cyril.aubur...@gmail.com]
>>> *Sent:* Friday, May 11, 2012 10:51 AM
>>> *To:* user@cassandra.apache.org
>>> *Subject:* C 1.1 & CQL 2.0 or 3.0?
>>>
>>>  I have C* 1.1 but it seems to only come with cql 2.0
>>>  INFO 19:35:21,579 Cassandra version: 1.1.0
>>>  INFO 19:35:21,581 Thrift API version: 19.30.0
>>>  INFO 19:35:21,583 CQL supported versions: 2.0.0,3.0.0-beta1 (default:
>>> 2.0.0)
>>>
>>> the problem is I would like to create such CF :
>>>
>>> CREATE COLUMNFAMILY TaggedPosts (
>>>  ... tag text,
>>>  ... post uuid,
>>>  ... blog_rowentries_rowkey text,
>>>  ... PRIMARY KEY (tag, post)
>>>  ... ) WITH COMPACT STORAGE;
>>>
>>> and for me, (cql 2.0) it returns this error
>>>
>>> Bad Request: line 6:0 mismatched input ')' expecting EOF
>>>
>>> Is it due to the cql version? how to upgrade to 3.0, since I already
>>> have the lastest cassandra release?
>>>
>>
>>
>


Re: odd CQL behavior

2012-05-03 Thread paul cannon
Very sadly, no.  It's not (yet?) meant to be a particularly good
interactive language, so the only "function" in cql is COUNT(), and that's
really just special syntax. It seems, though, that you might actually be
better off with a key of type 'ascii' or 'text', if that's how you expect
to work with it.  Would it be an option to adjust that table?

The ASSUME-changes-outgoing-cql ticket (CASSANDRA-3799) would also help, so
maybe keep an eye on that.

p

On Thu, May 3, 2012 at 1:22 PM, Eric Czech  wrote:

> Gotcha, I probably should have guessed that much.  Does CQL have any
> functions to convert ascii to hex so that I don't have to do that
> conversion elsewhere (I don't see one in the docs)?
>
>
> On Thu, May 3, 2012 at 2:09 PM, paul cannon  wrote:
>
>> On Thu, May 3, 2012 at 12:46 PM, Eric Czech wrote:
>>
>>> I can't believe I have to ask this but I have a CF with about 10 rows
>>> and the keys are literally 1 through 9.
>>>
>>> Why does this not work if I want the row where the key is ascii('5')?
>>>
>>>  cqlsh:Keyspace1>  select first 1 * from CF where key = '5';
>>>  KEY
>>> -
>>>   05
>>>
>>
>> This depends on the configured type (key_validation) of the key. From
>> what you've posted, it looks like CQL is treating it as 'blob', not 'ascii'.
>>
>> * I saw the Jira about the sort of phantom row with no values so I know
>>> why that's there
>>>
>>> Listing the keys shows something like this:
>>>
>>> cqlsh:Keyspace1> select key from CF ;
>>>  key
>>> --
>>>33
>>>36
>>>35
>>> 38
>>>32
>>>31
>>>39
>>>34
>>>37
>>>
>>> If I prepend a '3' to my key queries it works but I can't possibly see
>>> why I would have to do that.
>>>
>>> cqlsh:Keyspace1>   select first 1 * from CF  where key = '35';
>>> ( Returns the right rows for key '5')
>>>
>>
>> Cause 35 is hex for ascii(5), as you pointed out.
>>
>> Changing the validator appears to make no material difference beyond the
>>> key listing:
>>>
>>
>> This is because ASSUME is only a cqlsh feature, and only affects how data
>> is deserialized.  There is a ticket out for cqlsh also to mangle your
>> outgoing CQL statements to match ASSUMEd types too, but that's not there
>> yet.
>>
>> HTH,
>> p
>>
>
>


Re: odd CQL behavior

2012-05-03 Thread paul cannon
On Thu, May 3, 2012 at 12:46 PM, Eric Czech  wrote:

> I can't believe I have to ask this but I have a CF with about 10 rows and
> the keys are literally 1 through 9.
>
> Why does this not work if I want the row where the key is ascii('5')?
>
>  cqlsh:Keyspace1>  select first 1 * from CF where key = '5';
>  KEY
> -
>   05
>

This depends on the configured type (key_validation) of the key. From what
you've posted, it looks like CQL is treating it as 'blob', not 'ascii'.

* I saw the Jira about the sort of phantom row with no values so I know why
> that's there
>
> Listing the keys shows something like this:
>
> cqlsh:Keyspace1> select key from CF ;
>  key
> --
>33
>36
>35
> 38
>32
>31
>39
>34
>37
>
> If I prepend a '3' to my key queries it works but I can't possibly see why
> I would have to do that.
>
> cqlsh:Keyspace1>   select first 1 * from CF  where key = '35';
> ( Returns the right rows for key '5')
>

Cause 35 is hex for ascii(5), as you pointed out.

Changing the validator appears to make no material difference beyond the
> key listing:
>

This is because ASSUME is only a cqlsh feature, and only affects how data
is deserialized.  There is a ticket out for cqlsh also to mangle your
outgoing CQL statements to match ASSUMEd types too, but that's not there
yet.

HTH,
p


Re: execute_prepared_cql_query and variable range filter parameter

2012-04-30 Thread paul cannon
No, there isn't right now.  But note that there shouldn't be a whole lot of
performance difference between

select * from Town where key in ('Paris', 'London');

and

select * from Town where key = 'Paris';
select * from Town where key = 'London';

..other than round-trip times.  Or, I guess, if you're really worried about
preparation time, and your lists are limited to some small maximum length
X, you could prepare X different queries:

select * from Town where key in (?);
select * from Town where key in (?, ?);
select * from Town where key in (?, ?, ?);
etc.

and then use the appropriate one each time, but I doubt that would be a
better solution overall.

p


On Mon, Apr 30, 2012 at 4:47 PM, Pierre Chalamet wrote:

> If I prepare “select * from Town where key in (?)”
>
> I will be able to bind ? to 'Paris' for example [è select * from Town
> where key in ('Paris')].
>
> ** **
>
> If I want to query for 'Paris' and 'London', the query should be restated
> to “select * from Town where key in (?, ?)” [è select * from Town where
> key in ('Paris', 'London')].
>
> In that case, I must prepare the statement again, losing the benefit of
> prepare.
>
> ** **
>
> Maybe there is another way to avoid preparing again ?
>
> ** **
>
> Thanks,
>
> - Pierre
>
> ** **
>
> *From:* paul cannon [mailto:p...@datastax.com]
> *Sent:* lundi 30 avril 2012 23:36
> *To:* user@cassandra.apache.org
> *Subject:* Re: execute_prepared_cql_query and variable range filter
> parameter
>
> ** **
>
> Hi Pierre-
>
> ** **
>
> Yes, each ? can only represent one value at a time (although it can take
> on a different value for each actual execution of the prepared query). This
> is certainly normal for SQL binding libraries. Not sure why you feel that
> defeats statement preparation.
>
> ** **
>
> p
>
> ** **
>
> On Mon, Apr 30, 2012 at 3:45 PM, Pierre Chalamet 
> wrote:
>
> Hi all,
>
>  
>
> Is there a support in Cassandra 1.1 for variable range filter parameter
> (sorry I can’t find a right name for that):
>
> select * from TestCF where key in (?)
>
>  
>
> using execute_prepared_cql_query ?
>
>  
>
> In the query above, it seems I can only bind one value to ‘?’.
>
> I mean, if several values are required for ‘?’ then I have to rewrite the
> query using several jokers.
>
>  
>
> My problem is that this defeats statement preparation (using
> prepare_cql_query).
>
>  
>
> Maybe there is a way to bind an array of values to a single command joker ?
> 
>
>  
>
> Thanks !
>
> - Pierre
>
>  
>
> ** **
>


Re: Cql 3 wide rows filter expressions in where clause

2012-04-30 Thread paul cannon
CQL doesn't currently let you filter on columns which aren't part of a
primary key or indexed, so the "and x=2 and z=2" part of your query is not
valid.

p

On Mon, Apr 30, 2012 at 8:54 PM, Jonathan Ellis  wrote:

> That should work.  I don't see anything obviously wrong with your
> query, other than the trivial (ascii values need to be quoted).
> Assuming that's not the problem, please file a ticket if you have a
> failing test case.
>
> On Fri, Apr 20, 2012 at 11:59 PM, Nagaraj J 
> wrote:
> > Hi
> >
> > cql 3 for wide rows is very promising. I was wondering if there is
> support
> > for filtering wide rows by additional filter expressions in where clause
> > (columns other than those which are part of the composite).
> >
> > Ex.
> > suppose i have sparse cf
> >
> > create columnfamily scf( k ascii, o ascii, x ascii, y ascii, z ascii,
> > PRIMARY KEY(k, o));
> >
> > is it possible to have a query
> >
> > select * from scf where k=1 and x=2 and z=2 order by o ASC;
> >
> > I tried this with 1.1-rc and it doesnt work as expected. Also looked at
> > cql_tests.py in https://issues.apache.org/jira/browse/CASSANDRA-2474 there
> > is no mention of this.
> >
> > Am i missing something here ?
> >
> > Thanks in advance
> > Nagaraj
> >
> > --
> > View this message in context:
> http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Cql-3-wide-rows-filter-expressions-in-where-clause-tp7486344p7486344.html
> > Sent from the cassandra-u...@incubator.apache.org mailing list archive
> at Nabble.com.
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com
>


Re: execute_prepared_cql_query and variable range filter parameter

2012-04-30 Thread paul cannon
Hi Pierre-

Yes, each ? can only represent one value at a time (although it can take on
a different value for each actual execution of the prepared query). This is
certainly normal for SQL binding libraries. Not sure why you feel that
defeats statement preparation.

p

On Mon, Apr 30, 2012 at 3:45 PM, Pierre Chalamet wrote:

> Hi all,
>
> ** **
>
> Is there a support in Cassandra 1.1 for variable range filter parameter
> (sorry I can’t find a right name for that):
>
> select * from TestCF where key in (?)
>
> ** **
>
> using execute_prepared_cql_query ?
>
> ** **
>
> In the query above, it seems I can only bind one value to ‘?’.
>
> I mean, if several values are required for ‘?’ then I have to rewrite the
> query using several jokers.
>
> ** **
>
> My problem is that this defeats statement preparation (using
> prepare_cql_query).
>
> ** **
>
> Maybe there is a way to bind an array of values to a single command joker ?
> 
>
> ** **
>
> Thanks !
>
> - Pierre
>
> ** **
>


Re: Doubt regarding CQL

2012-02-22 Thread paul cannon
Rishabh-

It looks like you're not actually using the cqlsh that comes with Cassandra
1.0.7.  Are you using an old version of the Python CQL driver?  Old
versions of the driver had cqlsh bundled with it, instead of with Cassandra.

The 1.0.7 Debian/Ubuntu packages do not include cqlsh, because of some
packaging+distribution difficulties (resolved in 1.1).  One easy way to get
cqlsh as part of a package is to use the free DataStax Community Edition:
see http://www.datastax.com/products/community .  Cqlsh is included in the
"dsc" package.  That package will also bring in thrift and any other
dependencies you need.

p


On Wed, Feb 22, 2012 at 3:00 AM, Rishabh Agrawal <
rishabh.agra...@impetus.co.in> wrote:

> Thanks for the reply
> I installed 0.8.0 drift package. But still problem persists.
>
> -Original Message-
> From: Mateusz Korniak [mailto:mateusz-li...@ant.gliwice.pl]
> Sent: Wednesday, February 22, 2012 1:47 PM
> To: user@cassandra.apache.org
> Subject: Re: Doubt regarding CQL
>
> On Wednesday 22 of February 2012, Rishabh Agrawal wrote:
> > I have installed CQL drivers for python. When I try execute cqlsh I
> > get following error cql-1.0.3$ cqlsh localhost 9160
> > (...)
> >   File
> > "/usr/local/lib/python2.7/dist-packages/cql/cassandra/ttypes.py",
> > line 7, in  from thrift.Thrift import *
> > ImportError: No module named thrift.Thrift
>
> Seems you do not have installed python thrift module.
>
> In my distro (PLD) it is:
> Package:python-thrift-0.5.0-4.i686
> /usr/lib/python2.7/site-packages:  Thrift-0.1-py2.7.egg-info,
> /usr/lib/python2.7/site-packages/thrift:  TSCons.pyc, TSCons.pyo,
> TSerialization.pyc, TSerialization.pyo, Thrift.pyc, Thrift.pyo,
> __init__.pyc, __init__.pyo,
> /usr/lib/python2.7/site-packages/thrift/protocol:  TBinaryProtocol.pyc,
> TBinaryProtocol.pyo, TCompactProtocol.pyc, TCompactProtocol.pyo,
> TProtocol.pyc, TProtocol.pyo, __init__.pyc, __init__.pyo, fastbinary.so
> /usr/lib/python2.7/site-packages/thrift/server:  THttpServer.pyc,
> THttpServer.pyo, TNonblockingServer.pyc, TNonblockingServer.pyo,
> TServer.pyc, TServer.pyo, __init__.pyc, __init__.pyo
> /usr/lib/python2.7/site-packages/thrift/transport:  THttpClient.pyc,
> THttpClient.pyo, TSocket.pyc, TSocket.pyo, TTransport.pyc, TTransport.pyo,
> TTwisted.pyc, TTwisted.pyo, __init__.pyc, __init__.pyo
>
>
> Regards,
>
> --
> Mateusz Korniak
>
> 
>
> Impetus’ Head of Innovation labs, Vineet Tyagi will be presenting on ‘Big
> Data Big Costs?’ at the Strata Conference, CA (Feb 28 - Mar 1)
> http://bit.ly/bSMWd7.
>
> Listen to our webcast ‘Hybrid Approach to Extend Web Apps to Tablets &
> Smartphones’ available at http://bit.ly/yQC1oD.
>
>
> 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.
>


Re: Debian package jna bug workaroung

2011-11-04 Thread paul cannon
The cassandra-cli tool will show you, if you're using at least cassandra
1.0.1, in a "describe" command.  If not, you can make a thrift
describe_keyspace() call some other way, and check the value of the
appropriate CfDef's row_cache_provider string.  If it's
SerializingCacheProvider, it's off-heap.  Note that I think you need to
create the columnfamily while JNA is present, not just have JNA present
when cassandra starts.  Might be wrong on that.

p


On Thu, Nov 3, 2011 at 4:10 PM, Peter Tillotson wrote:

> Cassandra 1.0.1 and only seemed to happen with
> * JAVA_HOME=/usr/lib/jvm/java-6-sun
> and jna.jar copied into /usr/share/cassandra(/lib)
>
> I then saw the detail in the init script and how it was being linked
>
> Is there a way I can verify which provider is being used? I want to make
> sure Off heap is being used in the default config.
>
> On 03/11/11 19:06, paul cannon wrote:
> > I can't reproduce this. What version of the cassandra deb are you using,
> > exactly, and why are you symlinking or copying jna.jar into
> > /usr/share/cassandra?  The initscript should be adding
> > /usr/sahre/java/jna.jar to the classpath, and that should be all you
> need.
> >
> > The failure you see with o.a.c.cache.FreeableMemory is not because the
> > jre can't find the class, it's just that it can't initialize the class
> > (because it needs JNA, and it can't find JNA).
> >
> > p
> >
> > On Wed, Nov 2, 2011 at 4:42 AM, Peter Tillotson  > <mailto:slatem...@yahoo.co.uk>> wrote:
> >
> > see below
> >  * JAVA_HOME=/usr/lib/jvm/java-6-openjdk
> > works
> > --
> > Reading the documentation over at Datastax
> > “The Debian and RPM packages of Cassandra install JNA automatically”
> >
> http://www.datastax.com/dev/blog/whats-new-in-cassandra-1-0-improved-memory-and-disk-space-management
> >
> > And indeed the Debian package depends on jna, and the
> > /etc/init.d/cassandra looks as though in adds
> > /usr/share/java/jna.jar to the classpath, and here is the but.
> >
> > If I copy or symlink jna.jar into:
> >  * /usr/share/cassandra
> >  * /usr/share/cassandra/lib
> > Whenever a column family initialises I get:
> > java.lang.NoClassDefFoundError: Could not initialize class
> > org.apache.cassandra.cache.FreeableMemory
> >
> > This suggests to me that:
> >  1) By default, for me at least, in Debian jna.jar is not on the
> > classpath
> >  2) There is an additional classpath issue
> >  jar -tf apache-cassandra.jar | grep "FreeableMemory" succeeds
> >
> > I'm running on:
> >  * Ubuntu 10.04 x64
> >  * JAVA_HOME=/usr/lib/jvm/java-6-sun
> >
> > Full stack traces:
> > java.lang.NoClassDefFoundError: Could not initialize class
> > com.sun.jna.Native
> > at com.sun.jna.Pointer.(Pointer.java:42)
> > at
> >
> org.apache.cassandra.cache.SerializingCache.serialize(SerializingCache.java:92)
> > at
> >
> org.apache.cassandra.cache.SerializingCache.put(SerializingCache.java:154)
> > at
> >
> org.apache.cassandra.cache.InstrumentingCache.put(InstrumentingCache.java:63)
> > at
> >
> org.apache.cassandra.db.ColumnFamilyStore.cacheRow(ColumnFamilyStore.java:1150)
> > at
> >
> org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1174)
> > at
> >
> org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1131)
> > at org.apache.cassandra.db.Table.getRow(Table.java:378)
> > at
> >
> org.apache.cassandra.db.SliceFromReadCommand.getRow(SliceFromReadCommand.java:61)
> > at
> >
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:797)
> > at
> >
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:1265)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> > at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> > at java.lang.Thread.run(Thread.java:662)
> >  INFO [pool-1-thread-1] 2011-11-02 10:26:46,738 Memtable.java (line
> > 177) CFS(Keyspace='BigSet', ColumnFamily='theKeys') liveRatio is
> > 18.20062753783684 (just-counted was 16.960966424636872).

Re: Debian package jna bug workaroung

2011-11-03 Thread paul cannon
I can't reproduce this. What version of the cassandra deb are you using,
exactly, and why are you symlinking or copying jna.jar into
/usr/share/cassandra?  The initscript should be adding
/usr/sahre/java/jna.jar to the classpath, and that should be all you need.

The failure you see with o.a.c.cache.FreeableMemory is not because the jre
can't find the class, it's just that it can't initialize the class (because
it needs JNA, and it can't find JNA).

p

On Wed, Nov 2, 2011 at 4:42 AM, Peter Tillotson wrote:

> see below
>  * JAVA_HOME=/usr/lib/jvm/java-6-openjdk
> works
> --
> Reading the documentation over at Datastax
> “The Debian and RPM packages of Cassandra install JNA automatically”
>
> http://www.datastax.com/dev/blog/whats-new-in-cassandra-1-0-improved-memory-and-disk-space-management
>
> And indeed the Debian package depends on jna, and the
> /etc/init.d/cassandra looks as though in adds /usr/share/java/jna.jar to
> the classpath, and here is the but.
>
> If I copy or symlink jna.jar into:
>  * /usr/share/cassandra
>  * /usr/share/cassandra/lib
> Whenever a column family initialises I get:
> java.lang.NoClassDefFoundError: Could not initialize class
> org.apache.cassandra.cache.FreeableMemory
>
> This suggests to me that:
>  1) By default, for me at least, in Debian jna.jar is not on the classpath
>  2) There is an additional classpath issue
>  jar -tf apache-cassandra.jar | grep "FreeableMemory" succeeds
>
> I'm running on:
>  * Ubuntu 10.04 x64
>  * JAVA_HOME=/usr/lib/jvm/java-6-sun
>
> Full stack traces:
> java.lang.NoClassDefFoundError: Could not initialize class
> com.sun.jna.Native
> at com.sun.jna.Pointer.(Pointer.java:42)
> at
> org.apache.cassandra.cache.SerializingCache.serialize(SerializingCache.java:92)
> at
> org.apache.cassandra.cache.SerializingCache.put(SerializingCache.java:154)
> at
> org.apache.cassandra.cache.InstrumentingCache.put(InstrumentingCache.java:63)
> at
> org.apache.cassandra.db.ColumnFamilyStore.cacheRow(ColumnFamilyStore.java:1150)
> at
> org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1174)
> at
> org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1131)
> at org.apache.cassandra.db.Table.getRow(Table.java:378)
> at
> org.apache.cassandra.db.SliceFromReadCommand.getRow(SliceFromReadCommand.java:61)
> at
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:797)
> at
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:1265)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
>  INFO [pool-1-thread-1] 2011-11-02 10:26:46,738 Memtable.java (line 177)
> CFS(Keyspace='BigSet', ColumnFamily='theKeys') liveRatio is
> 18.20062753783684 (just-counted was 16.960966424636872).  calculation took
> 408ms for 8169 columns
> ERROR [ReadStage:33] 2011-11-02 10:26:56,599 AbstractCassandraDaemon.java
> (line 133) Fatal exception in thread Thread[ReadStage:33,5,main]
> java.lang.NoClassDefFoundError: Could not initialize class
> org.apache.cassandra.cache.FreeableMemory
> at
> org.apache.cassandra.cache.SerializingCache.serialize(SerializingCache.java:92)
> at
> org.apache.cassandra.cache.SerializingCache.put(SerializingCache.java:154)
> at
> org.apache.cassandra.cache.InstrumentingCache.put(InstrumentingCache.java:63)
> at
> org.apache.cassandra.db.ColumnFamilyStore.cacheRow(ColumnFamilyStore.java:1150)
> at
> org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1174)
> at
> org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1131)
> at org.apache.cassandra.db.Table.getRow(Table.java:378)
> at
> org.apache.cassandra.db.SliceFromReadCommand.getRow(SliceFromReadCommand.java:61)
> at
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:797)
> at
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:1265)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
>