You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "ZhaoYang (JIRA)" <ji...@apache.org> on 2017/06/27 04:11:00 UTC
[jira] [Commented] (CASSANDRA-11947) Ability to create a
Materialized View without primary key column that has '=' relation
[ https://issues.apache.org/jira/browse/CASSANDRA-11947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064226#comment-16064226 ]
ZhaoYang commented on CASSANDRA-11947:
--------------------------------------
How about trying following schema? basically the same query as you want.
{code}
cqlsh:jira> CREATE MATERIALIZED VIEW analytics_ww AS
... SELECT * FROM analytics
... WHERE date IS NOT NULL AND resourceId IS NOT NULL AND country IS NOT NULL AND country = 'WW'
... PRIMARY KEY (resourceId, date, country);
{code}
The original idea to stop `collapsing` data in MV (part of base primary key columns in view) is to protect user from tombstones.. I think in this case, if the `missing primary key in the view` is guarded by a filter condition, it's safe.
If your use case can be done via above example, I suggest won'tfix.
> Ability to create a Materialized View without primary key column that has '=' relation
> --------------------------------------------------------------------------------------
>
> Key: CASSANDRA-11947
> URL: https://issues.apache.org/jira/browse/CASSANDRA-11947
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Nimi Wariboko Jr.
>
> I have a use case where I'd like to create a materialized view where one of the columns is filtered on a '=' relation and the primary key for that materialized view doesn't include that column.
> Example:
> {code}
> CREATE TABLE analytics (
> resourceId text,
> country text,
> date timestamp,
> clicks int,
> PRIMARY KEY(resourceId, date, country)
> );
> CREATE MATERIALIZED VIEW analytics_ww AS
> SELECT * FROM analytics
> WHERE country = 'WW'
> PRIMARY KEY (resourceId, date);
> {code}
> This way I can have a table filtered on a high cardinality column, and I don't also have to specify that column, even though I already know thats the only value in the view.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org