You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Sandeep <Sa...@indatus.com> on 2010/05/18 21:45:30 UTC
Help with UUID in C#.net
Hi all,
I am new to Cassandra. I am trying to insert some values to the columnfamily. The definition of columnfamily in the config file is as follows.
<ColumnFamily Name="CommandQueue"
ColumnType="Super"
CompareWith="TimeUUIDType"
CompareSubcolumnsWith="UTF8Type"/>
When ever I try to insert values to I always get "InvalidRequestException(why: UUIDs must be exactly 16 bytes)".
I am using batch_mutate() to insert column.
How can I insert values to the column family.
Thanks,
Sandeep.
RE: Help with UUID in C#.net
Posted by Sandeep <Sa...@indatus.com>.
Batch Mutate can only take map<string, map<string, list<Mutation>>> as parameter but not a GUID.
How to solve this problem.
From: Sandeep [mailto:Sandeep@indatus.com]
Sent: Tuesday, May 18, 2010 4:03 PM
To: user@cassandra.apache.org
Subject: RE: Help with UUID in C#.net
Hi Roger,
Thanks for your reply.
Actually I copied the class(GUIDGenerator.) in my project.
Guid guidTimeStamp = GuidGenerator.GenerateTimeBasedGuid();
And using the above statement to generate the UUID. But I have no idea how to insert the UUID into Cassandra.
List<Column> listOfArrivalTimes = new List<Column>();
listOfArrivalTimes.Add(new Column() { Name = utf8Encoding.GetBytes("ArrivalTime"), Timestamp = DateTime.Now.Ticks, Value = utf8Encoding.GetBytes(commandQueueEntry.ArrivalTime.ToString()) });
Mutation ArrivalTime = new Mutation()
{
Column_or_supercolumn = new ColumnOrSuperColumn() { Super_column = new SuperColumn() { Name = utf8Encoding.GetBytes("ArrivalTime"), Columns = listOfArrivalTimes } }
};
And then using batch_mutate() to insert the values. I have no clue where and how should I use the generated UUID.
I can not use it in " Timestamp" in column struct because it is of type long. Please help me with this.
Thanks,
Sandeep.
From: Roger Schildmeijer [mailto:schildmeijer@gmail.com]
Sent: Tuesday, May 18, 2010 3:53 PM
To: user@cassandra.apache.org
Subject: Re: Help with UUID in C#.net
Nick Berardi's blog post about Cassandra in conjunction with c#/.net and TimeUUID describes how to do.
http://www.coderjournal.com/2010/04/creating-a-time-uuid-guid-in-net/
// Roger Schildmeijer
On 18 maj 2010, at 21.45em, Sandeep wrote:
Hi all,
I am new to Cassandra. I am trying to insert some values to the columnfamily. The definition of columnfamily in the config file is as follows.
<ColumnFamily Name="CommandQueue"
ColumnType="Super"
CompareWith="TimeUUIDType"
CompareSubcolumnsWith="UTF8Type"/>
When ever I try to insert values to I always get "InvalidRequestException(why: UUIDs must be exactly 16 bytes)".
I am using batch_mutate() to insert column.
How can I insert values to the column family.
Thanks,
Sandeep.
RE: Help with UUID in C#.net
Posted by Sandeep <Sa...@indatus.com>.
Hi Roger,
Thanks for your reply.
Actually I copied the class(GUIDGenerator.) in my project.
Guid guidTimeStamp = GuidGenerator.GenerateTimeBasedGuid();
And using the above statement to generate the UUID. But I have no idea how to insert the UUID into Cassandra.
List<Column> listOfArrivalTimes = new List<Column>();
listOfArrivalTimes.Add(new Column() { Name = utf8Encoding.GetBytes("ArrivalTime"), Timestamp = DateTime.Now.Ticks, Value = utf8Encoding.GetBytes(commandQueueEntry.ArrivalTime.ToString()) });
Mutation ArrivalTime = new Mutation()
{
Column_or_supercolumn = new ColumnOrSuperColumn() { Super_column = new SuperColumn() { Name = utf8Encoding.GetBytes("ArrivalTime"), Columns = listOfArrivalTimes } }
};
And then using batch_mutate() to insert the values. I have no clue where and how should I use the generated UUID.
I can not use it in " Timestamp" in column struct because it is of type long. Please help me with this.
Thanks,
Sandeep.
From: Roger Schildmeijer [mailto:schildmeijer@gmail.com]
Sent: Tuesday, May 18, 2010 3:53 PM
To: user@cassandra.apache.org
Subject: Re: Help with UUID in C#.net
Nick Berardi's blog post about Cassandra in conjunction with c#/.net and TimeUUID describes how to do.
http://www.coderjournal.com/2010/04/creating-a-time-uuid-guid-in-net/
// Roger Schildmeijer
On 18 maj 2010, at 21.45em, Sandeep wrote:
Hi all,
I am new to Cassandra. I am trying to insert some values to the columnfamily. The definition of columnfamily in the config file is as follows.
<ColumnFamily Name="CommandQueue"
ColumnType="Super"
CompareWith="TimeUUIDType"
CompareSubcolumnsWith="UTF8Type"/>
When ever I try to insert values to I always get "InvalidRequestException(why: UUIDs must be exactly 16 bytes)".
I am using batch_mutate() to insert column.
How can I insert values to the column family.
Thanks,
Sandeep.
Re: Help with UUID in C#.net
Posted by Roger Schildmeijer <sc...@gmail.com>.
Nick Berardi's blog post about Cassandra in conjunction with c#/.net and TimeUUID describes how to do.
http://www.coderjournal.com/2010/04/creating-a-time-uuid-guid-in-net/
// Roger Schildmeijer
On 18 maj 2010, at 21.45em, Sandeep wrote:
> Hi all,
>
> I am new to Cassandra. I am trying to insert some values to the columnfamily. The definition of columnfamily in the config file is as follows.
>
> <ColumnFamily Name="CommandQueue"
> ColumnType="Super"
> CompareWith="TimeUUIDType"
> CompareSubcolumnsWith="UTF8Type"/>
>
>
> When ever I try to insert values to I always get "InvalidRequestException(why: UUIDs must be exactly 16 bytes)".
>
> I am using batch_mutate() to insert column.
>
> How can I insert values to the column family.
>
> Thanks,
> Sandeep.