You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2016/01/12 17:28:40 UTC

[jira] [Resolved] (CASSANDRA-10533) Allowing to have static columns attached to clustering columns

     [ https://issues.apache.org/jira/browse/CASSANDRA-10533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne resolved CASSANDRA-10533.
------------------------------------------
    Resolution: Won't Fix

As is happens, CASSANDRA-8099 makes this an even worth fit to the storage engine than before so that this would require a lot of changes and lots of refactoring if we don't want to look very ugly. And I just don't think the ROI is worth it, so closing as won't fix.

> Allowing to have static columns attached to clustering columns
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-10533
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10533
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: DOAN DuyHai
>
> Now that [CASSANDRA-8099] is done, can we look again into the idea of having *static columns* respective to clustering column ?
> I have a very relevant use-case for a customer. They want to store store an hierarchy of data for user expenses:
> {code:sql}
> CREATE TABLE user_expenses(
>  user_id bigint,
>  firstname text static,
>  lastname text static,
>  report_id uuid,
>  report_title text,
>  report_amount double,
>  report_xxx ....
>  ...,
>  line_id uuid,
>  line_item text,
>  line-amount double,
>  ...
>  PRIMARY KEY((user_id), report_id, line_id)
> )
> {code}
> So basically we have 2 levels of nesting:
>  1 user - N reports
>  1 report - N lines
>  With the above data model,  all report data are *duplicated* for each line so that any update on report_title or other report property will require the *anti-pattern read-before-write*:
>  1. Select all line_id for this report_id
>  2. For each line_id, perform the update
> One possible trick is to use a static map<report_id, report_property> but it's far from being elegant, not to say dirty.
> So I believe that there is definitely a need for static columns that are *relative* to a clustering column. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)