1040valid.mql 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. SELECT id,prom FROM /test/bucketpromdb
  2. /**
  3. output()
  4. matchcount(id, "bucketpromdb:wecise11", "prom.len", 1, 1)
  5. matchcount(id, "bucketpromdb:wecise", "prom.len", 1, 1)
  6. **/
  7. ;
  8. SELECT id,prom.time('2024-09-27', '') FROM /test/bucketpromdb
  9. /**
  10. output()
  11. matchcount(id, "bucketpromdb:wecise11", "prom.len", 18, 1)
  12. matchcount(id, "bucketpromdb:wecise", "prom.len", 24, 1)
  13. **/
  14. ;
  15. SELECT
  16. id,prom.date('2024-11-28').find(disk='/opt/matrix*')
  17. FROM
  18. /test/bucketpromdb
  19. /**
  20. output()
  21. matchcount(id, "bucketpromdb:wecise11", "prom.len", 18, 1)
  22. matchcount(id, "bucketpromdb:wecise", "prom.len", 19, 1)
  23. **/;
  24. SELECT
  25. id,prom.date('2024-11-28').find(name="*key2*")
  26. FROM
  27. /test/bucketpromdb
  28. /**
  29. output()
  30. matchcount(id, "bucketpromdb:wecise11", "prom.len", 18, 1)
  31. matchcount(id, "bucketpromdb:wecise", "prom.len", 19, 1)
  32. **/;
  33. SELECT id,prom.find(name='key2') FROM /test/bucketpromdb
  34. /**
  35. output()
  36. matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  37. matchcount(id, "bucketpromdb:wecise", "prom.len", 7, 1)
  38. **/
  39. ;
  40. SELECT id, prom.date('2024-07-27') FROM /test/bucketpromdb
  41. /**
  42. output()
  43. matchcount(id, "bucketpromdb:wecisen1", "prom.len", 0, 1)
  44. matchcount(id, "bucketpromdb:wecisen2", "prom.len", 0, 1)
  45. matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  46. matchcount(id, "bucketpromdb:wecise", "prom.len", 8, 1)
  47. **/
  48. ;
  49. SELECT id, prom.date('2024-07-28') FROM /test/bucketpromdb
  50. /**
  51. output()
  52. matchcount(id, "bucketpromdb:wecisen1", "prom.len", 0, 1)
  53. matchcount(id, "bucketpromdb:wecisen2", "prom.len", 0, 1)
  54. matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  55. matchcount(id, "bucketpromdb:wecise", "prom.len", 4, 1)
  56. **/
  57. ;
  58. SELECT id, vtime, prom.date('2024-07-29') FROM /test/bucketpromdb
  59. /**
  60. output()
  61. matchcount(id, "bucketpromdb:wecisen1", "prom.len", 0, 1)
  62. matchcount(id, "bucketpromdb:wecisen2", "prom.len", 0, 1)
  63. matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  64. matchcount(id, "bucketpromdb:wecise", "prom.len", 10, 1)
  65. **/
  66. ;
  67. SELECT id, prom.date('2024-07-30') FROM /test/bucketpromdb
  68. /**
  69. output()
  70. matchcount(id, "bucketpromdb:wecisen1", "prom.len", 0, 1)
  71. matchcount(id, "bucketpromdb:wecisen2", "prom.len", 0, 1)
  72. matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  73. matchcount(id, "bucketpromdb:wecise", "prom.len", 11, 1)
  74. **/
  75. ;
  76. SELECT prom.date('2024-07-31') FROM /test/bucketpromdb where id='bucketpromdb:wecise'
  77. /**
  78. output()
  79. matchcount("prom.len", 6, 1)
  80. **/
  81. ;
  82. SELECT id,prom.time('2024-09-27') FROM /test/bucketpromdb
  83. /**
  84. output()
  85. matchcount(id, "bucketpromdb:wecise", "prom.len", 5, 1)
  86. **/
  87. ;
  88. SELECT id,prom.time('2024-07-26', '').find(name='key2') FROM /test/bucketpromdb
  89. /**
  90. output()
  91. matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  92. matchcount(id, "bucketpromdb:wecise", "prom.len", 7, 1)
  93. **/
  94. ;
  95. -- 复杂查找用到了 lucene,得多等一会儿
  96. /**
  97. sleep(1s)
  98. **/
  99. ;
  100. SELECT id,prom.time('2024-07-26', '').find(name='keys2').find(value ~ '.*中文长字.*') FROM /test/bucketpromdb
  101. /**
  102. output()
  103. matchcount(id, "bucketpromdb:wecise11", "prom.len", 0, 1)
  104. matchcount(id, "bucketpromdb:wecise", "prom.len", 3, 1)
  105. **/
  106. ;
  107. SELECT id,prom.time('2024-07-26', '').find(name='keys2').find(value = '这是中文长字符串ssstss') FROM /test/bucketpromdb
  108. /**
  109. output()
  110. matchcount(id, "bucketpromdb:wecise11", "prom.len", 0, 1)
  111. matchcount(id, "bucketpromdb:wecise", "prom.len", 3, 1)
  112. **/
  113. ;
  114. SELECT id,prom.time('2024-07-26', '').find(name='keys1').find(value = 'ssst') FROM /test/bucketpromdb
  115. /**
  116. output()
  117. matchcount(id, "bucketpromdb:wecise11", "prom.len", 0, 1)
  118. matchcount(id, "bucketpromdb:wecise", "prom.len", 3, 1)
  119. **/
  120. ;
  121. SELECT id,prom.time('2024-07-26', '').find(name='keys2').find(value !~ '.*中文长字a*') FROM /test/bucketpromdb
  122. /**
  123. output()
  124. matchcount(id, "bucketpromdb:wecise", "prom", null, 1)
  125. **/
  126. ;
  127. SELECT id,prom.time('2024-07-26', '').find(name='key1') FROM /test/bucketpromdb
  128. /**
  129. output()
  130. matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  131. matchcount(id, "bucketpromdb:wecise", "prom.len", 16, 1)
  132. **/
  133. ;
  134. -- SELECT id,prom.time('2024-07-26', '').find(name='key1').find(value = 2.9) FROM /test/bucketpromdb
  135. -- /**
  136. -- output()
  137. -- matchcount(id, "bucketpromdb:wecise11", "prom.len", 0, 1)
  138. -- matchcount(id, "bucketpromdb:wecise", "prom.len", 1, 1)
  139. -- **/
  140. -- ;
  141. -- SELECT id,prom.time('2024-07-26', '').find(name='key1').find(value >= 2.9) FROM /test/bucketpromdb
  142. -- /**
  143. -- output()
  144. -- matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  145. -- matchcount(id, "bucketpromdb:wecise", "prom.len", 7, 1)
  146. -- **/
  147. -- ;
  148. -- SELECT prom.time('2024-07-26', '').find(name='key1').find(value <= 2.9) FROM /test/bucketpromdb
  149. -- /**
  150. -- output()
  151. -- matchcount(id, "bucketpromdb:wecise11", "prom.len", 4, 1)
  152. -- matchcount(id, "bucketpromdb:wecise", "prom.len", 7, 1)
  153. -- **/
  154. -- ;
  155. select id,prom.time('2024-11-28 11:30', '2024-11-28 11:30').find(name='key1.key2.key4') from /test/bucketpromdb
  156. /**
  157. output()
  158. matchcount(id, "bucketpromdb:wecise11", "prom.len", 1, 1)
  159. matchcount(id, "bucketpromdb:wecise", "prom.len", 1, 1)
  160. **/
  161. ;
  162. SELECT class, id, prom.time('2024-01-01', '').find(name ~ "key1.key2.*") FROM /test/bucketpromdb/
  163. /**
  164. output()
  165. matchcount(id, "bucketpromdb:wecise11", "prom.len", 18, 1)
  166. matchcount(id, "bucketpromdb:wecise", "prom.len", 19, 1)
  167. **/
  168. ;
  169. SELECT id, prom.time('2024-07-24', '').find(name in ["key1"]).find(disk in ["/opt/matrix"]) FROM /test/bucketpromdb
  170. /**
  171. output()
  172. matchcount(id, "bucketpromdb:wecise11", "prom.len", 3, 1)
  173. matchcount(id, "bucketpromdb:wecise", "prom.len", 1, 1)
  174. **/
  175. ;
  176. -- SELECT id, prom_str.date('2024-07-31').find(value ~ 'info') FROM /test/promdb_string
  177. -- /**
  178. -- output()
  179. -- **/
  180. -- ;
  181. -- SELECT id, prom_str.date('2024-07-31').find(value !~ 'info') FROM /test/promdb_string
  182. -- /**
  183. -- output()
  184. -- **/
  185. -- ;
  186. -- SELECT id, prom_str.date('2024-07-31').find(value = '这是string测试') FROM /test/promdb_string
  187. -- /**
  188. -- output()
  189. -- **/
  190. -- ;
  191. -- SELECT id, prom_str.date('2024-07-31').find(value in ['这是string测试']) FROM /test/promdb_string
  192. -- /**
  193. -- output()
  194. -- **/
  195. -- ;
  196. -- SELECT id, prom_str.date('2024-07-31').find(value not like '这是string*') FROM /test/promdb_string
  197. -- /**
  198. -- output()
  199. -- **/
  200. -- ;
  201. -- SELECT id, prom_str.date('2024-07-31').find(value like '这是string*') FROM /test/promdb_string
  202. -- /**
  203. -- output()
  204. -- **/
  205. -- ;
  206. -- SELECT id, prom_str.date('2024-07-31').find(value like '这是string*').facet("info", "hello").groupby(1h) FROM /test/promdb_string
  207. -- /**
  208. -- output()
  209. -- **/
  210. -- ;
  211. -- SELECT id, prom_str.date('2024-07-31').find(value like '这是string*').facet("info", "hello").groupby(1h).outlier() FROM /test/promdb_string
  212. -- /**
  213. -- output()
  214. -- **/
  215. -- ;
  216. -- SELECT id, prom_str.date('2024-07-27', '2024-07-28', '2024-07-29', '2024-07-30', '2024-07-31').find(value like '这是string*').facet("error").groupby(1h) FROM /test/promdb_string
  217. -- /**
  218. -- output()
  219. -- **/
  220. -- ;
  221. -- SELECT id, prom_split.date('2024-07-31').time('11:27') FROM /test/bucketsplit
  222. -- /**
  223. -- output()
  224. -- **/
  225. -- ;
  226. -- SELECT id, prom_split.date('2024-07-26','2024-07-27','2024-07-28','2024-07-29','2024-07-30','2024-07-31') FROM /test/bucketsplit
  227. -- /**
  228. -- output()
  229. -- **/
  230. -- ;
  231. -- SELECT id, prom_split.date('2024-07-26','2024-07-27','2024-07-28','2024-07-29','2024-07-30','2024-07-31').avg().groupby(1d) FROM /test/bucketsplit
  232. -- /**
  233. -- output()
  234. -- **/
  235. -- ;
  236. -- SELECT id, prom_split.date('2024-07-26','2024-07-27','2024-07-28','2024-07-29','2024-07-30','2024-07-31').outlier() FROM /test/bucketsplit
  237. -- /**
  238. -- output()
  239. -- **/
  240. -- ;
  241. -- SELECT id, prom_split.date('2024-07-26','2024-07-27','2024-07-28','2024-07-29','2024-07-30','2024-07-31').time('11:').outlier() FROM /test/bucketsplit
  242. -- /**
  243. -- output()
  244. -- **/
  245. -- ;
  246. -- SELECT id, prom_split.date('2024-07-26').unit('avg') FROM /test/bucketsplit
  247. -- /**
  248. -- output()
  249. -- **/
  250. -- ;
  251. -- SELECT id, prom_split.date('2024-07-26','2024-07-27','2024-07-28','2024-07-29','2024-07-30','2024-07-31').sigma("count") FROM /test/bucketsplit
  252. -- /**
  253. -- output()
  254. -- **/
  255. -- ;
  256. -- SELECT id, prom_split.date('2024-07-26','2024-07-27','2024-07-28','2024-07-29','2024-07-30','2024-07-31').sigma("count", 1h) FROM /test/bucketsplit
  257. -- /**
  258. -- output()
  259. -- **/
  260. -- ;
  261. SELECT
  262. id, prom.time('2024-11-28 11:24:00', '2024-11-28 11:25:00').find(name='key1.key2.key3').sum()
  263. FROM
  264. /test/bucketpromdb where id='bucketpromdb:wecise11'
  265. /**
  266. output()
  267. matchcount(id, "bucketpromdb:wecise11", "prom.0.2", 2, 1)
  268. **/
  269. ;
  270. SELECT id, prom.date('2024-11-28').avg().sigma() FROM /test/bucketpromdb
  271. /**
  272. output()
  273. matchcount(id, "bucketpromdb:wecise11", "prom.0.2", 2.661111111111112, 1)
  274. matchcount(id, "bucketpromdb:wecise", "prom.0.5", 0.15630781478860528, 1)
  275. **/
  276. ;