Re: Using composite column names in the CLI

2011-05-17 Thread David Boxenhorn
This is what I'm talking about

https://issues.apache.org/jira/browse/CASSANDRA-2231

The on-disk format is

(short)lengthconstituentend byte = 0(short)lengthconstituentend
byte = 0...

I would like to be able to input these kinds of keys into the CLI, something
like

set cf[key]['constituent1':'constituent2':'constituent3'] = val


On Tue, May 17, 2011 at 2:15 AM, Sameer Farooqui cassandral...@gmail.comwrote:

 Cassandra wouldn't know that the column name is composite of two different
 things. So you could just request the column names and values for a specific
 key like this and then just look at the column names that get returned:

 [default@MyKeyspace] get DemoCF[ascii('key_42')];
 = (column=CA_SanJose, value=50, timestamp=1305236885112000)
 = (column=CA_PaloAlto, value=49, timestamp=1305236885192000)
 = (column=FL_Orlando, value=45, timestamp=130523688528)
 = (column=NY_NYC, value=40, timestamp=1305236885361000)


 And I'm not sure what you mean by inputting composite column names. You
 just input them like any other column name:

 [default@MyKeyspace] set DemoCF['key_42']['CA_SanJose']='51';
 Value inserted.





 On Mon, May 16, 2011 at 2:34 PM, Aaron Morton aa...@thelastpickle.comwrote:

 What do you mean by composite column names?

 Do the data type functions supported by get and set help? Or the assume
 statement?

 Aaron
 On 17/05/2011, at 3:21 AM, David Boxenhorn da...@taotown.com wrote:

  Is there a way to view composite column names in the CLI?
 
  Is there a way to input them (i.e. in the set command)?
 





Re: Using composite column names in the CLI

2011-05-17 Thread Sylvain Lebresne
Provided you're working on a branch that has CASSANDRA-2231 applied (that's
either the cassandra-0.8.1 branch or trunk), this work 'out of the box':

The setup will look like:
[default@unknown] create keyspace test;
[default@unknown] use test;
[default@test] create column family testCF with
comparator='CompositeType(AsciiType, IntegerType(reversed=true),
IntegerType)' and default_validation_class=AsciiType;

Then:
[default@test] set testCF[a]['foo:24:24'] = 'v1';
Value inserted.
[default@test] set testCF[a]['foo:42:24'] = 'v2';
Value inserted.
[default@test] set testCF[a]['foobar:42:24'] = 'v3';
Value inserted.
[default@test] set testCF[a]['boobar:42:24'] = 'v4';
Value inserted.
[default@test] set testCF[a]['boobar:42:42'] = 'v5';
Value inserted.
[default@test] get testCF[a];
= (column=boobar:42:24, value=v4, timestamp=1305621115813000)
= (column=boobar:42:42, value=v5, timestamp=1305621125563000)
= (column=foo:42:24, value=v2, timestamp=1305621096473000)
= (column=foo:24:24, value=v1, timestamp=1305621085548000)
= (column=foobar:42:24, value=v3, timestamp=1305621110813000)
Returned 5 results.

--
Sylvain

On Tue, May 17, 2011 at 9:20 AM, David Boxenhorn da...@taotown.com wrote:
 This is what I'm talking about

 https://issues.apache.org/jira/browse/CASSANDRA-2231

 The on-disk format is

 (short)lengthconstituentend byte = 0(short)lengthconstituentend
 byte = 0...

 I would like to be able to input these kinds of keys into the CLI, something
 like

 set cf[key]['constituent1':'constituent2':'constituent3'] = val


 On Tue, May 17, 2011 at 2:15 AM, Sameer Farooqui cassandral...@gmail.com
 wrote:

 Cassandra wouldn't know that the column name is composite of two different
 things. So you could just request the column names and values for a specific
 key like this and then just look at the column names that get returned:
 [default@MyKeyspace] get DemoCF[ascii('key_42')];
 = (column=CA_SanJose, value=50, timestamp=1305236885112000)
 = (column=CA_PaloAlto, value=49, timestamp=1305236885192000)
 = (column=FL_Orlando, value=45, timestamp=130523688528)
 = (column=NY_NYC, value=40, timestamp=1305236885361000)

 And I'm not sure what you mean by inputting composite column names. You
 just input them like any other column name:
 [default@MyKeyspace] set DemoCF['key_42']['CA_SanJose']='51';
 Value inserted.




 On Mon, May 16, 2011 at 2:34 PM, Aaron Morton aa...@thelastpickle.com
 wrote:

 What do you mean by composite column names?

 Do the data type functions supported by get and set help? Or the assume
 statement?

 Aaron
 On 17/05/2011, at 3:21 AM, David Boxenhorn da...@taotown.com wrote:

  Is there a way to view composite column names in the CLI?
 
  Is there a way to input them (i.e. in the set command)?
 





Re: Using composite column names in the CLI

2011-05-17 Thread David Boxenhorn
Excellent!

(I presume there is some way of representing :, like \:?)


On Tue, May 17, 2011 at 11:44 AM, Sylvain Lebresne sylv...@datastax.comwrote:

 Provided you're working on a branch that has CASSANDRA-2231 applied (that's
 either the cassandra-0.8.1 branch or trunk), this work 'out of the box':

 The setup will look like:
 [default@unknown] create keyspace test;
 [default@unknown] use test;
 [default@test] create column family testCF with
 comparator='CompositeType(AsciiType, IntegerType(reversed=true),
 IntegerType)' and default_validation_class=AsciiType;

 Then:
 [default@test] set testCF[a]['foo:24:24'] = 'v1';
 Value inserted.
 [default@test] set testCF[a]['foo:42:24'] = 'v2';
 Value inserted.
 [default@test] set testCF[a]['foobar:42:24'] = 'v3';
 Value inserted.
 [default@test] set testCF[a]['boobar:42:24'] = 'v4';
 Value inserted.
 [default@test] set testCF[a]['boobar:42:42'] = 'v5';
 Value inserted.
 [default@test] get testCF[a];
 = (column=boobar:42:24, value=v4, timestamp=1305621115813000)
 = (column=boobar:42:42, value=v5, timestamp=1305621125563000)
 = (column=foo:42:24, value=v2, timestamp=1305621096473000)
 = (column=foo:24:24, value=v1, timestamp=1305621085548000)
 = (column=foobar:42:24, value=v3, timestamp=1305621110813000)
 Returned 5 results.

 --
 Sylvain

 On Tue, May 17, 2011 at 9:20 AM, David Boxenhorn da...@taotown.com
 wrote:
  This is what I'm talking about
 
  https://issues.apache.org/jira/browse/CASSANDRA-2231
 
  The on-disk format is
 
  (short)lengthconstituentend byte =
 0(short)lengthconstituentend
  byte = 0...
 
  I would like to be able to input these kinds of keys into the CLI,
 something
  like
 
  set cf[key]['constituent1':'constituent2':'constituent3'] = val
 
 
  On Tue, May 17, 2011 at 2:15 AM, Sameer Farooqui 
 cassandral...@gmail.com
  wrote:
 
  Cassandra wouldn't know that the column name is composite of two
 different
  things. So you could just request the column names and values for a
 specific
  key like this and then just look at the column names that get returned:
  [default@MyKeyspace] get DemoCF[ascii('key_42')];
  = (column=CA_SanJose, value=50, timestamp=1305236885112000)
  = (column=CA_PaloAlto, value=49, timestamp=1305236885192000)
  = (column=FL_Orlando, value=45, timestamp=130523688528)
  = (column=NY_NYC, value=40, timestamp=1305236885361000)
 
  And I'm not sure what you mean by inputting composite column names. You
  just input them like any other column name:
  [default@MyKeyspace] set DemoCF['key_42']['CA_SanJose']='51';
  Value inserted.
 
 
 
 
  On Mon, May 16, 2011 at 2:34 PM, Aaron Morton aa...@thelastpickle.com
  wrote:
 
  What do you mean by composite column names?
 
  Do the data type functions supported by get and set help? Or the assume
  statement?
 
  Aaron
  On 17/05/2011, at 3:21 AM, David Boxenhorn da...@taotown.com wrote:
 
   Is there a way to view composite column names in the CLI?
  
   Is there a way to input them (i.e. in the set command)?
  
 
 
 



Re: Using composite column names in the CLI

2011-05-17 Thread Sylvain Lebresne
 (I presume there is some way of representing :, like \:?)

Well no, not yet, but we'll try to figure something I guess (we'll have the
problem with CASSANDRA-2474 I think so we'll probably use the same
solution).

But let's keep in mind this is unreleased code at this point. And let me
also add that it's just a cli limitation (actually of the
AbstractCompositeType.fromString() method).

--
Sylvain

 On Tue, May 17, 2011 at 11:44 AM, Sylvain Lebresne sylv...@datastax.com
 wrote:

 Provided you're working on a branch that has CASSANDRA-2231 applied
 (that's
 either the cassandra-0.8.1 branch or trunk), this work 'out of the box':

 The setup will look like:
 [default@unknown] create keyspace test;
 [default@unknown] use test;
 [default@test] create column family testCF with
 comparator='CompositeType(AsciiType, IntegerType(reversed=true),
 IntegerType)' and default_validation_class=AsciiType;

 Then:
 [default@test] set testCF[a]['foo:24:24'] = 'v1';
 Value inserted.
 [default@test] set testCF[a]['foo:42:24'] = 'v2';
 Value inserted.
 [default@test] set testCF[a]['foobar:42:24'] = 'v3';
 Value inserted.
 [default@test] set testCF[a]['boobar:42:24'] = 'v4';
 Value inserted.
 [default@test] set testCF[a]['boobar:42:42'] = 'v5';
 Value inserted.
 [default@test] get testCF[a];
 = (column=boobar:42:24, value=v4, timestamp=1305621115813000)
 = (column=boobar:42:42, value=v5, timestamp=1305621125563000)
 = (column=foo:42:24, value=v2, timestamp=1305621096473000)
 = (column=foo:24:24, value=v1, timestamp=1305621085548000)
 = (column=foobar:42:24, value=v3, timestamp=1305621110813000)
 Returned 5 results.

 --
 Sylvain

 On Tue, May 17, 2011 at 9:20 AM, David Boxenhorn da...@taotown.com
 wrote:
  This is what I'm talking about
 
  https://issues.apache.org/jira/browse/CASSANDRA-2231
 
  The on-disk format is
 
  (short)lengthconstituentend byte =
  0(short)lengthconstituentend
  byte = 0...
 
  I would like to be able to input these kinds of keys into the CLI,
  something
  like
 
  set cf[key]['constituent1':'constituent2':'constituent3'] = val
 
 
  On Tue, May 17, 2011 at 2:15 AM, Sameer Farooqui
  cassandral...@gmail.com
  wrote:
 
  Cassandra wouldn't know that the column name is composite of two
  different
  things. So you could just request the column names and values for a
  specific
  key like this and then just look at the column names that get returned:
  [default@MyKeyspace] get DemoCF[ascii('key_42')];
  = (column=CA_SanJose, value=50, timestamp=1305236885112000)
  = (column=CA_PaloAlto, value=49, timestamp=1305236885192000)
  = (column=FL_Orlando, value=45, timestamp=130523688528)
  = (column=NY_NYC, value=40, timestamp=1305236885361000)
 
  And I'm not sure what you mean by inputting composite column names. You
  just input them like any other column name:
  [default@MyKeyspace] set DemoCF['key_42']['CA_SanJose']='51';
  Value inserted.
 
 
 
 
  On Mon, May 16, 2011 at 2:34 PM, Aaron Morton aa...@thelastpickle.com
  wrote:
 
  What do you mean by composite column names?
 
  Do the data type functions supported by get and set help? Or the
  assume
  statement?
 
  Aaron
  On 17/05/2011, at 3:21 AM, David Boxenhorn da...@taotown.com wrote:
 
   Is there a way to view composite column names in the CLI?
  
   Is there a way to input them (i.e. in the set command)?
  
 
 
 




Using composite column names in the CLI

2011-05-16 Thread David Boxenhorn
Is there a way to view composite column names in the CLI?

Is there a way to input them (i.e. in the set command)?


Re: Using composite column names in the CLI

2011-05-16 Thread Sameer Farooqui
Cassandra wouldn't know that the column name is composite of two different
things. So you could just request the column names and values for a specific
key like this and then just look at the column names that get returned:

[default@MyKeyspace] get DemoCF[ascii('key_42')];
= (column=CA_SanJose, value=50, timestamp=1305236885112000)
= (column=CA_PaloAlto, value=49, timestamp=1305236885192000)
= (column=FL_Orlando, value=45, timestamp=130523688528)
= (column=NY_NYC, value=40, timestamp=1305236885361000)


And I'm not sure what you mean by inputting composite column names. You just
input them like any other column name:

[default@MyKeyspace] set DemoCF['key_42']['CA_SanJose']='51';
Value inserted.





On Mon, May 16, 2011 at 2:34 PM, Aaron Morton aa...@thelastpickle.comwrote:

 What do you mean by composite column names?

 Do the data type functions supported by get and set help? Or the assume
 statement?

 Aaron
 On 17/05/2011, at 3:21 AM, David Boxenhorn da...@taotown.com wrote:

  Is there a way to view composite column names in the CLI?
 
  Is there a way to input them (i.e. in the set command)?