Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support materialized views [DATACASS-383] #550

Open
spring-projects-issues opened this issue Jan 9, 2017 · 5 comments
Open

Support materialized views [DATACASS-383] #550

spring-projects-issues opened this issue Jan 9, 2017 · 5 comments
Assignees
Labels
in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Mark Paluch opened DATACASS-383 and commented

See http://www.datastax.com/dev/blog/new-in-cassandra-3-0-materialized-views


5 votes, 9 watchers

@spring-projects-issues
Copy link
Author

Andrew commented

To speed up the process, just wanted to suggest an example of what we implemented in our project.

Define additional views on table entities:

@Table("user")
@MaterializedViews({
  @MaterializedView(name="user_by_email", primaryKeyColumns = {
        @PrimaryKeyColumn(value = "email", type = PrimaryKeyType.PARTITIONED),
        @PrimaryKeyColumn(value = "id")
    })
})

Use a query:

@Table("user")
@MaterializedViews({
  @MaterializedView(name="user_by_email",
      query="SELECT * FROM user WHERE email IS NOT NULL AND id IS NOT NULL",
      primaryKeyColumns = {
        @PrimaryKeyColumn(value = "email", type = PrimaryKeyType.PARTITIONED),
        @PrimaryKeyColumn(value = "id")
    })
})

Plus added schema specs and generation/drop extending
CassandraPersistentEntitySchemaCreator and CassandraSessionFactoryBean. Works fine so far.

@spring-projects-issues
Copy link
Author

Kamil commented

Guys, are there any plans to support it?

@spring-projects-issues
Copy link
Author

Mark Paluch commented

It makes sense to start out with CQL generation and view descriptors in the first place. I'm not entirely sold on annotation-based schema creation. The query part allows more than just NOT NULL predicates. Stating queries that way is error-prone and functionality can be only verified when using schema creation.

Using views requires our CassandraTemplate methods to also accept a table name

@spring-projects-issues
Copy link
Author

Nate McCall commented

We have retro-actively marked Materialized Views as experimental. In order to keep users from hitting any of the (numerous) issues, I am asking that you avoid creating any implementations here until we can iron out the functionality.
http://mail-archives.apache.org/mod_mbox/cassandra-user/201710.mbox/%[email protected]%3E

@spring-projects-issues
Copy link
Author

Mark Paluch commented

Thanks for the heads up

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: mapping Mapping and conversion infrastructure labels Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants