1
안녕하세요 저는 주기적으로 알림을 보내는 특정 장치에 대한 데이터를 쿼리하고 싶습니다. 그래서 나는 시계열을 갖고 싶다.카산드라 (Cassandra) 시계열 쿼리
CREATE TABLE alerts_by_day (
day_of_year int,
year int,
alert_timestamp timestamp,
serial_number text,
alert_id uuid,
alert_type text,
PRIMARY KEY((day_of_year, year), serial_number, alert_timestamp, alert_type,alert_id)
) WITH CLUSTERING ORDER BY (serial_number DESC, alert_timestamp DESC, alert_type DESC);
가 지금은 시간 범위에서 쿼리 할 수 있도록하기 위해 쿼리 또는 구체화 된 뷰를 만들려면 : 이 같은 테이블 생성 (예 : 년 11 월 29 일부터 2015 년 1 월 (20) 2016)를하고하여 경고 유형. 그래서 나는 단지 특정 유형과 시간 범위에 대한 경고를 보여주고 싶습니다. 나는 특정 시간 범위에 대해 조회 할 수 있습니다
Select * from alerts_by_day
where day_of_year IN (312,313)
and year IN (2016,2015)
and alert_timestamp < '2016-11-08 03:09:14-0800'
and alert_timestamp > '2016-11-07 23:13:28-0800'
하지만 난이 작업을 수행 할 수 없습니다
Select * from alerts_by_day
where day_of_year IN (312,313)
and year IN (2016,2015)
and alert_timestamp < '2016-11-08 03:09:14-0800'
and alert_timestamp > '2016-11-07 23:13:28-0800'
and alert_type IN ('type1', 'type2')
내가 alert_timestamp에 대한 EQ되지 않은 제한을 사용하기 때문이다.
어떻게하면 유형 1과 유형 2의 경고 만 볼 수 있습니까? 여기
오류입니다 : 실행할 수 없습니다 CQL 스크립트를 열 대해 ALERT_FREQUENCY를 클러스터링하는 (precedign 열 alert_timestamp가 아닌 EQ-관계에 의해 제한) 제한 될 수
cassandra 버전을 사용하고 계십니까? – root545
답변을 삭제했습니다. 하지만 당신은이 대답을 확인할 수 있습니다 http://stackoverflow.com/questions/34422515/cassandra-error-clustering-column-cannot-be-restricted-preceding-column-is-re 짧게 뭐하는거야 불가능합니다 – root545