1[
2    {
3        "testcase": "PushDowns: Group, 1-step aggregation. Explain",
4        "ignore": "index_id",
5        "explain": {
6            "disabled": false,
7            "results": [
8                {
9                    "present": true
10                }
11            ],
12            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND (v.index_group_aggs.partial IS MISSING OR v.`index` = 'ixgatp') END"
13        },
14        "statements": "SELECT c0, c1, c2 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0, c1, c2",
15        "results": [
16            {
17                "c2": 100,
18                "c1": 10,
19                "c0": 1
20            },
21            {
22                "c2": 600,
23                "c1": 10,
24                "c0": 1
25            },
26            {
27                "c2": 200,
28                "c1": 20,
29                "c0": 1
30            },
31            {
32                "c2": 700,
33                "c1": 20,
34                "c0": 1
35            },
36            {
37                "c2": 300,
38                "c1": 30,
39                "c0": 1
40            },
41            {
42                "c2": 800,
43                "c1": 30,
44                "c0": 1
45            },
46            {
47                "c2": 400,
48                "c1": 40,
49                "c0": 1
50            },
51            {
52                "c2": 900,
53                "c1": 40,
54                "c0": 1
55            },
56            {
57                "c2": 500,
58                "c1": 50,
59                "c0": 1
60            },
61            {
62                "c2": 901,
63                "c1": 50,
64                "c0": 1
65            },
66            {
67                "c2": 110,
68                "c1": 11,
69                "c0": 2
70            },
71            {
72                "c2": 610,
73                "c1": 11,
74                "c0": 2
75            },
76            {
77                "c2": 210,
78                "c1": 21,
79                "c0": 2
80            },
81            {
82                "c2": 710,
83                "c1": 21,
84                "c0": 2
85            },
86            {
87                "c2": 310,
88                "c1": 31,
89                "c0": 2
90            },
91            {
92                "c2": 810,
93                "c1": 31,
94                "c0": 2
95            },
96            {
97                "c2": 410,
98                "c1": 41,
99                "c0": 2
100            },
101            {
102                "c2": 910,
103                "c1": 41,
104                "c0": 2
105            },
106            {
107                "c2": 510,
108                "c1": 51,
109                "c0": 2
110            },
111            {
112                "c2": 911,
113                "c1": 51,
114                "c0": 2
115            }
116        ]
117    },
118    {
119        "testcase": "PushDowns: Group, 1-step aggregation, ORDER, OFFSET, LIMIT. Explain",
120        "ignore": "index_id",
121        "explain": {
122            "disabled": false,
123            "results": [
124                {
125                    "present": true
126                }
127            ],
128            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND ((v.index_group_aggs.partial IS MISSING AND v.index_order IS NOT MISSING AND v.`limit` IS NOT MISSING AND v.`offset` IS NOT MISSING) OR v.`index` = 'ixgatp') END"
129        },
130        "statements": "SELECT c0, c1, c2 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0, c1, c2 ORDER BY c0,c1,c2 OFFSET 1 LIMIT 2",
131        "ordered": true,
132        "results": [
133            {
134                "c2": 600,
135                "c1": 10,
136                "c0": 1
137            },
138            {
139                "c2": 200,
140                "c1": 20,
141                "c0": 1
142            }
143        ]
144    },
145    {
146        "testcase": "PushDowns: Group, 2-step aggregation, Group Expression. Explain",
147        "ignore": "index_id",
148        "explain": {
149            "disabled": false,
150            "results": [
151                {
152                    "present": true
153                }
154            ],
155            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND v.index_group_aggs.partial IS NOT MISSING END"
156        },
157        "statements": "SELECT c0, c1+c2 AS c1plusc2 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0, c1+c2",
158        "results": [
159            {
160                "c0": 2,
161                "c1plusc2": 951
162            },
163            {
164                "c0": 2,
165                "c1plusc2": 231
166            },
167            {
168                "c0": 2,
169                "c1plusc2": 341
170            },
171            {
172                "c0": 2,
173                "c1plusc2": 451
174            },
175            {
176                "c0": 2,
177                "c1plusc2": 621
178            },
179            {
180                "c0": 2,
181                "c1plusc2": 962
182            },
183            {
184                "c0": 1,
185                "c1plusc2": 110
186            },
187            {
188                "c0": 1,
189                "c1plusc2": 220
190            },
191            {
192                "c0": 1,
193                "c1plusc2": 330
194            },
195            {
196                "c0": 1,
197                "c1plusc2": 550
198            },
199            {
200                "c0": 1,
201                "c1plusc2": 610
202            },
203            {
204                "c0": 2,
205                "c1plusc2": 561
206            },
207            {
208                "c0": 2,
209                "c1plusc2": 731
210            },
211            {
212                "c0": 2,
213                "c1plusc2": 121
214            },
215            {
216                "c0": 1,
217                "c1plusc2": 720
218            },
219            {
220                "c0": 1,
221                "c1plusc2": 830
222            },
223            {
224                "c0": 1,
225                "c1plusc2": 940
226            },
227            {
228                "c0": 1,
229                "c1plusc2": 440
230            },
231            {
232                "c0": 2,
233                "c1plusc2": 841
234            },
235            {
236                "c0": 1,
237                "c1plusc2": 951
238            }
239        ]
240    },
241    {
242        "testcase": "PushDowns: Group, 2-step aggregation, Group Expression. No-PushDowns: Order, LIMIT, OFFSET. Explain",
243        "ignore": "index_id",
244        "explain": {
245            "disabled": false,
246            "results": [
247                {
248                    "present": true
249                }
250            ],
251            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND v.index_group_aggs.partial IS NOT MISSING AND v.index_order IS MISSING AND v.`limit` IS MISSING AND v.`offset` IS MISSING END"
252        },
253        "statements": "SELECT c0, c1+c2 AS c1plusc2 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0, c1+c2 ORDER BY c0, c1+c2 OFFSET 1 LIMIT 2",
254        "ordered": true,
255        "results": [
256            {
257                "c0": 1,
258                "c1plusc2": 220
259            },
260            {
261                "c0": 1,
262                "c1plusc2": 330
263            }
264        ]
265    },
266    {
267        "testcase": "PushDowns: Aggregates, 1-step aggregation",
268        "ignore": "index_id",
269        "explain": {
270            "disabled": false,
271            "results": [
272                {
273                    "present": true
274                }
275            ],
276            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND (v.index_group_aggs.partial IS MISSING OR v.`index` IN ['ixgap100','ixgatp']) END"
277        },
278        "statements": "SELECT SUM(c0) AS sumc0 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric')",
279        "results": [
280            {
281                "sumc0": 60
282            }
283        ]
284    },
285    {
286        "testcase": "PushDowns: Group, 1-step aggregation. Explain",
287        "ignore": "index_id",
288        "explain": {
289            "disabled": false,
290            "results": [
291                {
292                    "present": true
293                }
294            ],
295            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND (v.index_group_aggs.partial IS MISSING OR v.`index` IN ['ixgatp']) END"
296        },
297        "statements": "SELECT c0, SUM(c2) AS s FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0",
298        "results": [
299            {
300                "s": 10802,
301                "c0": 1
302            },
303            {
304                "s": 11002,
305                "c0": 2
306            }
307        ]
308    },
309    {
310        "testcase": "PushDowns: Group, 1-step aggregation, ORDER. Explain",
311        "ignore": "index_id",
312        "explain": {
313            "disabled": false,
314            "results": [
315                {
316                    "present": true
317                }
318            ],
319            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND ((v.index_group_aggs.partial IS MISSING AND v.index_order IS NOT MISSING) OR v.`index` = 'ixgatp') END"
320        },
321        "statements": "SELECT c0, SUM(c2) AS s FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0 ORDER BY c0",
322        "ordered": true,
323        "results": [
324            {
325                "s": 10802,
326                "c0": 1
327            },
328            {
329                "s": 11002,
330                "c0": 2
331            }
332        ]
333    },
334    {
335        "testcase": "PushDowns: Group, 1-step aggregation, ORDER, OFFSET, LIMIT. Explain",
336        "ignore": "index_id",
337        "explain": {
338            "disabled": false,
339            "results": [
340                {
341                    "present": true
342                }
343            ],
344            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND ((v.index_group_aggs.partial IS MISSING AND v.index_order IS NOT MISSING AND v.`offset` IS NOT MISSING AND v.`limit` IS NOT MISSING) OR v.`index` = 'ixgatp') END"
345        },
346        "statements": "SELECT c0, SUM(c2) AS s FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0 ORDER BY c0 OFFSET 1 LIMIT 2",
347        "ordered": true,
348        "results": [
349            {
350                "s": 11002,
351                "c0": 2
352            }
353        ]
354    },
355    {
356        "testcase": "PushDowns: Group, 2-step aggregation. Explain",
357        "ignore": "index_id",
358        "explain": {
359            "disabled": false,
360            "results": [
361                {
362                    "present": true
363                }
364            ],
365            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND v.index_group_aggs.partial IS NOT MISSING END"
366        },
367        "statements": "SELECT c0, c1+c2 AS c1plusc2, SUM(c2) AS sumc2 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0, c1+c2",
368        "results": [
369            {
370                "c0": 1,
371                "c1plusc2": 110,
372                "sumc2": 200
373            },
374            {
375                "c0": 2,
376                "c1plusc2": 341,
377                "sumc2": 620
378            },
379            {
380                "c0": 2,
381                "c1plusc2": 231,
382                "sumc2": 420
383            },
384            {
385                "c0": 2,
386                "c1plusc2": 731,
387                "sumc2": 1420
388            },
389            {
390                "c0": 1,
391                "c1plusc2": 440,
392                "sumc2": 800
393            },
394            {
395                "c0": 1,
396                "c1plusc2": 220,
397                "sumc2": 400
398            },
399            {
400                "c0": 1,
401                "c1plusc2": 940,
402                "sumc2": 1800
403            },
404            {
405                "c0": 2,
406                "c1plusc2": 121,
407                "sumc2": 220
408            },
409            {
410                "c0": 2,
411                "c1plusc2": 621,
412                "sumc2": 1220
413            },
414            {
415                "c0": 1,
416                "c1plusc2": 720,
417                "sumc2": 1400
418            },
419            {
420                "c0": 2,
421                "c1plusc2": 962,
422                "sumc2": 1822
423            },
424            {
425                "c0": 2,
426                "c1plusc2": 951,
427                "sumc2": 1820
428            },
429            {
430                "c0": 1,
431                "c1plusc2": 610,
432                "sumc2": 1200
433            },
434            {
435                "c0": 1,
436                "c1plusc2": 951,
437                "sumc2": 1802
438            },
439            {
440                "c0": 1,
441                "c1plusc2": 330,
442                "sumc2": 600
443            },
444            {
445                "c0": 1,
446                "c1plusc2": 830,
447                "sumc2": 1600
448            },
449            {
450                "c0": 2,
451                "c1plusc2": 561,
452                "sumc2": 1020
453            },
454            {
455                "c0": 2,
456                "c1plusc2": 451,
457                "sumc2": 820
458            },
459            {
460                "c0": 1,
461                "c1plusc2": 550,
462                "sumc2": 1000
463            },
464            {
465                "c0": 2,
466                "c1plusc2": 841,
467                "sumc2": 1620
468            }
469        ]
470    },
471    {
472        "testcase": "PushDowns: Group, 2-step aggregation. No-PushDowns: ORDER, OFFSET,LIMIT. Explain",
473        "ignore": "index_id",
474        "explain": {
475            "disabled": false,
476            "results": [
477                {
478                    "present": true
479                }
480            ],
481            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND v.index_group_aggs.partial IS NOT MISSING AND v.index_order IS MISSING AND v.`offset` IS MISSING AND v.`limit` IS MISSING END"
482        },
483        "statements": "SELECT c0, c1+c2 AS c1plusc2, SUM(c2) AS sumc2 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c0, c1+c2 ORDER BY c0, c1plusc2 OFFSET 1 LIMIT 2",
484        "ordered": true,
485        "results": [
486            {
487                "c0": 1,
488                "c1plusc2": 220,
489                "sumc2": 400
490            },
491            {
492                "c0": 1,
493                "c1plusc2": 330,
494                "sumc2": 600
495            }
496        ]
497    },
498    {
499        "testcase": "PushDowns: Group, 2-step aggregation. Explain",
500        "ignore": "index_id",
501        "explain": {
502            "disabled": false,
503            "results": [
504                {
505                    "present": true
506                }
507            ],
508            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND v.index_group_aggs.partial IS NOT MISSING END"
509        },
510        "statements": "SELECT c0, c1+c2 AS c1plusc2, MIN(META().id) AS minid , MAX(ABS(c2)) AS maxac2, MAX(c2) AS c2, MAX(c2) AS sc2, ABS(MAX(c2)) AS amaxc2 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c1+c2,c0",
511        "results": [
512            {
513                "c1plusc2": 841,
514                "amaxc2": 810,
515                "maxac2": 810,
516                "minid": "ga2007",
517                "c2": 810,
518                "c0": 2,
519                "sc2": 810
520            },
521            {
522                "c1plusc2": 951,
523                "amaxc2": 901,
524                "maxac2": 901,
525                "minid": "ga0009",
526                "c2": 901,
527                "c0": 1,
528                "sc2": 901
529            },
530            {
531                "c1plusc2": 621,
532                "amaxc2": 610,
533                "maxac2": 610,
534                "minid": "ga2005",
535                "c2": 610,
536                "c0": 2,
537                "sc2": 610
538            },
539            {
540                "c1plusc2": 830,
541                "amaxc2": 800,
542                "maxac2": 800,
543                "minid": "ga0007",
544                "c2": 800,
545                "c0": 1,
546                "sc2": 800
547            },
548            {
549                "c1plusc2": 231,
550                "amaxc2": 210,
551                "maxac2": 210,
552                "minid": "ga2001",
553                "c2": 210,
554                "c0": 2,
555                "sc2": 210
556            },
557            {
558                "c1plusc2": 451,
559                "amaxc2": 410,
560                "maxac2": 410,
561                "minid": "ga2003",
562                "c2": 410,
563                "c0": 2,
564                "sc2": 410
565            },
566            {
567                "c1plusc2": 720,
568                "amaxc2": 700,
569                "maxac2": 700,
570                "minid": "ga0006",
571                "c2": 700,
572                "c0": 1,
573                "sc2": 700
574            },
575            {
576                "c1plusc2": 610,
577                "amaxc2": 600,
578                "maxac2": 600,
579                "minid": "ga0005",
580                "c2": 600,
581                "c0": 1,
582                "sc2": 600
583            },
584            {
585                "c1plusc2": 962,
586                "amaxc2": 911,
587                "maxac2": 911,
588                "minid": "ga2009",
589                "c2": 911,
590                "c0": 2,
591                "sc2": 911
592            },
593            {
594                "c1plusc2": 550,
595                "amaxc2": 500,
596                "maxac2": 500,
597                "minid": "ga0004",
598                "c2": 500,
599                "c0": 1,
600                "sc2": 500
601            },
602            {
603                "c1plusc2": 110,
604                "amaxc2": 100,
605                "maxac2": 100,
606                "minid": "ga0000",
607                "c2": 100,
608                "c0": 1,
609                "sc2": 100
610            },
611            {
612                "c1plusc2": 341,
613                "amaxc2": 310,
614                "maxac2": 310,
615                "minid": "ga2002",
616                "c2": 310,
617                "c0": 2,
618                "sc2": 310
619            },
620            {
621                "c1plusc2": 951,
622                "amaxc2": 910,
623                "maxac2": 910,
624                "minid": "ga2008",
625                "c2": 910,
626                "c0": 2,
627                "sc2": 910
628            },
629            {
630                "c1plusc2": 220,
631                "amaxc2": 200,
632                "maxac2": 200,
633                "minid": "ga0001",
634                "c2": 200,
635                "c0": 1,
636                "sc2": 200
637            },
638            {
639                "c1plusc2": 440,
640                "amaxc2": 400,
641                "maxac2": 400,
642                "minid": "ga0003",
643                "c2": 400,
644                "c0": 1,
645                "sc2": 400
646            },
647            {
648                "c1plusc2": 940,
649                "amaxc2": 900,
650                "maxac2": 900,
651                "minid": "ga0008",
652                "c2": 900,
653                "c0": 1,
654                "sc2": 900
655            },
656            {
657                "c1plusc2": 121,
658                "amaxc2": 110,
659                "maxac2": 110,
660                "minid": "ga2000",
661                "c2": 110,
662                "c0": 2,
663                "sc2": 110
664            },
665            {
666                "c1plusc2": 561,
667                "amaxc2": 510,
668                "maxac2": 510,
669                "minid": "ga2004",
670                "c2": 510,
671                "c0": 2,
672                "sc2": 510
673            },
674            {
675                "c1plusc2": 330,
676                "amaxc2": 300,
677                "maxac2": 300,
678                "minid": "ga0002",
679                "c2": 300,
680                "c0": 1,
681                "sc2": 300
682            },
683            {
684                "c1plusc2": 731,
685                "amaxc2": 710,
686                "maxac2": 710,
687                "minid": "ga2006",
688                "c2": 710,
689                "c0": 2,
690                "sc2": 710
691            }
692        ]
693    },
694    {
695        "testcase": "PushDowns: Group, 1-step aggregation. Explain",
696        "ignore": "index_id",
697        "explain": {
698            "disabled": false,
699            "results": [
700                {
701                    "present": true
702                }
703            ],
704            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND (v.index_group_aggs.partial IS MISSING OR v.`index` = 'ixgatp') END"
705        },
706        "statements": "SELECT c0, AVG(c2) AS avgc2 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  c0 > 1 GROUP BY c0",
707        "results": [
708            {
709                "c0": 2,
710                "avgc2": 550.1
711            }
712        ]
713    },
714    {
715        "testcase": "PushDowns: Group, 1-step aggregation. HAVING. Explain",
716        "ignore": "index_id",
717        "explain": {
718            "disabled": false,
719            "results": [
720                {
721                    "present": true
722                }
723            ],
724            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND (v.`index` = 'ixgatp' OR (v.index_group_aggs IS NOT MISSING AND v.index_group_aggs.partial IS MISSING )) END"
725        },
726        "statements": "SELECT c0,c1,c2, MIN(meta().id) AS minid, MAX(ABS(c2)) AS maxac2, MAX(c2) AS maxc2, MAX([c2,{c1,c2}])[1] AS maxc1c2, ABS(MAX(c2)) AS absmaxc2, AVG(c1+c3) AS avgc1c2, AVG ( DISTINCT c1) AS avgdc1, SUM ( DISTINCT c2) AS sumdc2, COUNT ( DISTINCT c3) AS sumdc3, cnt AS countc1 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c1,c2,c0 LETTING cnt = COUNT(c1) HAVING SUM(c1) > 5 AND cnt > 1",
727        "results": [
728            {
729                "maxc2": 100,
730                "avgdc1": 10,
731                "maxc1c2": {
732                    "c2": 100,
733                    "c1": 10
734                },
735                "avgc1c2": 3010,
736                "maxac2": 100,
737                "sumdc3": 2,
738                "countc1": 2,
739                "minid": "ga0000",
740                "sumdc2": 100,
741                "c2": 100,
742                "c1": 10,
743                "c0": 1,
744                "absmaxc2": 100
745            },
746            {
747                "maxc2": 600,
748                "avgdc1": 10,
749                "maxc1c2": {
750                    "c2": 600,
751                    "c1": 10
752                },
753                "avgc1c2": 5010,
754                "maxac2": 600,
755                "sumdc3": 2,
756                "countc1": 2,
757                "minid": "ga0005",
758                "sumdc2": 600,
759                "c2": 600,
760                "c1": 10,
761                "c0": 1,
762                "absmaxc2": 600
763            },
764            {
765                "maxc2": 200,
766                "avgdc1": 20,
767                "maxc1c2": {
768                    "c2": 200,
769                    "c1": 20
770                },
771                "avgc1c2": 4020,
772                "maxac2": 200,
773                "sumdc3": 2,
774                "countc1": 2,
775                "minid": "ga0001",
776                "sumdc2": 200,
777                "c2": 200,
778                "c1": 20,
779                "c0": 1,
780                "absmaxc2": 200
781            },
782            {
783                "maxc2": 700,
784                "avgdc1": 20,
785                "maxc1c2": {
786                    "c2": 700,
787                    "c1": 20
788                },
789                "avgc1c2": 3020,
790                "maxac2": 700,
791                "sumdc3": 2,
792                "countc1": 2,
793                "minid": "ga0006",
794                "sumdc2": 700,
795                "c2": 700,
796                "c1": 20,
797                "c0": 1,
798                "absmaxc2": 700
799            },
800            {
801                "maxc2": 300,
802                "avgdc1": 30,
803                "maxc1c2": {
804                    "c2": 300,
805                    "c1": 30
806                },
807                "avgc1c2": 2030,
808                "maxac2": 300,
809                "sumdc3": 2,
810                "countc1": 2,
811                "minid": "ga0002",
812                "sumdc2": 300,
813                "c2": 300,
814                "c1": 30,
815                "c0": 1,
816                "absmaxc2": 300
817            },
818            {
819                "maxc2": 800,
820                "avgdc1": 30,
821                "maxc1c2": {
822                    "c2": 800,
823                    "c1": 30
824                },
825                "avgc1c2": 4030,
826                "maxac2": 800,
827                "sumdc3": 2,
828                "countc1": 2,
829                "minid": "ga0007",
830                "sumdc2": 800,
831                "c2": 800,
832                "c1": 30,
833                "c0": 1,
834                "absmaxc2": 800
835            },
836            {
837                "maxc2": 400,
838                "avgdc1": 40,
839                "maxc1c2": {
840                    "c2": 400,
841                    "c1": 40
842                },
843                "avgc1c2": 3040,
844                "maxac2": 400,
845                "sumdc3": 2,
846                "countc1": 2,
847                "minid": "ga0003",
848                "sumdc2": 400,
849                "c2": 400,
850                "c1": 40,
851                "c0": 1,
852                "absmaxc2": 400
853            },
854            {
855                "maxc2": 900,
856                "avgdc1": 40,
857                "maxc1c2": {
858                    "c2": 900,
859                    "c1": 40
860                },
861                "avgc1c2": 2040,
862                "maxac2": 900,
863                "sumdc3": 2,
864                "countc1": 2,
865                "minid": "ga0008",
866                "sumdc2": 900,
867                "c2": 900,
868                "c1": 40,
869                "c0": 1,
870                "absmaxc2": 900
871            },
872            {
873                "maxc2": 500,
874                "avgdc1": 50,
875                "maxc1c2": {
876                    "c2": 500,
877                    "c1": 50
878                },
879                "avgc1c2": 4050,
880                "maxac2": 500,
881                "sumdc3": 2,
882                "countc1": 2,
883                "minid": "ga0004",
884                "sumdc2": 500,
885                "c2": 500,
886                "c1": 50,
887                "c0": 1,
888                "absmaxc2": 500
889            },
890            {
891                "maxc2": 901,
892                "avgdc1": 50,
893                "maxc1c2": {
894                    "c2": 901,
895                    "c1": 50
896                },
897                "avgc1c2": 3050,
898                "maxac2": 901,
899                "sumdc3": 2,
900                "countc1": 2,
901                "minid": "ga0009",
902                "sumdc2": 901,
903                "c2": 901,
904                "c1": 50,
905                "c0": 1,
906                "absmaxc2": 901
907            },
908            {
909                "maxc2": 110,
910                "avgdc1": 11,
911                "maxc1c2": {
912                    "c2": 110,
913                    "c1": 11
914                },
915                "avgc1c2": 3111,
916                "maxac2": 110,
917                "sumdc3": 2,
918                "countc1": 2,
919                "minid": "ga2000",
920                "sumdc2": 110,
921                "c2": 110,
922                "c1": 11,
923                "c0": 2,
924                "absmaxc2": 110
925            },
926            {
927                "maxc2": 610,
928                "avgdc1": 11,
929                "maxc1c2": {
930                    "c2": 610,
931                    "c1": 11
932                },
933                "avgc1c2": 5111,
934                "maxac2": 610,
935                "sumdc3": 2,
936                "countc1": 2,
937                "minid": "ga2005",
938                "sumdc2": 610,
939                "c2": 610,
940                "c1": 11,
941                "c0": 2,
942                "absmaxc2": 610
943            },
944            {
945                "maxc2": 210,
946                "avgdc1": 21,
947                "maxc1c2": {
948                    "c2": 210,
949                    "c1": 21
950                },
951                "avgc1c2": 4121,
952                "maxac2": 210,
953                "sumdc3": 2,
954                "countc1": 2,
955                "minid": "ga2001",
956                "sumdc2": 210,
957                "c2": 210,
958                "c1": 21,
959                "c0": 2,
960                "absmaxc2": 210
961            },
962            {
963                "maxc2": 710,
964                "avgdc1": 21,
965                "maxc1c2": {
966                    "c2": 710,
967                    "c1": 21
968                },
969                "avgc1c2": 3121,
970                "maxac2": 710,
971                "sumdc3": 2,
972                "countc1": 2,
973                "minid": "ga2006",
974                "sumdc2": 710,
975                "c2": 710,
976                "c1": 21,
977                "c0": 2,
978                "absmaxc2": 710
979            },
980            {
981                "maxc2": 310,
982                "avgdc1": 31,
983                "maxc1c2": {
984                    "c2": 310,
985                    "c1": 31
986                },
987                "avgc1c2": 2131,
988                "maxac2": 310,
989                "sumdc3": 2,
990                "countc1": 2,
991                "minid": "ga2002",
992                "sumdc2": 310,
993                "c2": 310,
994                "c1": 31,
995                "c0": 2,
996                "absmaxc2": 310
997            },
998            {
999                "maxc2": 810,
1000                "avgdc1": 31,
1001                "maxc1c2": {
1002                    "c2": 810,
1003                    "c1": 31
1004                },
1005                "avgc1c2": 4131,
1006                "maxac2": 810,
1007                "sumdc3": 2,
1008                "countc1": 2,
1009                "minid": "ga2007",
1010                "sumdc2": 810,
1011                "c2": 810,
1012                "c1": 31,
1013                "c0": 2,
1014                "absmaxc2": 810
1015            },
1016            {
1017                "maxc2": 410,
1018                "avgdc1": 41,
1019                "maxc1c2": {
1020                    "c2": 410,
1021                    "c1": 41
1022                },
1023                "avgc1c2": 3141,
1024                "maxac2": 410,
1025                "sumdc3": 2,
1026                "countc1": 2,
1027                "minid": "ga2003",
1028                "sumdc2": 410,
1029                "c2": 410,
1030                "c1": 41,
1031                "c0": 2,
1032                "absmaxc2": 410
1033            },
1034            {
1035                "maxc2": 910,
1036                "avgdc1": 41,
1037                "maxc1c2": {
1038                    "c2": 910,
1039                    "c1": 41
1040                },
1041                "avgc1c2": 2141,
1042                "maxac2": 910,
1043                "sumdc3": 2,
1044                "countc1": 2,
1045                "minid": "ga2008",
1046                "sumdc2": 910,
1047                "c2": 910,
1048                "c1": 41,
1049                "c0": 2,
1050                "absmaxc2": 910
1051            },
1052            {
1053                "maxc2": 510,
1054                "avgdc1": 51,
1055                "maxc1c2": {
1056                    "c2": 510,
1057                    "c1": 51
1058                },
1059                "avgc1c2": 4151,
1060                "maxac2": 510,
1061                "sumdc3": 2,
1062                "countc1": 2,
1063                "minid": "ga2004",
1064                "sumdc2": 510,
1065                "c2": 510,
1066                "c1": 51,
1067                "c0": 2,
1068                "absmaxc2": 510
1069            },
1070            {
1071                "maxc2": 911,
1072                "avgdc1": 51,
1073                "maxc1c2": {
1074                    "c2": 911,
1075                    "c1": 51
1076                },
1077                "avgc1c2": 2651,
1078                "maxac2": 911,
1079                "sumdc3": 2,
1080                "countc1": 2,
1081                "minid": "ga2009",
1082                "sumdc2": 911,
1083                "c2": 911,
1084                "c1": 51,
1085                "c0": 2,
1086                "absmaxc2": 911
1087            }
1088        ]
1089    },
1090    {
1091        "testcase": "PushDowns: Group, 1-step aggregation, ORDER. HAVING. NO-PushDowns: OFFSET, LIMIT. Explain",
1092        "ignore": "index_id",
1093        "explain": {
1094            "disabled": false,
1095            "results": [
1096                {
1097                    "present": true
1098                }
1099            ],
1100            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND (v.`index` = 'ixgatp' OR (v.index_group_aggs IS NOT MISSING AND v.index_group_aggs.partial IS MISSING AND v.index_order IS NOT MISSING AND v.`offset` IS MISSING AND v.`limit` IS MISSING)) END"
1101        },
1102        "statements": "SELECT c0,c1,c2, MIN(meta().id) AS minid, MAX(ABS(c2)) AS maxac2, MAX(c2) AS maxc2, MAX([c2,{c1,c2}])[1] AS maxc1c2, ABS(MAX(c2)) AS absmaxc2, AVG(c1+c3) AS avgc1c2, AVG ( DISTINCT c1) AS avgdc1, SUM ( DISTINCT c2) AS sumdc2, COUNT ( DISTINCT c3) AS sumdc3, cnt AS countc1 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c1,c2,c0 LETTING cnt = COUNT(c1) HAVING SUM(c1) > 5 AND cnt > 1 ORDER BY c0,c1,c2 OFFSET 1 LIMIT 5",
1103        "ordered": true,
1104        "results": [
1105            {
1106                "maxc2": 600,
1107                "avgdc1": 10,
1108                "maxc1c2": {
1109                    "c2": 600,
1110                    "c1": 10
1111                },
1112                "avgc1c2": 5010,
1113                "maxac2": 600,
1114                "sumdc3": 2,
1115                "countc1": 2,
1116                "minid": "ga0005",
1117                "sumdc2": 600,
1118                "c2": 600,
1119                "c1": 10,
1120                "c0": 1,
1121                "absmaxc2": 600
1122            },
1123            {
1124                "maxc2": 200,
1125                "avgdc1": 20,
1126                "maxc1c2": {
1127                    "c2": 200,
1128                    "c1": 20
1129                },
1130                "avgc1c2": 4020,
1131                "maxac2": 200,
1132                "sumdc3": 2,
1133                "countc1": 2,
1134                "minid": "ga0001",
1135                "sumdc2": 200,
1136                "c2": 200,
1137                "c1": 20,
1138                "c0": 1,
1139                "absmaxc2": 200
1140            },
1141            {
1142                "maxc2": 700,
1143                "avgdc1": 20,
1144                "maxc1c2": {
1145                    "c2": 700,
1146                    "c1": 20
1147                },
1148                "avgc1c2": 3020,
1149                "maxac2": 700,
1150                "sumdc3": 2,
1151                "countc1": 2,
1152                "minid": "ga0006",
1153                "sumdc2": 700,
1154                "c2": 700,
1155                "c1": 20,
1156                "c0": 1,
1157                "absmaxc2": 700
1158            },
1159            {
1160                "maxc2": 300,
1161                "avgdc1": 30,
1162                "maxc1c2": {
1163                    "c2": 300,
1164                    "c1": 30
1165                },
1166                "avgc1c2": 2030,
1167                "maxac2": 300,
1168                "sumdc3": 2,
1169                "countc1": 2,
1170                "minid": "ga0002",
1171                "sumdc2": 300,
1172                "c2": 300,
1173                "c1": 30,
1174                "c0": 1,
1175                "absmaxc2": 300
1176            },
1177            {
1178                "maxc2": 800,
1179                "avgdc1": 30,
1180                "maxc1c2": {
1181                    "c2": 800,
1182                    "c1": 30
1183                },
1184                "avgc1c2": 4030,
1185                "maxac2": 800,
1186                "sumdc3": 2,
1187                "countc1": 2,
1188                "minid": "ga0007",
1189                "sumdc2": 800,
1190                "c2": 800,
1191                "c1": 30,
1192                "c0": 1,
1193                "absmaxc2": 800
1194            }
1195        ]
1196    },
1197    {
1198        "testcase": "PushDowns: Group, 2-step aggregation. HAVING. NO-PushDowns: ORDER, OFFSET, LIMIT. Explain",
1199        "ignore": "index_id",
1200        "explain": {
1201            "disabled": false,
1202            "results": [
1203                {
1204                    "present": true
1205                }
1206            ],
1207            "statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.index_group_aggs IS NOT MISSING AND v.index_group_aggs.partial IS NOT MISSING END"
1208        },
1209        "statements": "SELECT  c0, c2+c4 AS c2plusc4, MIN(meta().id) AS minid, MAX(ABS(c2)) AS maxac2, MAX(c2) AS maxc2, MAX([c2,{c1,c2}])[1] AS maxc1c2, ABS(MAX(c2)) AS absmaxc2, AVG(c3) AS avgc2, AVG ( (c1+c2)) AS avgc1c2, SUM ( c2) AS sumc2, COUNT ( c3) AS countc3, cnt AS countc1 FROM orders WHERE (test_id = 'indexga' AND type = 'numeric') AND  (c0 = 1 OR c0 >= 2) GROUP BY c2+c4,c0 LETTING cnt = COUNT(c1) HAVING SUM(c1) >= 0 AND cnt >= 0 ORDER BY c0, c2+c4 OFFSET 1 LIMIT 5",
1210        "ordered": true,
1211        "results": [
1212            {
1213                "maxc2": 100,
1214                "maxc1c2": {
1215                    "c2": 100,
1216                    "c1": 10
1217                },
1218                "c2plusc4": 10110,
1219                "avgc1c2": 110,
1220                "maxac2": 100,
1221                "countc3": 1,
1222                "countc1": 1,
1223                "minid": "ga0010",
1224                "avgc2": 5000,
1225                "c0": 1,
1226                "absmaxc2": 100,
1227                "sumc2": 100
1228            },
1229            {
1230                "maxc2": 200,
1231                "maxc1c2": {
1232                    "c2": 200,
1233                    "c1": 20
1234                },
1235                "c2plusc4": 10201,
1236                "avgc1c2": 220,
1237                "maxac2": 200,
1238                "countc3": 1,
1239                "countc1": 1,
1240                "minid": "ga0001",
1241                "avgc2": 2000,
1242                "c0": 1,
1243                "absmaxc2": 200,
1244                "sumc2": 200
1245            },
1246            {
1247                "maxc2": 200,
1248                "maxc1c2": {
1249                    "c2": 200,
1250                    "c1": 20
1251                },
1252                "c2plusc4": 10211,
1253                "avgc1c2": 220,
1254                "maxac2": 200,
1255                "countc3": 1,
1256                "countc1": 1,
1257                "minid": "ga0011",
1258                "avgc2": 6000,
1259                "c0": 1,
1260                "absmaxc2": 200,
1261                "sumc2": 200
1262            },
1263            {
1264                "maxc2": 300,
1265                "maxc1c2": {
1266                    "c2": 300,
1267                    "c1": 30
1268                },
1269                "c2plusc4": 10302,
1270                "avgc1c2": 330,
1271                "maxac2": 300,
1272                "countc3": 1,
1273                "countc1": 1,
1274                "minid": "ga0002",
1275                "avgc2": 3000,
1276                "c0": 1,
1277                "absmaxc2": 300,
1278                "sumc2": 300
1279            },
1280            {
1281                "maxc2": 300,
1282                "maxc1c2": {
1283                    "c2": 300,
1284                    "c1": 30
1285                },
1286                "c2plusc4": 10312,
1287                "avgc1c2": 330,
1288                "maxac2": 300,
1289                "countc3": 1,
1290                "countc1": 1,
1291                "minid": "ga0012",
1292                "avgc2": 1000,
1293                "c0": 1,
1294                "absmaxc2": 300,
1295                "sumc2": 300
1296            }
1297        ]
1298    }
1299]
1300