Reputation: 4864
Having this Entity
@Table(keyspace = KEYSPACE)
public class CE_TimeSeries extends Entity implements TimeSeriesPoint{
@PartitionKey(1)
private String typeId;
@ClusteringColumn(value=1, asc=true)
private String userId;
@ClusteringColumn(value=2, asc=true)
private Date startDate;
@Column
private Date endDate;
@Column
private int groupInterval;
@Column
private int interval;
}
This CQL
SELECT startDate, endDate, groupInterval, interval FROM CE_TimeSeries WHERE typeId
= :typeId and userId = :userId and ( endDate >= :fromDate or ( startDate >=
:fromDate and startDate <= :toDate ) )
Give the Exception :
Caused by: com.datastax.driver.core.exceptions.SyntaxError: line 1:142
mismatched input 'or' expecting ')' (... ( endDate >= :fromDate [or] (...)
Upvotes: 4
Views: 997
Reputation: 57843
While I don't actually see a question here, I'll assume that you are wondering why you are getting an exception. There are two things wrong with your query.
OR
in the WHERE clause.OR
available kind of precludes the need for parens.The bottom line, is that CQL is not SQL, and the logic you can apply in the WHERE clause is largely dependent on the storage model.
Upvotes: 5