cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler Hobbs <ty...@riptano.com>
Subject Re: quick question about super columns
Date Sat, 08 Jan 2011 16:14:03 GMT
A couple of alternatives off the top of my head:

1) A row of supercolumns becomes a row of standard columns with compound
column names.

2) A row of N supercolumns becomes N rows of standard columns (with compound
keys if needed); a separate timeline or index replaces the super column
names.

There might be other data models that work for a specific case, as well.

- Tyler

On Sat, Jan 8, 2011 at 3:38 AM, Rajkumar Gupta <rajkumar.w93@gmail.com>wrote:

> Thanks Tyler & Stu,
>
> Tyler, as the alternatives for large no of subcolumns in a
> supercolumn, what do you suggest ? Like splitting up a
> 'supercolumnFamily' into several 'columnfamilies' ?? What else ?
>
>
> On Sat, Jan 8, 2011 at 2:33 PM, Stu Hood <stuhood@gmail.com> wrote:
> > Raj: the super column indexing is a longstanding issue that we've been
> > considering recently, and would like to fix.
> > See https://issues.apache.org/jira/browse/CASSANDRA-674
> >
> > On Fri, Jan 7, 2011 at 10:53 PM, Tyler Hobbs <tyler@riptano.com> wrote:
> >>
> >> Not that I'm aware of.  There are several other decent alternatives to
> >> large amounts of subcolumns in a supercolumn, so I don't think it's a
> high
> >> priority.
> >>
> >> - Tyler
> >>
> >> On Fri, Jan 7, 2011 at 9:59 PM, Rajkumar Gupta <rajkumar.w93@gmail.com>
> >> wrote:
> >>>
> >>> Hey Tyler,
> >>>
> >>> Is this limitation of supercolumns going to be removed anytime sooner ?
> >>>
> >>> Raj
> >>>
> >>> On Fri, Jan 7, 2011 at 8:51 PM, Tyler Hobbs <tyler@riptano.com> wrote:
> >>> > An important bit to read about supercolumn limitations:
> >>> > http://www.riptano.com/docs/0.6/data_model/supercolumns#limitations
> >>> >
> >>> > Don't make supercolumns with a huge number of subcolumns (or a few
> >>> > really
> >>> > large subcolumns) unless you plan to always read all of them at once.
> >>> >
> >>> > - Tyler
> >>> >
> >>> > On Fri, Jan 7, 2011 at 1:27 AM, Arijit Mukherjee <arijit72@gmail.com
> >
> >>> > wrote:
> >>> >>
> >>> >> Thanx to both of you. I can now go ahead a bit more.
> >>> >>
> >>> >> Arijit
> >>> >>
> >>> >> On 7 January 2011 12:53, Narendra Sharma <narendra.sharma@gmail.com
> >
> >>> >> wrote:
> >>> >> > With raw thrift APIs:
> >>> >> >
> >>> >> > 1. Fetch column from supercolumn:
> >>> >> >
> >>> >> > ColumnPath cp = new ColumnPath("ColumnFamily");
> >>> >> > cp.setSuper_column("SuperColumnName");
> >>> >> > cp.setColumn("ColumnName");
> >>> >> > ColumnOrSuperColumn resp = client.get(getByteBuffer("RowKey"),
cp,
> >>> >> > ConsistencyLevel.ONE);
> >>> >> > Column c = resp.getColumn();
> >>> >> >
> >>> >> > 2. Add a new supercolumn:
> >>> >> >
> >>> >> >     SuperColumn superColumn = new SuperColumn();
> >>> >> >     superColumn.setName(getBytes("SuperColumnName"));
> >>> >> >     cols = new ArrayList<Column>();
> >>> >> >     Column c = new Column();
> >>> >> >     c.setName(name);
> >>> >> >     c.setValue(value);
> >>> >> >     c.setTimestamp(timeStamp);
> >>> >> >     cols.add(c);
> >>> >> >     //repeat above 5 lines for as many cols you want in
> supercolumn
> >>> >> >     superColumn.setColumns(cols);
> >>> >> >
> >>> >> >
> >>> >> >     List<Mutation> mutations = new ArrayList<Mutation>();
> >>> >> >     ColumnOrSuperColumn csc = new ColumnOrSuperColumn();
> >>> >> >     csc.setSuper_column(superColumn);
> >>> >> >     csc.setSuper_columnIsSet(true);
> >>> >> >     Mutation m = new Mutation();
> >>> >> >     m.setColumn_or_supercolumn(csc);
> >>> >> >     m.setColumn_or_supercolumnIsSet(true);
> >>> >> >     mutations.add(m);
> >>> >> >
> >>> >> >
> >>> >> >     Map<String, List<Mutation>> allMutations =
new HashMap<String,
> >>> >> > List<Mutation>>();
> >>> >> >     allMutations.put("ColumnFamilyName", mutations);
> >>> >> >     Map<ByteBuffer, Map<String, List<Mutation>>>
mutationMap = new
> >>> >> > HashMap<ByteBuffer, Map<String, List<Mutation>>>();
> >>> >> >     mutationMap.put(getByteBuffer("RowKey"), mutations);
> >>> >> >     client.batch_mutate(mutationMap, ConsistencyLevel.ONE);
> >>> >> >
> >>> >> > HTH!
> >>> >> >
> >>> >> > Thanks,
> >>> >> > Naren
> >>> >> >
> >>> >> >
> >>> >> >
> >>> >> > On Thu, Jan 6, 2011 at 10:42 PM, Arijit Mukherjee
> >>> >> > <arijit72@gmail.com>
> >>> >> > wrote:
> >>> >> >>
> >>> >> >> Thank you. And is it similar if I want to search a subcolumn
> within
> >>> >> >> a
> >>> >> >> given supercolumn? I mean I have the supercolumn key and
the
> >>> >> >> subcolumn
> >>> >> >> key - can I fetch the particular subcolumn?
> >>> >> >>
> >>> >> >> Can you share a small piece of example code for both?
> >>> >> >>
> >>> >> >> I'm still new into this and trying to figure out the Thrift
APIs.
> I
> >>> >> >> attempted to use Hector, but got myself into more confusion.
> >>> >> >>
> >>> >> >> Arijit
> >>> >> >>
> >>> >> >> On 7 January 2011 11:44, Roshan Dawrani <roshandawrani@gmail.com
> >
> >>> >> >> wrote:
> >>> >> >> >
> >>> >> >> > On Fri, Jan 7, 2011 at 11:39 AM, Arijit Mukherjee
> >>> >> >> > <arijit72@gmail.com>
> >>> >> >> > wrote:
> >>> >> >> >>
> >>> >> >> >> Hi
> >>> >> >> >>
> >>> >> >> >> I've a quick question about supercolumns.
> >>> >> >> >> EventRecord = {
> >>> >> >> >>    eventKey2: {
> >>> >> >> >>        e2-ts1: {set of columns},
> >>> >> >> >>        e2-ts2: {set of columns},
> >>> >> >> >>        ...
> >>> >> >> >>        e2-tsn: {set of columns}
> >>> >> >> >>    }
> >>> >> >> >>    ....
> >>> >> >> >> }
> >>> >> >> >>
> >>> >> >> >> If I want to append another "e2-tsp: {set of
columns}" to the
> >>> >> >> >> event
> >>> >> >> >> record keyed by eventKey2, do I need to retrieve
the entire
> >>> >> >> >> eventKey2
> >>> >> >> >> map, and then append this new row and re-insert
eventKey2?
> >>> >> >> >
> >>> >> >> > No, you can simply insert a new super column with
its
> sub-columns
> >>> >> >> > with
> >>> >> >> > the rowKey that you want, and it will join the other
super
> >>> >> >> > columns of
> >>> >> >> > that
> >>> >> >> > row.
> >>> >> >> >
> >>> >> >> > A row have billions of super columns. Imagine fetching
them
> all,
> >>> >> >> > just
> >>> >> >> > to
> >>> >> >> > add one more super column into it.
> >>> >> >> >
> >>> >> >> >
> >>> >> >> >
> >>> >> >> >
> >>> >> >> >
> >>> >> >>
> >>> >> >>
> >>> >> >> --
> >>> >> >> "And when the night is cloudy,
> >>> >> >> There is still a light that shines on me,
> >>> >> >> Shine on until tomorrow, let it be."
> >>> >> >
> >>> >> >
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >> "And when the night is cloudy,
> >>> >> There is still a light that shines on me,
> >>> >> Shine on until tomorrow, let it be."
> >>> >
> >>> >
> >>
> >
> >
>

Mime
View raw message