Comments (10)
An issue tracker is not the place to ask a QUESTION, that is for a support forum.
Never heard of "SASI" so i haven't implemented such a thing. Hence, since this is open source, you could easily contribute support for it
from datanucleus-cassandra.
SASI indexes are calculated and stored as part of each SSTable file, differing from the original Cassandra implementation, which stores indexes in separate, βhiddenβ tables.
CREATE CUSTOM INDEX user_last_name_sasi_idx ON user (last_name)
USING 'org.apache.cassandra.index.sasi.SASIIndex';
SASI indexes do offer functionality beyond the traditional secondary index implementation, such as the ability to do inequality (greater than or less than) searches on indexed columns. You can also use the new CQL LIKE keyword to do text searches against indexed columns. For example, you could use the following query to find users whose last name begins with βNβ:
SELECT * FROM user WHERE last_name LIKE 'N%';
Normally if I create the index I can query with a LIKE clause with CQL JPA Native Queries (http://www.datanucleus.org/products/accessplatform_4_2/jpa/native_query.html).
From (http://www.datanucleus.org/documentation/news/access_platform_4_0.html), Version 4.0 includes the following over 3.2/3.3:
- JPA : allow "native" query for Cassandra
- Cassandra : support for native CQL queries via JDO or JPA
Thanks
Youcef HILEM
from datanucleus-cassandra.
As already said, if you want support for such a feature then you need to implement it.
from datanucleus-cassandra.
Okay, but I have to understand before implementing what's missing.
I first test CQL Native Queries supported by Datanucleus.
from datanucleus-cassandra.
My project (linkedin/ambry#555 (comment)): use S3Proxy (https://github.com/gaul/s3proxy/wiki/Using-S3Proxy-in-Java-projects) with jclouds-jdbc (https://github.com/jclouds/jclouds-labs/tree/master/jdbc) and ambry-linkedin (https://github.com/linkedin).
For jclouds-jdbc I want to use DataNucleus JPA with Cassandra.
That's why I'm trying to deal with this query with a Like clause (https://github.com/jclouds/jclouds-labs/blob/master/jdbc/src/main/java/org/jclouds/jdbc/repository/BlobRepository.java#L45):
public List<BlobEntity> findBlobsByDirectory(ContainerEntity containerEntity, String directory) {
return entityManager.get().createQuery("SELECT b FROM " + entityClass.getName() + " b "
+ "WHERE b.containerEntity = :containerEntity AND b.key != :directoryName AND b.key LIKE :directoryLike ", entityClass)
.setParameter("containerEntity", containerEntity)
.setParameter("directoryName", directory)
.setParameter("directoryLike", directory + "%")
.getResultList();
}
I do not know the internal architecture of DataNeuclus for Cassandra.
Could you explain to me what I need to do to implement this feature?
Thanks
Youcef HILEM
from datanucleus-cassandra.
All code has comments, so delve into it. JPQLQuery controls the basic conversion of JPQL into CQL. QueryToCQLMapper does the conversion. Any query has a "generic" compilation, shown in the log. QueryToCQLMapper converts that into a "datastore" compilation (aka CQL). That's all there is to know. Look at the generic compilation that your query is compiled to (for the LIKE clause) and then find the equivalent place in the QueryToCQLMapper (or superclass stub) that handles that type, and implement it.
from datanucleus-cassandra.
Thank you.
To create the SASI index (https://docs.datastax.com/en/dse/5.1/cql/cql/cql_using/useSASIIndex.html), I would also need to add an index annotation to the following attribute (https://github.com/jclouds/jclouds-labs/blob/master/jdbc/src/main/java/org/jclouds/jdbc/entity/BlobEntity.java#L46):
@Id
private String key;
Sorry but I'm stuck on that too.
At worst I will create the SASI index by an external script.
from datanucleus-cassandra.
JPA already has @Index
annotations, supported, as per CassandraSchemaHandler https://github.com/datanucleus/datanucleus-cassandra/blob/master/src/main/java/org/datanucleus/store/cassandra/CassandraSchemaHandler.java#L1078. But that is not this "issue" you have raised here, so nothing to do with this
from datanucleus-cassandra.
Thank you. There I have all the information. I will submit a PR as soon as it is ready.
from datanucleus-cassandra.
No testcase demonstrating anything, and no pull request so closing.
Can be reopened if complying with basic rules of this project, or if contributing a PR for whatever this is
from datanucleus-cassandra.
Related Issues (20)
- Support core-19
- Support core-134
- Support core-159
- Support core-153
- Support SoftDelete of objects
- Load of query doesnt ensure that all SCOs are wrapped
- Need to assign type to SOFTDELETE column
- Check for schema existence of a class is unoptimised and should check for StoreData
- Support core-233
- Persisting an entity graph fails with "Unable to add column with ..." HOT 9
- Support @Column(unique = true) for Cassandra HOT 1
- How to set load balance policy on the cluster? HOT 2
- Support load balancing policy
- Change "cassandra.XXX.using" properties to "datanucleus.cassandra.XXX.using"
- Support Cassandra v4
- CassandraQueryResult behaves incorrectly wrt fetchSize
- Support persistence of java.time types
- Support SoftDelete lifecycle of operations
- Support querying of multitenancy / softdelete candidate classes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datanucleus-cassandra.