window_rule_test.go 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197
  1. package processors
  2. import (
  3. "github.com/emqx/kuiper/xstream/api"
  4. "testing"
  5. )
  6. func TestWindow(t *testing.T) {
  7. //Reset
  8. streamList := []string{"demo", "demoError", "demo1", "sessionDemo"}
  9. handleStream(false, streamList, t)
  10. var tests = []ruleTest{
  11. {
  12. name: `TestWindowRule1`,
  13. sql: `SELECT * FROM demo GROUP BY HOPPINGWINDOW(ss, 2, 1)`,
  14. r: [][]map[string]interface{}{
  15. {{
  16. "color": "red",
  17. "size": float64(3),
  18. "ts": float64(1541152486013),
  19. }, {
  20. "color": "blue",
  21. "size": float64(6),
  22. "ts": float64(1541152486822),
  23. }},
  24. {{
  25. "color": "red",
  26. "size": float64(3),
  27. "ts": float64(1541152486013),
  28. }, {
  29. "color": "blue",
  30. "size": float64(6),
  31. "ts": float64(1541152486822),
  32. }, {
  33. "color": "blue",
  34. "size": float64(2),
  35. "ts": float64(1541152487632),
  36. }},
  37. {{
  38. "color": "blue",
  39. "size": float64(2),
  40. "ts": float64(1541152487632),
  41. }, {
  42. "color": "yellow",
  43. "size": float64(4),
  44. "ts": float64(1541152488442),
  45. }},
  46. {{
  47. "color": "yellow",
  48. "size": float64(4),
  49. "ts": float64(1541152488442),
  50. }, {
  51. "color": "red",
  52. "size": float64(1),
  53. "ts": float64(1541152489252),
  54. }},
  55. },
  56. m: map[string]interface{}{
  57. "op_preprocessor_demo_0_exceptions_total": int64(0),
  58. "op_preprocessor_demo_0_process_latency_ms": int64(0),
  59. "op_preprocessor_demo_0_records_in_total": int64(5),
  60. "op_preprocessor_demo_0_records_out_total": int64(5),
  61. "op_project_0_exceptions_total": int64(0),
  62. "op_project_0_process_latency_ms": int64(0),
  63. "op_project_0_records_in_total": int64(4),
  64. "op_project_0_records_out_total": int64(4),
  65. "sink_mockSink_0_exceptions_total": int64(0),
  66. "sink_mockSink_0_records_in_total": int64(4),
  67. "sink_mockSink_0_records_out_total": int64(4),
  68. "source_demo_0_exceptions_total": int64(0),
  69. "source_demo_0_records_in_total": int64(5),
  70. "source_demo_0_records_out_total": int64(5),
  71. "op_window_0_exceptions_total": int64(0),
  72. "op_window_0_process_latency_ms": int64(0),
  73. "op_window_0_records_in_total": int64(5),
  74. "op_window_0_records_out_total": int64(4),
  75. },
  76. }, {
  77. name: `TestWindowRule2`,
  78. sql: `SELECT color, ts FROM demo where size > 2 GROUP BY tumblingwindow(ss, 1)`,
  79. r: [][]map[string]interface{}{
  80. {{
  81. "color": "red",
  82. "ts": float64(1541152486013),
  83. }, {
  84. "color": "blue",
  85. "ts": float64(1541152486822),
  86. }},
  87. {{
  88. "color": "yellow",
  89. "ts": float64(1541152488442),
  90. }},
  91. },
  92. m: map[string]interface{}{
  93. "op_preprocessor_demo_0_exceptions_total": int64(0),
  94. "op_preprocessor_demo_0_process_latency_ms": int64(0),
  95. "op_preprocessor_demo_0_records_in_total": int64(5),
  96. "op_preprocessor_demo_0_records_out_total": int64(5),
  97. "op_project_0_exceptions_total": int64(0),
  98. "op_project_0_process_latency_ms": int64(0),
  99. "op_project_0_records_in_total": int64(2),
  100. "op_project_0_records_out_total": int64(2),
  101. "sink_mockSink_0_exceptions_total": int64(0),
  102. "sink_mockSink_0_records_in_total": int64(2),
  103. "sink_mockSink_0_records_out_total": int64(2),
  104. "source_demo_0_exceptions_total": int64(0),
  105. "source_demo_0_records_in_total": int64(5),
  106. "source_demo_0_records_out_total": int64(5),
  107. "op_window_0_exceptions_total": int64(0),
  108. "op_window_0_process_latency_ms": int64(0),
  109. "op_window_0_records_in_total": int64(5),
  110. "op_window_0_records_out_total": int64(4),
  111. "op_filter_0_exceptions_total": int64(0),
  112. "op_filter_0_process_latency_ms": int64(0),
  113. "op_filter_0_records_in_total": int64(4),
  114. "op_filter_0_records_out_total": int64(2),
  115. },
  116. }, {
  117. name: `TestWindowRule3`,
  118. sql: `SELECT color, temp, ts FROM demo INNER JOIN demo1 ON demo.ts = demo1.ts GROUP BY SlidingWindow(ss, 1)`,
  119. r: [][]map[string]interface{}{
  120. {{
  121. "color": "red",
  122. "temp": 25.5,
  123. "ts": float64(1541152486013),
  124. }}, {{
  125. "color": "red",
  126. "temp": 25.5,
  127. "ts": float64(1541152486013),
  128. }}, {{
  129. "color": "red",
  130. "temp": 25.5,
  131. "ts": float64(1541152486013),
  132. }}, {{
  133. "color": "blue",
  134. "temp": 28.1,
  135. "ts": float64(1541152487632),
  136. }}, {{
  137. "color": "blue",
  138. "temp": 28.1,
  139. "ts": float64(1541152487632),
  140. }}, {{
  141. "color": "blue",
  142. "temp": 28.1,
  143. "ts": float64(1541152487632),
  144. }, {
  145. "color": "yellow",
  146. "temp": 27.4,
  147. "ts": float64(1541152488442),
  148. }}, {{
  149. "color": "yellow",
  150. "temp": 27.4,
  151. "ts": float64(1541152488442),
  152. }}, {{
  153. "color": "yellow",
  154. "temp": 27.4,
  155. "ts": float64(1541152488442),
  156. }, {
  157. "color": "red",
  158. "temp": 25.5,
  159. "ts": float64(1541152489252),
  160. }},
  161. },
  162. m: map[string]interface{}{
  163. "op_preprocessor_demo_0_exceptions_total": int64(0),
  164. "op_preprocessor_demo_0_process_latency_ms": int64(0),
  165. "op_preprocessor_demo_0_records_in_total": int64(5),
  166. "op_preprocessor_demo_0_records_out_total": int64(5),
  167. "op_preprocessor_demo1_0_exceptions_total": int64(0),
  168. "op_preprocessor_demo1_0_process_latency_ms": int64(0),
  169. "op_preprocessor_demo1_0_records_in_total": int64(5),
  170. "op_preprocessor_demo1_0_records_out_total": int64(5),
  171. "op_project_0_exceptions_total": int64(0),
  172. "op_project_0_process_latency_ms": int64(0),
  173. "op_project_0_records_in_total": int64(8),
  174. "op_project_0_records_out_total": int64(8),
  175. "sink_mockSink_0_exceptions_total": int64(0),
  176. "sink_mockSink_0_records_in_total": int64(8),
  177. "sink_mockSink_0_records_out_total": int64(8),
  178. "source_demo_0_exceptions_total": int64(0),
  179. "source_demo_0_records_in_total": int64(5),
  180. "source_demo_0_records_out_total": int64(5),
  181. "source_demo1_0_exceptions_total": int64(0),
  182. "source_demo1_0_records_in_total": int64(5),
  183. "source_demo1_0_records_out_total": int64(5),
  184. "op_window_0_exceptions_total": int64(0),
  185. "op_window_0_process_latency_ms": int64(0),
  186. "op_window_0_records_in_total": int64(10),
  187. "op_window_0_records_out_total": int64(10),
  188. "op_join_0_exceptions_total": int64(0),
  189. "op_join_0_process_latency_ms": int64(0),
  190. "op_join_0_records_in_total": int64(10),
  191. "op_join_0_records_out_total": int64(8),
  192. },
  193. }, {
  194. name: `TestWindowRule4`,
  195. sql: `SELECT color FROM demo GROUP BY SlidingWindow(ss, 2), color ORDER BY color`,
  196. r: [][]map[string]interface{}{
  197. {{
  198. "color": "red",
  199. }}, {{
  200. "color": "blue",
  201. }, {
  202. "color": "red",
  203. }}, {{
  204. "color": "blue",
  205. }, {
  206. "color": "red",
  207. }}, {{
  208. "color": "blue",
  209. }, {
  210. "color": "yellow",
  211. }}, {{
  212. "color": "blue",
  213. }, {
  214. "color": "red",
  215. }, {
  216. "color": "yellow",
  217. }},
  218. },
  219. m: map[string]interface{}{
  220. "op_preprocessor_demo_0_exceptions_total": int64(0),
  221. "op_preprocessor_demo_0_process_latency_ms": int64(0),
  222. "op_preprocessor_demo_0_records_in_total": int64(5),
  223. "op_preprocessor_demo_0_records_out_total": int64(5),
  224. "op_project_0_exceptions_total": int64(0),
  225. "op_project_0_process_latency_ms": int64(0),
  226. "op_project_0_records_in_total": int64(5),
  227. "op_project_0_records_out_total": int64(5),
  228. "sink_mockSink_0_exceptions_total": int64(0),
  229. "sink_mockSink_0_records_in_total": int64(5),
  230. "sink_mockSink_0_records_out_total": int64(5),
  231. "source_demo_0_exceptions_total": int64(0),
  232. "source_demo_0_records_in_total": int64(5),
  233. "source_demo_0_records_out_total": int64(5),
  234. "op_window_0_exceptions_total": int64(0),
  235. "op_window_0_process_latency_ms": int64(0),
  236. "op_window_0_records_in_total": int64(5),
  237. "op_window_0_records_out_total": int64(5),
  238. "op_aggregate_0_exceptions_total": int64(0),
  239. "op_aggregate_0_process_latency_ms": int64(0),
  240. "op_aggregate_0_records_in_total": int64(5),
  241. "op_aggregate_0_records_out_total": int64(5),
  242. "op_order_0_exceptions_total": int64(0),
  243. "op_order_0_process_latency_ms": int64(0),
  244. "op_order_0_records_in_total": int64(5),
  245. "op_order_0_records_out_total": int64(5),
  246. },
  247. }, {
  248. name: `TestWindowRule5`,
  249. sql: `SELECT temp FROM sessionDemo GROUP BY SessionWindow(ss, 2, 1) `,
  250. r: [][]map[string]interface{}{
  251. {{
  252. "temp": 25.5,
  253. }, {
  254. "temp": 27.5,
  255. }}, {{
  256. "temp": 28.1,
  257. }, {
  258. "temp": 27.4,
  259. }, {
  260. "temp": 25.5,
  261. }}, {{
  262. "temp": 26.2,
  263. }, {
  264. "temp": 26.8,
  265. }, {
  266. "temp": 28.9,
  267. }, {
  268. "temp": 29.1,
  269. }, {
  270. "temp": 32.2,
  271. }}, {{
  272. "temp": 30.9,
  273. }},
  274. },
  275. m: map[string]interface{}{
  276. "op_preprocessor_sessionDemo_0_exceptions_total": int64(0),
  277. "op_preprocessor_sessionDemo_0_process_latency_ms": int64(0),
  278. "op_preprocessor_sessionDemo_0_records_in_total": int64(11),
  279. "op_preprocessor_sessionDemo_0_records_out_total": int64(11),
  280. "op_project_0_exceptions_total": int64(0),
  281. "op_project_0_process_latency_ms": int64(0),
  282. "op_project_0_records_in_total": int64(4),
  283. "op_project_0_records_out_total": int64(4),
  284. "sink_mockSink_0_exceptions_total": int64(0),
  285. "sink_mockSink_0_records_in_total": int64(4),
  286. "sink_mockSink_0_records_out_total": int64(4),
  287. "source_sessionDemo_0_exceptions_total": int64(0),
  288. "source_sessionDemo_0_records_in_total": int64(11),
  289. "source_sessionDemo_0_records_out_total": int64(11),
  290. "op_window_0_exceptions_total": int64(0),
  291. "op_window_0_process_latency_ms": int64(0),
  292. "op_window_0_records_in_total": int64(11),
  293. "op_window_0_records_out_total": int64(4),
  294. },
  295. }, {
  296. name: `TestWindowRule6`,
  297. sql: `SELECT max(temp) as m, count(color) as c FROM demo INNER JOIN demo1 ON demo.ts = demo1.ts GROUP BY SlidingWindow(ss, 1)`,
  298. r: [][]map[string]interface{}{
  299. {{
  300. "m": 25.5,
  301. "c": float64(1),
  302. }}, {{
  303. "m": 25.5,
  304. "c": float64(1),
  305. }}, {{
  306. "m": 25.5,
  307. "c": float64(1),
  308. }}, {{
  309. "m": 28.1,
  310. "c": float64(1),
  311. }}, {{
  312. "m": 28.1,
  313. "c": float64(1),
  314. }}, {{
  315. "m": 28.1,
  316. "c": float64(2),
  317. }}, {{
  318. "m": 27.4,
  319. "c": float64(1),
  320. }}, {{
  321. "m": 27.4,
  322. "c": float64(2),
  323. }},
  324. },
  325. m: map[string]interface{}{
  326. "op_preprocessor_demo_0_exceptions_total": int64(0),
  327. "op_preprocessor_demo_0_process_latency_ms": int64(0),
  328. "op_preprocessor_demo_0_records_in_total": int64(5),
  329. "op_preprocessor_demo_0_records_out_total": int64(5),
  330. "op_preprocessor_demo1_0_exceptions_total": int64(0),
  331. "op_preprocessor_demo1_0_process_latency_ms": int64(0),
  332. "op_preprocessor_demo1_0_records_in_total": int64(5),
  333. "op_preprocessor_demo1_0_records_out_total": int64(5),
  334. "op_project_0_exceptions_total": int64(0),
  335. "op_project_0_process_latency_ms": int64(0),
  336. "op_project_0_records_in_total": int64(8),
  337. "op_project_0_records_out_total": int64(8),
  338. "sink_mockSink_0_exceptions_total": int64(0),
  339. "sink_mockSink_0_records_in_total": int64(8),
  340. "sink_mockSink_0_records_out_total": int64(8),
  341. "source_demo_0_exceptions_total": int64(0),
  342. "source_demo_0_records_in_total": int64(5),
  343. "source_demo_0_records_out_total": int64(5),
  344. "source_demo1_0_exceptions_total": int64(0),
  345. "source_demo1_0_records_in_total": int64(5),
  346. "source_demo1_0_records_out_total": int64(5),
  347. "op_window_0_exceptions_total": int64(0),
  348. "op_window_0_process_latency_ms": int64(0),
  349. "op_window_0_records_in_total": int64(10),
  350. "op_window_0_records_out_total": int64(10),
  351. "op_join_0_exceptions_total": int64(0),
  352. "op_join_0_process_latency_ms": int64(0),
  353. "op_join_0_records_in_total": int64(10),
  354. "op_join_0_records_out_total": int64(8),
  355. },
  356. }, {
  357. name: `TestWindowRule7`,
  358. sql: `SELECT * FROM demoError GROUP BY HOPPINGWINDOW(ss, 2, 1)`,
  359. r: [][]map[string]interface{}{
  360. {{
  361. "error": "error in preprocessor: invalid data type for color, expect string but found int(3)",
  362. }},
  363. {{
  364. "color": "blue",
  365. "size": float64(6),
  366. "ts": float64(1541152486822),
  367. }},
  368. {{
  369. "color": "blue",
  370. "size": float64(6),
  371. "ts": float64(1541152486822),
  372. }, {
  373. "color": "blue",
  374. "size": float64(2),
  375. "ts": float64(1541152487632),
  376. }},
  377. {{
  378. "error": "error in preprocessor: invalid data type for color, expect string but found int(7)",
  379. }},
  380. {{
  381. "color": "blue",
  382. "size": float64(2),
  383. "ts": float64(1541152487632),
  384. }},
  385. {{
  386. "error": "error in preprocessor: invalid data type for size, expect bigint but found string(blue)",
  387. }},
  388. },
  389. m: map[string]interface{}{
  390. "op_preprocessor_demoError_0_exceptions_total": int64(3),
  391. "op_preprocessor_demoError_0_process_latency_ms": int64(0),
  392. "op_preprocessor_demoError_0_records_in_total": int64(5),
  393. "op_preprocessor_demoError_0_records_out_total": int64(2),
  394. "op_project_0_exceptions_total": int64(3),
  395. "op_project_0_process_latency_ms": int64(0),
  396. "op_project_0_records_in_total": int64(6),
  397. "op_project_0_records_out_total": int64(3),
  398. "sink_mockSink_0_exceptions_total": int64(0),
  399. "sink_mockSink_0_records_in_total": int64(6),
  400. "sink_mockSink_0_records_out_total": int64(6),
  401. "source_demoError_0_exceptions_total": int64(0),
  402. "source_demoError_0_records_in_total": int64(5),
  403. "source_demoError_0_records_out_total": int64(5),
  404. "op_window_0_exceptions_total": int64(3),
  405. "op_window_0_process_latency_ms": int64(0),
  406. "op_window_0_records_in_total": int64(5),
  407. "op_window_0_records_out_total": int64(3),
  408. },
  409. }, {
  410. name: `TestWindowRule8`,
  411. sql: `SELECT color, ts, count(*) as c FROM demo where size > 2 GROUP BY tumblingwindow(ss, 1) having c > 1`,
  412. r: [][]map[string]interface{}{
  413. {{
  414. "color": "red",
  415. "ts": float64(1541152486013),
  416. "c": float64(2),
  417. }},
  418. },
  419. m: map[string]interface{}{
  420. "op_preprocessor_demo_0_exceptions_total": int64(0),
  421. "op_preprocessor_demo_0_process_latency_ms": int64(0),
  422. "op_preprocessor_demo_0_records_in_total": int64(5),
  423. "op_preprocessor_demo_0_records_out_total": int64(5),
  424. "op_project_0_exceptions_total": int64(0),
  425. "op_project_0_process_latency_ms": int64(0),
  426. "op_project_0_records_in_total": int64(1),
  427. "op_project_0_records_out_total": int64(1),
  428. "sink_mockSink_0_exceptions_total": int64(0),
  429. "sink_mockSink_0_records_in_total": int64(1),
  430. "sink_mockSink_0_records_out_total": int64(1),
  431. "source_demo_0_exceptions_total": int64(0),
  432. "source_demo_0_records_in_total": int64(5),
  433. "source_demo_0_records_out_total": int64(5),
  434. "op_window_0_exceptions_total": int64(0),
  435. "op_window_0_process_latency_ms": int64(0),
  436. "op_window_0_records_in_total": int64(5),
  437. "op_window_0_records_out_total": int64(4),
  438. "op_filter_0_exceptions_total": int64(0),
  439. "op_filter_0_process_latency_ms": int64(0),
  440. "op_filter_0_records_in_total": int64(4),
  441. "op_filter_0_records_out_total": int64(2),
  442. "op_aggregate_0_exceptions_total": int64(0),
  443. "op_aggregate_0_process_latency_ms": int64(0),
  444. "op_aggregate_0_records_in_total": int64(2),
  445. "op_aggregate_0_records_out_total": int64(2),
  446. "op_having_0_exceptions_total": int64(0),
  447. "op_having_0_process_latency_ms": int64(0),
  448. "op_having_0_records_in_total": int64(2),
  449. "op_having_0_records_out_total": int64(1),
  450. },
  451. },
  452. }
  453. handleStream(true, streamList, t)
  454. options := []*api.RuleOption{
  455. {
  456. BufferLength: 100,
  457. }, {
  458. BufferLength: 100,
  459. Qos: api.AtLeastOnce,
  460. CheckpointInterval: 5000,
  461. }, {
  462. BufferLength: 100,
  463. Qos: api.ExactlyOnce,
  464. CheckpointInterval: 5000,
  465. },
  466. }
  467. for j, opt := range options {
  468. doRuleTest(t, tests, j, opt)
  469. }
  470. }
  471. func TestEventWindow(t *testing.T) {
  472. //Reset
  473. streamList := []string{"demoE", "demoErr", "demo1E", "sessionDemoE"}
  474. handleStream(false, streamList, t)
  475. var tests = []ruleTest{
  476. {
  477. name: `TestEventWindowRule1`,
  478. sql: `SELECT * FROM demoE GROUP BY HOPPINGWINDOW(ss, 2, 1)`,
  479. r: [][]map[string]interface{}{
  480. {{
  481. "color": "red",
  482. "size": float64(3),
  483. "ts": float64(1541152486013),
  484. }},
  485. {{
  486. "color": "red",
  487. "size": float64(3),
  488. "ts": float64(1541152486013),
  489. }, {
  490. "color": "blue",
  491. "size": float64(2),
  492. "ts": float64(1541152487632),
  493. }},
  494. {{
  495. "color": "blue",
  496. "size": float64(2),
  497. "ts": float64(1541152487632),
  498. }, {
  499. "color": "yellow",
  500. "size": float64(4),
  501. "ts": float64(1541152488442),
  502. }}, {{
  503. "color": "yellow",
  504. "size": float64(4),
  505. "ts": float64(1541152488442),
  506. }, {
  507. "color": "red",
  508. "size": float64(1),
  509. "ts": float64(1541152489252),
  510. }}, {{
  511. "color": "red",
  512. "size": float64(1),
  513. "ts": float64(1541152489252),
  514. }},
  515. },
  516. m: map[string]interface{}{
  517. "op_preprocessor_demoE_0_exceptions_total": int64(0),
  518. "op_preprocessor_demoE_0_process_latency_ms": int64(0),
  519. "op_preprocessor_demoE_0_records_in_total": int64(6),
  520. "op_preprocessor_demoE_0_records_out_total": int64(6),
  521. "op_project_0_exceptions_total": int64(0),
  522. "op_project_0_process_latency_ms": int64(0),
  523. "op_project_0_records_in_total": int64(5),
  524. "op_project_0_records_out_total": int64(5),
  525. "sink_mockSink_0_exceptions_total": int64(0),
  526. "sink_mockSink_0_records_in_total": int64(5),
  527. "sink_mockSink_0_records_out_total": int64(5),
  528. "source_demoE_0_exceptions_total": int64(0),
  529. "source_demoE_0_records_in_total": int64(6),
  530. "source_demoE_0_records_out_total": int64(6),
  531. "op_window_0_exceptions_total": int64(0),
  532. "op_window_0_process_latency_ms": int64(0),
  533. "op_window_0_records_in_total": int64(6),
  534. "op_window_0_records_out_total": int64(5),
  535. },
  536. }, {
  537. name: `TestEventWindowRule2`,
  538. sql: `SELECT color, ts FROM demoE where size > 2 GROUP BY tumblingwindow(ss, 1)`,
  539. r: [][]map[string]interface{}{
  540. {{
  541. "color": "red",
  542. "ts": float64(1541152486013),
  543. }},
  544. {{
  545. "color": "yellow",
  546. "ts": float64(1541152488442),
  547. }},
  548. },
  549. m: map[string]interface{}{
  550. "op_preprocessor_demoE_0_exceptions_total": int64(0),
  551. "op_preprocessor_demoE_0_process_latency_ms": int64(0),
  552. "op_preprocessor_demoE_0_records_in_total": int64(6),
  553. "op_preprocessor_demoE_0_records_out_total": int64(6),
  554. "op_project_0_exceptions_total": int64(0),
  555. "op_project_0_process_latency_ms": int64(0),
  556. "op_project_0_records_in_total": int64(2),
  557. "op_project_0_records_out_total": int64(2),
  558. "sink_mockSink_0_exceptions_total": int64(0),
  559. "sink_mockSink_0_records_in_total": int64(2),
  560. "sink_mockSink_0_records_out_total": int64(2),
  561. "source_demoE_0_exceptions_total": int64(0),
  562. "source_demoE_0_records_in_total": int64(6),
  563. "source_demoE_0_records_out_total": int64(6),
  564. "op_window_0_exceptions_total": int64(0),
  565. "op_window_0_process_latency_ms": int64(0),
  566. "op_window_0_records_in_total": int64(6),
  567. "op_window_0_records_out_total": int64(4),
  568. "op_filter_0_exceptions_total": int64(0),
  569. "op_filter_0_process_latency_ms": int64(0),
  570. "op_filter_0_records_in_total": int64(4),
  571. "op_filter_0_records_out_total": int64(2),
  572. },
  573. }, {
  574. name: `TestEventWindowRule3`,
  575. sql: `SELECT color, temp, ts FROM demoE INNER JOIN demo1E ON demoE.ts = demo1E.ts GROUP BY SlidingWindow(ss, 1)`,
  576. r: [][]map[string]interface{}{
  577. {{
  578. "color": "red",
  579. "temp": 25.5,
  580. "ts": float64(1541152486013),
  581. }}, {{
  582. "color": "red",
  583. "temp": 25.5,
  584. "ts": float64(1541152486013),
  585. }}, {{
  586. "color": "blue",
  587. "temp": 28.1,
  588. "ts": float64(1541152487632),
  589. }}, {{
  590. "color": "blue",
  591. "temp": 28.1,
  592. "ts": float64(1541152487632),
  593. }, {
  594. "color": "yellow",
  595. "temp": 27.4,
  596. "ts": float64(1541152488442),
  597. }}, {{
  598. "color": "yellow",
  599. "temp": 27.4,
  600. "ts": float64(1541152488442),
  601. }, {
  602. "color": "red",
  603. "temp": 25.5,
  604. "ts": float64(1541152489252),
  605. }},
  606. },
  607. m: map[string]interface{}{
  608. "op_preprocessor_demoE_0_exceptions_total": int64(0),
  609. "op_preprocessor_demoE_0_process_latency_ms": int64(0),
  610. "op_preprocessor_demoE_0_records_in_total": int64(6),
  611. "op_preprocessor_demoE_0_records_out_total": int64(6),
  612. "op_preprocessor_demo1E_0_exceptions_total": int64(0),
  613. "op_preprocessor_demo1E_0_process_latency_ms": int64(0),
  614. "op_preprocessor_demo1E_0_records_in_total": int64(6),
  615. "op_preprocessor_demo1E_0_records_out_total": int64(6),
  616. "op_project_0_exceptions_total": int64(0),
  617. "op_project_0_process_latency_ms": int64(0),
  618. "op_project_0_records_in_total": int64(5),
  619. "op_project_0_records_out_total": int64(5),
  620. "sink_mockSink_0_exceptions_total": int64(0),
  621. "sink_mockSink_0_records_in_total": int64(5),
  622. "sink_mockSink_0_records_out_total": int64(5),
  623. "source_demoE_0_exceptions_total": int64(0),
  624. "source_demoE_0_records_in_total": int64(6),
  625. "source_demoE_0_records_out_total": int64(6),
  626. "source_demo1E_0_exceptions_total": int64(0),
  627. "source_demo1E_0_records_in_total": int64(6),
  628. "source_demo1E_0_records_out_total": int64(6),
  629. "op_window_0_exceptions_total": int64(0),
  630. "op_window_0_process_latency_ms": int64(0),
  631. "op_window_0_records_in_total": int64(12),
  632. "op_window_0_records_out_total": int64(5),
  633. "op_join_0_exceptions_total": int64(0),
  634. "op_join_0_process_latency_ms": int64(0),
  635. "op_join_0_records_in_total": int64(5),
  636. "op_join_0_records_out_total": int64(5),
  637. },
  638. }, {
  639. name: `TestEventWindowRule4`,
  640. sql: `SELECT color FROM demoE GROUP BY SlidingWindow(ss, 2), color ORDER BY color`,
  641. r: [][]map[string]interface{}{
  642. {{
  643. "color": "red",
  644. }}, {{
  645. "color": "blue",
  646. }, {
  647. "color": "red",
  648. }}, {{
  649. "color": "blue",
  650. }, {
  651. "color": "yellow",
  652. }}, {{
  653. "color": "blue",
  654. }, {
  655. "color": "red",
  656. }, {
  657. "color": "yellow",
  658. }},
  659. },
  660. m: map[string]interface{}{
  661. "op_preprocessor_demoE_0_exceptions_total": int64(0),
  662. "op_preprocessor_demoE_0_process_latency_ms": int64(0),
  663. "op_preprocessor_demoE_0_records_in_total": int64(6),
  664. "op_preprocessor_demoE_0_records_out_total": int64(6),
  665. "op_project_0_exceptions_total": int64(0),
  666. "op_project_0_process_latency_ms": int64(0),
  667. "op_project_0_records_in_total": int64(4),
  668. "op_project_0_records_out_total": int64(4),
  669. "sink_mockSink_0_exceptions_total": int64(0),
  670. "sink_mockSink_0_records_in_total": int64(4),
  671. "sink_mockSink_0_records_out_total": int64(4),
  672. "source_demoE_0_exceptions_total": int64(0),
  673. "source_demoE_0_records_in_total": int64(6),
  674. "source_demoE_0_records_out_total": int64(6),
  675. "op_window_0_exceptions_total": int64(0),
  676. "op_window_0_process_latency_ms": int64(0),
  677. "op_window_0_records_in_total": int64(6),
  678. "op_window_0_records_out_total": int64(4),
  679. "op_aggregate_0_exceptions_total": int64(0),
  680. "op_aggregate_0_process_latency_ms": int64(0),
  681. "op_aggregate_0_records_in_total": int64(4),
  682. "op_aggregate_0_records_out_total": int64(4),
  683. "op_order_0_exceptions_total": int64(0),
  684. "op_order_0_process_latency_ms": int64(0),
  685. "op_order_0_records_in_total": int64(4),
  686. "op_order_0_records_out_total": int64(4),
  687. },
  688. }, {
  689. name: `TestEventWindowRule5`,
  690. sql: `SELECT temp FROM sessionDemoE GROUP BY SessionWindow(ss, 2, 1) `,
  691. r: [][]map[string]interface{}{
  692. {{
  693. "temp": 25.5,
  694. }}, {{
  695. "temp": 28.1,
  696. }, {
  697. "temp": 27.4,
  698. }, {
  699. "temp": 25.5,
  700. }}, {{
  701. "temp": 26.2,
  702. }, {
  703. "temp": 26.8,
  704. }, {
  705. "temp": 28.9,
  706. }, {
  707. "temp": 29.1,
  708. }, {
  709. "temp": 32.2,
  710. }}, {{
  711. "temp": 30.9,
  712. }},
  713. },
  714. m: map[string]interface{}{
  715. "op_preprocessor_sessionDemoE_0_exceptions_total": int64(0),
  716. "op_preprocessor_sessionDemoE_0_process_latency_ms": int64(0),
  717. "op_preprocessor_sessionDemoE_0_records_in_total": int64(12),
  718. "op_preprocessor_sessionDemoE_0_records_out_total": int64(12),
  719. "op_project_0_exceptions_total": int64(0),
  720. "op_project_0_process_latency_ms": int64(0),
  721. "op_project_0_records_in_total": int64(4),
  722. "op_project_0_records_out_total": int64(4),
  723. "sink_mockSink_0_exceptions_total": int64(0),
  724. "sink_mockSink_0_records_in_total": int64(4),
  725. "sink_mockSink_0_records_out_total": int64(4),
  726. "source_sessionDemoE_0_exceptions_total": int64(0),
  727. "source_sessionDemoE_0_records_in_total": int64(12),
  728. "source_sessionDemoE_0_records_out_total": int64(12),
  729. "op_window_0_exceptions_total": int64(0),
  730. "op_window_0_process_latency_ms": int64(0),
  731. "op_window_0_records_in_total": int64(12),
  732. "op_window_0_records_out_total": int64(4),
  733. },
  734. }, {
  735. name: `TestEventWindowRule6`,
  736. sql: `SELECT max(temp) as m, count(color) as c FROM demoE INNER JOIN demo1E ON demoE.ts = demo1E.ts GROUP BY SlidingWindow(ss, 1)`,
  737. r: [][]map[string]interface{}{
  738. {{
  739. "m": 25.5,
  740. "c": float64(1),
  741. }}, {{
  742. "m": 25.5,
  743. "c": float64(1),
  744. }}, {{
  745. "m": 28.1,
  746. "c": float64(1),
  747. }}, {{
  748. "m": 28.1,
  749. "c": float64(2),
  750. }}, {{
  751. "m": 27.4,
  752. "c": float64(2),
  753. }},
  754. },
  755. m: map[string]interface{}{
  756. "op_preprocessor_demoE_0_exceptions_total": int64(0),
  757. "op_preprocessor_demoE_0_process_latency_ms": int64(0),
  758. "op_preprocessor_demoE_0_records_in_total": int64(6),
  759. "op_preprocessor_demoE_0_records_out_total": int64(6),
  760. "op_preprocessor_demo1E_0_exceptions_total": int64(0),
  761. "op_preprocessor_demo1E_0_process_latency_ms": int64(0),
  762. "op_preprocessor_demo1E_0_records_in_total": int64(6),
  763. "op_preprocessor_demo1E_0_records_out_total": int64(6),
  764. "op_project_0_exceptions_total": int64(0),
  765. "op_project_0_process_latency_ms": int64(0),
  766. "op_project_0_records_in_total": int64(5),
  767. "op_project_0_records_out_total": int64(5),
  768. "sink_mockSink_0_exceptions_total": int64(0),
  769. "sink_mockSink_0_records_in_total": int64(5),
  770. "sink_mockSink_0_records_out_total": int64(5),
  771. "source_demoE_0_exceptions_total": int64(0),
  772. "source_demoE_0_records_in_total": int64(6),
  773. "source_demoE_0_records_out_total": int64(6),
  774. "source_demo1E_0_exceptions_total": int64(0),
  775. "source_demo1E_0_records_in_total": int64(6),
  776. "source_demo1E_0_records_out_total": int64(6),
  777. "op_window_0_exceptions_total": int64(0),
  778. "op_window_0_records_in_total": int64(12),
  779. "op_window_0_records_out_total": int64(5),
  780. "op_join_0_exceptions_total": int64(0),
  781. "op_join_0_process_latency_ms": int64(0),
  782. "op_join_0_records_in_total": int64(5),
  783. "op_join_0_records_out_total": int64(5),
  784. },
  785. }, {
  786. name: `TestEventWindowRule7`,
  787. sql: `SELECT * FROM demoErr GROUP BY HOPPINGWINDOW(ss, 2, 1)`,
  788. r: [][]map[string]interface{}{
  789. {{
  790. "error": "error in preprocessor: invalid data type for color, expect string but found int(2)",
  791. }},
  792. {{
  793. "color": "red",
  794. "size": float64(3),
  795. "ts": float64(1541152486013),
  796. }},
  797. {{
  798. "color": "red",
  799. "size": float64(3),
  800. "ts": float64(1541152486013),
  801. }},
  802. {{
  803. "color": "yellow",
  804. "size": float64(4),
  805. "ts": float64(1541152488442),
  806. }}, {{
  807. "color": "yellow",
  808. "size": float64(4),
  809. "ts": float64(1541152488442),
  810. }, {
  811. "color": "red",
  812. "size": float64(1),
  813. "ts": float64(1541152489252),
  814. }}, {{
  815. "color": "red",
  816. "size": float64(1),
  817. "ts": float64(1541152489252),
  818. }},
  819. },
  820. m: map[string]interface{}{
  821. "op_preprocessor_demoErr_0_exceptions_total": int64(1),
  822. "op_preprocessor_demoErr_0_process_latency_ms": int64(0),
  823. "op_preprocessor_demoErr_0_records_in_total": int64(6),
  824. "op_preprocessor_demoErr_0_records_out_total": int64(5),
  825. "op_project_0_exceptions_total": int64(1),
  826. "op_project_0_process_latency_ms": int64(0),
  827. "op_project_0_records_in_total": int64(6),
  828. "op_project_0_records_out_total": int64(5),
  829. "sink_mockSink_0_exceptions_total": int64(0),
  830. "sink_mockSink_0_records_in_total": int64(6),
  831. "sink_mockSink_0_records_out_total": int64(6),
  832. "source_demoErr_0_exceptions_total": int64(0),
  833. "source_demoErr_0_records_in_total": int64(6),
  834. "source_demoErr_0_records_out_total": int64(6),
  835. "op_window_0_exceptions_total": int64(1),
  836. "op_window_0_process_latency_ms": int64(0),
  837. "op_window_0_records_in_total": int64(6),
  838. "op_window_0_records_out_total": int64(5),
  839. },
  840. },
  841. }
  842. handleStream(true, streamList, t)
  843. options := []*api.RuleOption{
  844. {
  845. BufferLength: 100,
  846. IsEventTime: true,
  847. LateTol: 1000,
  848. }, {
  849. BufferLength: 100,
  850. Qos: api.AtLeastOnce,
  851. CheckpointInterval: 5000,
  852. IsEventTime: true,
  853. LateTol: 1000,
  854. }, {
  855. BufferLength: 100,
  856. Qos: api.ExactlyOnce,
  857. CheckpointInterval: 5000,
  858. IsEventTime: true,
  859. LateTol: 1000,
  860. },
  861. }
  862. for j, opt := range options {
  863. doRuleTest(t, tests, j, opt)
  864. }
  865. }
  866. func TestWindowError(t *testing.T) {
  867. //Reset
  868. streamList := []string{"ldemo", "ldemo1"}
  869. handleStream(false, streamList, t)
  870. var tests = []ruleTest{
  871. {
  872. name: `TestWindowErrorRule1`,
  873. sql: `SELECT size * 3 FROM ldemo GROUP BY TUMBLINGWINDOW(ss, 2)`,
  874. r: [][]map[string]interface{}{
  875. {{
  876. "error": "run Select error: invalid operation string(string) * int64(3)",
  877. }}, {{
  878. "rengine_field_0": float64(6),
  879. }, {}},
  880. },
  881. m: map[string]interface{}{
  882. "op_preprocessor_ldemo_0_exceptions_total": int64(0),
  883. "op_preprocessor_ldemo_0_process_latency_ms": int64(0),
  884. "op_preprocessor_ldemo_0_records_in_total": int64(5),
  885. "op_preprocessor_ldemo_0_records_out_total": int64(5),
  886. "op_project_0_exceptions_total": int64(1),
  887. "op_project_0_process_latency_ms": int64(0),
  888. "op_project_0_records_in_total": int64(2),
  889. "op_project_0_records_out_total": int64(1),
  890. "sink_mockSink_0_exceptions_total": int64(0),
  891. "sink_mockSink_0_records_in_total": int64(2),
  892. "sink_mockSink_0_records_out_total": int64(2),
  893. "source_ldemo_0_exceptions_total": int64(0),
  894. "source_ldemo_0_records_in_total": int64(5),
  895. "source_ldemo_0_records_out_total": int64(5),
  896. "op_window_0_exceptions_total": int64(0),
  897. "op_window_0_process_latency_ms": int64(0),
  898. "op_window_0_records_in_total": int64(5),
  899. "op_window_0_records_out_total": int64(2),
  900. },
  901. }, {
  902. name: `TestWindowErrorRule2`,
  903. sql: `SELECT color, ts FROM ldemo where size > 2 GROUP BY tumblingwindow(ss, 1)`,
  904. r: [][]map[string]interface{}{
  905. {{
  906. "error": "run Where error: invalid operation string(string) > int64(2)",
  907. }}, {{
  908. "ts": float64(1541152487632),
  909. }},
  910. },
  911. m: map[string]interface{}{
  912. "op_preprocessor_ldemo_0_exceptions_total": int64(0),
  913. "op_preprocessor_ldemo_0_process_latency_ms": int64(0),
  914. "op_preprocessor_ldemo_0_records_in_total": int64(5),
  915. "op_preprocessor_ldemo_0_records_out_total": int64(5),
  916. "op_project_0_exceptions_total": int64(1),
  917. "op_project_0_process_latency_ms": int64(0),
  918. "op_project_0_records_in_total": int64(2),
  919. "op_project_0_records_out_total": int64(1),
  920. "sink_mockSink_0_exceptions_total": int64(0),
  921. "sink_mockSink_0_records_in_total": int64(2),
  922. "sink_mockSink_0_records_out_total": int64(2),
  923. "source_ldemo_0_exceptions_total": int64(0),
  924. "source_ldemo_0_records_in_total": int64(5),
  925. "source_ldemo_0_records_out_total": int64(5),
  926. "op_window_0_exceptions_total": int64(0),
  927. "op_window_0_process_latency_ms": int64(0),
  928. "op_window_0_records_in_total": int64(5),
  929. "op_window_0_records_out_total": int64(4),
  930. "op_filter_0_exceptions_total": int64(1),
  931. "op_filter_0_process_latency_ms": int64(0),
  932. "op_filter_0_records_in_total": int64(4),
  933. "op_filter_0_records_out_total": int64(1),
  934. },
  935. }, {
  936. name: `TestWindowErrorRule3`,
  937. sql: `SELECT color, temp, ts FROM ldemo INNER JOIN ldemo1 ON ldemo.ts = ldemo1.ts GROUP BY SlidingWindow(ss, 1)`,
  938. r: [][]map[string]interface{}{
  939. {{
  940. "color": "red",
  941. "temp": 25.5,
  942. "ts": float64(1541152486013),
  943. }}, {{
  944. "color": "red",
  945. "temp": 25.5,
  946. "ts": float64(1541152486013),
  947. }}, {{
  948. "color": "red",
  949. "temp": 25.5,
  950. "ts": float64(1541152486013),
  951. }}, {{
  952. "temp": 28.1,
  953. "ts": float64(1541152487632),
  954. }}, {{
  955. "temp": 28.1,
  956. "ts": float64(1541152487632),
  957. }}, {{
  958. "error": "run Join error: invalid operation int64(1541152487632) = string(1541152488442)",
  959. }}, {{
  960. "error": "run Join error: invalid operation int64(1541152488442) = string(1541152488442)",
  961. }}, {{
  962. "error": "run Join error: invalid operation int64(1541152488442) = string(1541152488442)",
  963. }},
  964. },
  965. m: map[string]interface{}{
  966. "op_preprocessor_ldemo_0_exceptions_total": int64(0),
  967. "op_preprocessor_ldemo_0_process_latency_ms": int64(0),
  968. "op_preprocessor_ldemo_0_records_in_total": int64(5),
  969. "op_preprocessor_ldemo_0_records_out_total": int64(5),
  970. "op_preprocessor_ldemo1_0_exceptions_total": int64(0),
  971. "op_preprocessor_ldemo1_0_process_latency_ms": int64(0),
  972. "op_preprocessor_ldemo1_0_records_in_total": int64(5),
  973. "op_preprocessor_ldemo1_0_records_out_total": int64(5),
  974. "op_project_0_exceptions_total": int64(3),
  975. "op_project_0_process_latency_ms": int64(0),
  976. "op_project_0_records_in_total": int64(8),
  977. "op_project_0_records_out_total": int64(5),
  978. "sink_mockSink_0_exceptions_total": int64(0),
  979. "sink_mockSink_0_records_in_total": int64(8),
  980. "sink_mockSink_0_records_out_total": int64(8),
  981. "source_ldemo_0_exceptions_total": int64(0),
  982. "source_ldemo_0_records_in_total": int64(5),
  983. "source_ldemo_0_records_out_total": int64(5),
  984. "source_ldemo1_0_exceptions_total": int64(0),
  985. "source_ldemo1_0_records_in_total": int64(5),
  986. "source_ldemo1_0_records_out_total": int64(5),
  987. "op_window_0_exceptions_total": int64(0),
  988. "op_window_0_process_latency_ms": int64(0),
  989. "op_window_0_records_in_total": int64(10),
  990. "op_window_0_records_out_total": int64(10),
  991. "op_join_0_exceptions_total": int64(3),
  992. "op_join_0_process_latency_ms": int64(0),
  993. "op_join_0_records_in_total": int64(10),
  994. "op_join_0_records_out_total": int64(5),
  995. },
  996. }, {
  997. name: `TestWindowErrorRule4`,
  998. sql: `SELECT color FROM ldemo GROUP BY SlidingWindow(ss, 2), color having size >= 2 order by color`,
  999. r: [][]map[string]interface{}{
  1000. {{
  1001. "color": "red",
  1002. }}, {{
  1003. "error": "run Having error: invalid operation string(string) >= int64(2)",
  1004. }}, {{
  1005. "error": "run Having error: invalid operation string(string) >= int64(2)",
  1006. }}, {{
  1007. "error": "run Having error: invalid operation string(string) >= int64(2)",
  1008. }}, {{
  1009. "color": float64(49),
  1010. }, {}},
  1011. },
  1012. m: map[string]interface{}{
  1013. "op_preprocessor_ldemo_0_exceptions_total": int64(0),
  1014. "op_preprocessor_ldemo_0_process_latency_ms": int64(0),
  1015. "op_preprocessor_ldemo_0_records_in_total": int64(5),
  1016. "op_preprocessor_ldemo_0_records_out_total": int64(5),
  1017. "op_project_0_exceptions_total": int64(3),
  1018. "op_project_0_process_latency_ms": int64(0),
  1019. "op_project_0_records_in_total": int64(5),
  1020. "op_project_0_records_out_total": int64(2),
  1021. "sink_mockSink_0_exceptions_total": int64(0),
  1022. "sink_mockSink_0_records_in_total": int64(5),
  1023. "sink_mockSink_0_records_out_total": int64(5),
  1024. "source_ldemo_0_exceptions_total": int64(0),
  1025. "source_ldemo_0_records_in_total": int64(5),
  1026. "source_ldemo_0_records_out_total": int64(5),
  1027. "op_window_0_exceptions_total": int64(0),
  1028. "op_window_0_process_latency_ms": int64(0),
  1029. "op_window_0_records_in_total": int64(5),
  1030. "op_window_0_records_out_total": int64(5),
  1031. "op_aggregate_0_exceptions_total": int64(0),
  1032. "op_aggregate_0_process_latency_ms": int64(0),
  1033. "op_aggregate_0_records_in_total": int64(5),
  1034. "op_aggregate_0_records_out_total": int64(5),
  1035. "op_having_0_exceptions_total": int64(3),
  1036. "op_having_0_process_latency_ms": int64(0),
  1037. "op_having_0_records_in_total": int64(5),
  1038. "op_having_0_records_out_total": int64(2),
  1039. },
  1040. }, {
  1041. name: `TestWindowErrorRule5`,
  1042. sql: `SELECT color, size FROM ldemo GROUP BY tumblingwindow(ss, 1) ORDER BY size`,
  1043. r: [][]map[string]interface{}{
  1044. {{
  1045. "error": "run Order By error: incompatible types for comparison: int and string",
  1046. }}, {{
  1047. "size": float64(3),
  1048. }}, {{
  1049. "color": float64(49),
  1050. "size": float64(2),
  1051. }}, {{
  1052. "color": "red",
  1053. }},
  1054. },
  1055. m: map[string]interface{}{
  1056. "op_preprocessor_ldemo_0_exceptions_total": int64(0),
  1057. "op_preprocessor_ldemo_0_process_latency_ms": int64(0),
  1058. "op_preprocessor_ldemo_0_records_in_total": int64(5),
  1059. "op_preprocessor_ldemo_0_records_out_total": int64(5),
  1060. "op_project_0_exceptions_total": int64(1),
  1061. "op_project_0_process_latency_ms": int64(0),
  1062. "op_project_0_records_in_total": int64(4),
  1063. "op_project_0_records_out_total": int64(3),
  1064. "sink_mockSink_0_exceptions_total": int64(0),
  1065. "sink_mockSink_0_records_in_total": int64(4),
  1066. "sink_mockSink_0_records_out_total": int64(4),
  1067. "source_ldemo_0_exceptions_total": int64(0),
  1068. "source_ldemo_0_records_in_total": int64(5),
  1069. "source_ldemo_0_records_out_total": int64(5),
  1070. "op_window_0_exceptions_total": int64(0),
  1071. "op_window_0_process_latency_ms": int64(0),
  1072. "op_window_0_records_in_total": int64(5),
  1073. "op_window_0_records_out_total": int64(4),
  1074. "op_order_0_exceptions_total": int64(1),
  1075. "op_order_0_process_latency_ms": int64(0),
  1076. "op_order_0_records_in_total": int64(4),
  1077. "op_order_0_records_out_total": int64(3),
  1078. },
  1079. },
  1080. }
  1081. handleStream(true, streamList, t)
  1082. doRuleTest(t, tests, 0, &api.RuleOption{
  1083. BufferLength: 100,
  1084. })
  1085. }