cqlstr 755 字节
Newer Older
F
fang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
drop keyspace if exists cassandra;
CREATE KEYSPACE cassandra WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};
USE cassandra;
create table test (devid int, devname text, devgroup int, ts bigint, minute bigint, temperature int, humidity float,primary key (ts, devgroup, minute));
insert into test (devid,devname,devgroup,ts, minute,temperature,humidity) values (1, 'dev_1', 1,120000,1,1,1.2);
create function tominute (ts bigint) returns null on null input returns bigint language java as $$ return ts/6000; $$;

select * from test where devgroup<1 allow filtering;





##############################################################
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
change primary key, can't be same;