
SELECT id,prom FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 1, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 1, 1)
**/
;

SELECT id,prom.time('2025-09-27', '') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 18, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 24, 1)
**/
;

SELECT
  id,prom.date('2025-11-28').find(disk='/opt/matrix*')
FROM
  /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 18, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 19, 1)
**/;

SELECT
  id,prom.date('2025-11-28').find(name="*key2*")
FROM
  /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 18, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 19, 1)
**/;

SELECT id,prom.find(name='key2') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 7, 1)
**/
;

SELECT id, prom.date('2025-07-27') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecisen1", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecisen2", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 8, 1)
**/
;

SELECT id, prom.date('2025-07-28') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecisen1", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecisen2", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 4, 1)
**/
;

SELECT id, vtime, prom.date('2025-07-29') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecisen1", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecisen2", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 10, 1)
**/
;

SELECT id, prom.date('2025-07-30') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecisen1", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecisen2", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 11, 1)
**/
;

SELECT prom.date('2025-07-31') FROM /test/bucketpromdb where id='bucketpromdb:wecise'
/**
output()
matchcount("prom.len", 6, 1)
**/
;

SELECT id,prom.time('2025-09-27') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise", "prom.len", 5, 1)
**/
;

SELECT id,prom.time('2025-07-26', '').find(name='key2') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 7, 1)
**/
;

-- 复杂查找用到了 lucene，得多等一会儿
/**
sleep(1s)
**/
;

SELECT id,prom.time('2025-07-26', '').find(name='keys2').find(value ~ '.*中文长字.*') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 3, 1)
**/
;

SELECT id,prom.time('2025-07-26', '').find(name='keys2').find(value = '这是中文长字符串ssstss') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 3, 1)
**/
;

SELECT id,prom.time('2025-07-26', '').find(name='keys1').find(value = 'ssst') FROM /test/bucketpromdb
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 0, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 3, 1)
**/
;

SELECT id,prom.time('2025-07-26', '').find(name='keys2').find(value !~ '.*中文长字a*') FROM /test/bucketpromdb 
/**
output()
matchcount(id, "bucketpromdb:wecise", "prom", null, 1)
**/
;

SELECT id,prom.time('2025-07-26', '').find(name='key1') FROM /test/bucketpromdb  
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 16, 1)
**/
;

-- SELECT id,prom.time('2025-07-26', '').find(name='key1').find(value = 2.9) FROM /test/bucketpromdb  
-- /**
-- output()
-- matchcount(id, "bucketpromdb:wecise11", "prom.len", 0, 1)
-- matchcount(id, "bucketpromdb:wecise", "prom.len", 1, 1)
-- **/
-- ;

-- SELECT id,prom.time('2025-07-26', '').find(name='key1').find(value >= 2.9) FROM /test/bucketpromdb 
-- /**
-- output()
-- matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
-- matchcount(id, "bucketpromdb:wecise", "prom.len", 7, 1)
-- **/
-- ;

-- SELECT prom.time('2025-07-26', '').find(name='key1').find(value <= 2.9) FROM /test/bucketpromdb 
-- /**
-- output()
-- matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
-- matchcount(id, "bucketpromdb:wecise", "prom.len", 7, 1)
-- **/
-- ;

select id,prom.time('2025-11-28 11:30', '2025-11-28 11:30').find(name='key1.key2.key4') from /test/bucketpromdb 
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 1, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 1, 1)
**/
;

SELECT class, id, prom.time('2025-01-01', '').find(name ~ "key1.key2.*") FROM 	 /test/bucketpromdb/ 
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 18, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 19, 1)
**/
;

SELECT id, prom.time('2025-07-24', '').find(name in ["key1"]).find(disk in ["/opt/matrix"]) FROM /test/bucketpromdb 
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.len", 3, 1)
matchcount(id, "bucketpromdb:wecise", "prom.len", 1, 1)
**/
;

-- SELECT id, prom_str.date('2025-07-31').find(value ~ 'info') FROM  /test/promdb_string 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_str.date('2025-07-31').find(value !~ 'info') FROM  /test/promdb_string 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_str.date('2025-07-31').find(value = '这是string测试') FROM  /test/promdb_string 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_str.date('2025-07-31').find(value in ['这是string测试']) FROM  /test/promdb_string 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_str.date('2025-07-31').find(value not like '这是string*') FROM  /test/promdb_string 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_str.date('2025-07-31').find(value like '这是string*') FROM  /test/promdb_string 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_str.date('2025-07-31').find(value like '这是string*').facet("info", "hello").groupby(1h)  FROM  /test/promdb_string 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_str.date('2025-07-31').find(value like '这是string*').facet("info", "hello").groupby(1h).outlier()  FROM  /test/promdb_string 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_str.date('2025-07-27', '2025-07-28', '2025-07-29', '2025-07-30', '2025-07-31').find(value like '这是string*').facet("error").groupby(1h)  FROM  /test/promdb_string
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_split.date('2025-07-31').time('11:27') FROM /test/bucketsplit 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_split.date('2025-07-26','2025-07-27','2025-07-28','2025-07-29','2025-07-30','2025-07-31') FROM /test/bucketsplit 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_split.date('2025-07-26','2025-07-27','2025-07-28','2025-07-29','2025-07-30','2025-07-31').avg().groupby(1d) FROM /test/bucketsplit 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_split.date('2025-07-26','2025-07-27','2025-07-28','2025-07-29','2025-07-30','2025-07-31').outlier() FROM /test/bucketsplit 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_split.date('2025-07-26','2025-07-27','2025-07-28','2025-07-29','2025-07-30','2025-07-31').time('11:').outlier() FROM /test/bucketsplit 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_split.date('2025-07-26').unit('avg') FROM /test/bucketsplit 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_split.date('2025-07-26','2025-07-27','2025-07-28','2025-07-29','2025-07-30','2025-07-31').sigma("count") FROM /test/bucketsplit 
-- /**
-- output()
-- **/
-- ;

-- SELECT id, prom_split.date('2025-07-26','2025-07-27','2025-07-28','2025-07-29','2025-07-30','2025-07-31').sigma("count", 1h) FROM /test/bucketsplit 
-- /**
-- output()
-- **/
-- ;

SELECT
  id, prom.time('2025-11-28 11:24:00', '2025-11-28 11:25:00').find(name='key1.key2.key3').sum()
FROM
  /test/bucketpromdb  where id='bucketpromdb:wecise11'
/**
output()
matchcount(id, "bucketpromdb:wecise11", "prom.0.2", 2, 1)
**/
;

SELECT id, prom.date('2025-11-28').avg().sigma() FROM  /test/bucketpromdb
/**
output()
match(id, "bucketpromdb:wecise11", "prom.0.2", 2.661111111111112, "prom.0.5", 0.16034299655179796~0.16034299655179798)
match(id, "bucketpromdb:wecise", "prom.0.2", 2.663157894736843, "prom.0.5", 0.15630781478860528~0.15630781478860534)
**/
;

SELECT id, prom.date('2025-11-28').med() FROM  /test/bucketpromdb
/**
output()
match(id, "bucketpromdb:wecise11", "prom.0.2", 2.7)
match(id, "bucketpromdb:wecise", "prom.0.2", 2.7)
**/
;
