I have a Cassandra table,
CREATE TABLE read_locks (
parent_path text,
filename text,
instance text,
PRIMARY KEY ((parent_path, filename), instance)
);
Logically, I want to check for any locks in the file with the following expression:
select count(*)>0 as result from read_locks where parent_path='...' and filename='...';
Of course, I have at least 2 implementations.
select count(*) as result from read_locks where parent_path='...' and filename='...';
and then use another code, such as C ++, to check the value of the result.
or
select * from read_locks where parent_path='...' and filename='...';
and then use another code, such as C ++, to check the bool value of the following statement:
cass_iterator_next(rows)
I'm not sure which is better.
And I think there is a user aggregate function for this, but I could not understand.
Share your comments.
Thanks in advance
source
share