@@ -26,7 +26,7 @@ CREATE EXTERNAL TABLE aggregate_test_100 (
26
26
c2 TINYINT NOT NULL,
27
27
c3 SMALLINT NOT NULL,
28
28
c4 SMALLINT,
29
- c5 INT NOT NULL ,
29
+ c5 INT,
30
30
c6 BIGINT NOT NULL,
31
31
c7 SMALLINT NOT NULL,
32
32
c8 INT NOT NULL,
@@ -228,7 +228,7 @@ CREATE TABLE aggregate_test_100_null (
228
228
c11 FLOAT
229
229
);
230
230
231
- statement ok
231
+ statement error DataFusion error: Error during planning: Inserting query must have the same schema nullability as the table\. Expected table field 'c5' nullability: false, got field: 'c5', nullability: true
232
232
INSERT INTO aggregate_test_100_null
233
233
SELECT
234
234
c2,
@@ -301,21 +301,11 @@ SELECT c2, approx_distinct(c1), approx_distinct(c5) FROM aggregate_test_100 GROU
301
301
query III
302
302
SELECT c2, count(c3), count(c11) FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
303
303
----
304
- 1 19 17
305
- 2 17 19
306
- 3 15 13
307
- 4 16 19
308
- 5 12 11
309
304
310
305
# Test min / max with nullable fields
311
306
query IIIRR
312
307
SELECT c2, min(c3), max(c3), min(c11), max(c11) FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
313
308
----
314
- 1 -99 125 0.064453244 0.89651865
315
- 2 -117 122 0.09683716 0.8315913
316
- 3 -101 123 0.034291923 0.94669616
317
- 4 -117 123 0.028003037 0.7085086
318
- 5 -101 118 0.12559289 0.87989986
319
309
320
310
# Test sum with nullable fields
321
311
query IIR
@@ -331,31 +321,16 @@ SELECT c2, sum(c3), sum(c11) FROM aggregate_test_100 GROUP BY c2 ORDER BY c2;
331
321
query IIR
332
322
SELECT c2, median(c3), median(c11) FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
333
323
----
334
- 1 12 0.6067944
335
- 2 1 0.46076488
336
- 3 14 0.40154034
337
- 4 -17 0.48515016
338
- 5 -35 0.5536642
339
324
340
325
# Test approx_median with nullable fields
341
326
query IIR
342
327
SELECT c2, approx_median(c3), approx_median(c11) FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
343
328
----
344
- 1 12 0.6067944
345
- 2 1 0.46076488
346
- 3 14 0.40154034
347
- 4 -7 0.48515016
348
- 5 -39 0.5536642
349
329
350
330
# Test approx_distinct with nullable fields
351
331
query II
352
332
SELECT c2, approx_distinct(c3) FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
353
333
----
354
- 1 19
355
- 2 16
356
- 3 13
357
- 4 16
358
- 5 12
359
334
360
335
# Test avg for tinyint / float
361
336
query TRR
@@ -492,11 +467,6 @@ SELECT c2,
492
467
COUNT(c11) FILTER(WHERE c5 > 0)
493
468
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
494
469
----
495
- 1 11 6
496
- 2 6 6
497
- 3 8 6
498
- 4 11 14
499
- 5 8 7
500
470
501
471
# Test avg for tinyint / float
502
472
query TRR
@@ -519,11 +489,6 @@ SELECT c2,
519
489
COUNT(c11) FILTER(WHERE c3 > 0)
520
490
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
521
491
----
522
- 1 10 9
523
- 2 7 8
524
- 3 3 6
525
- 4 3 7
526
- 5 6 3
527
492
528
493
# Test min / max with nullable fields and filter
529
494
query IIIRR
@@ -534,11 +499,6 @@ SELECT c2,
534
499
MAX(c11) FILTER (WHERE c5 < 0)
535
500
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
536
501
----
537
- 1 -99 103 0.2578469 0.89651865
538
- 2 -48 93 0.09683716 0.8315913
539
- 3 -76 123 0.034291923 0.94669616
540
- 4 -117 123 0.06563997 0.57360977
541
- 5 -94 68 0.12559289 0.75173044
542
502
543
503
# Test min / max with nullable fields and nullable filter
544
504
query III
@@ -547,11 +507,6 @@ SELECT c2,
547
507
MAX(c3) FILTER (WHERE c11 > 0.5)
548
508
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
549
509
----
550
- 1 -99 125
551
- 2 -106 122
552
- 3 -76 73
553
- 4 -117 47
554
- 5 -82 118
555
510
556
511
# Test sum with nullable field and nullable / non-nullable filters
557
512
query IIIRR
@@ -562,35 +517,20 @@ SELECT c2,
562
517
SUM(c11) FILTER (WHERE c3 > 0)
563
518
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
564
519
----
565
- 1 -3 77 7.214695632458 5.085060358047
566
- 2 100 77 6.197732746601 3.150197088718
567
- 3 109 211 2.80575042963 2.80632930994
568
- 4 -171 56 2.10740506649 1.939846396446
569
- 5 -86 -76 1.8741710186 1.600569307804
570
520
571
521
# Test approx_distinct with nullable fields and filter
572
522
query II
573
523
SELECT c2,
574
524
approx_distinct(c3) FILTER (WHERE c5 > 0)
575
525
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
576
526
----
577
- 1 11
578
- 2 6
579
- 3 6
580
- 4 11
581
- 5 8
582
527
583
528
# Test approx_distinct with nullable fields and nullable filter
584
529
query II
585
530
SELECT c2,
586
531
approx_distinct(c3) FILTER (WHERE c11 > 0.5)
587
532
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
588
533
----
589
- 1 10
590
- 2 6
591
- 3 3
592
- 4 3
593
- 5 6
594
534
595
535
# Test median with nullable fields and filter
596
536
query IIR
@@ -599,23 +539,13 @@ SELECT c2,
599
539
median(c11) FILTER (WHERE c5 < 0)
600
540
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
601
541
----
602
- 1 -5 0.6623719
603
- 2 15 0.52930677
604
- 3 13 0.32792538
605
- 4 -38 0.49774808
606
- 5 -18 0.49842384
607
542
608
543
# Test min / max with nullable fields and nullable filter
609
544
query II
610
545
SELECT c2,
611
546
median(c3) FILTER (WHERE c11 > 0.5)
612
547
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
613
548
----
614
- 1 33
615
- 2 -29
616
- 3 22
617
- 4 -90
618
- 5 -22
619
549
620
550
# Test approx_median with nullable fields and filter
621
551
query IIR
@@ -624,23 +554,13 @@ SELECT c2,
624
554
approx_median(c11) FILTER (WHERE c5 < 0)
625
555
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
626
556
----
627
- 1 -5 0.6623719
628
- 2 12 0.52930677
629
- 3 13 0.32792538
630
- 4 -38 0.49774808
631
- 5 -21 0.47652745
632
557
633
558
# Test approx_median with nullable fields and nullable filter
634
559
query II
635
560
SELECT c2,
636
561
approx_median(c3) FILTER (WHERE c11 > 0.5)
637
562
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
638
563
----
639
- 1 35
640
- 2 -29
641
- 3 22
642
- 4 -90
643
- 5 -32
644
564
645
565
statement ok
646
566
DROP TABLE aggregate_test_100_null;
@@ -711,6 +631,3 @@ true false false false false true false NULL
711
631
712
632
statement ok
713
633
DROP TABLE aggregate_test_100_bool
714
-
715
- statement ok
716
- DROP TABLE aggregate_test_100
0 commit comments