You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "DOAN DuyHai (JIRA)" <ji...@apache.org> on 2015/10/15 14:21:05 UTC
[jira] [Created] (CASSANDRA-10533) Allowing to have static columns
attached to clustering columns
DOAN DuyHai created CASSANDRA-10533:
---------------------------------------
Summary: 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
Components: Core
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)