Skip to content

Commit 249882f

Browse files
committed
feat(test): support more tests
Signed-off-by: Alan Tang <[email protected]>
1 parent b455305 commit 249882f

File tree

1 file changed

+144
-26
lines changed

1 file changed

+144
-26
lines changed

datafusion/sqllogictest/test_files/explain_tree.slt

Lines changed: 144 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -463,32 +463,6 @@ physical_plan
463463
15)│ rows: 1 │
464464
16)└───────────────────────────┘
465465

466-
# Query with projection on memory
467-
query TT
468-
explain SELECT int_col, bigint_col, int_col+bigint_col AS sum_col FROM table3;
469-
----
470-
logical_plan
471-
01)Projection: table3.int_col, table3.bigint_col, CAST(table3.int_col AS Int64) + table3.bigint_col AS sum_col
472-
02)--TableScan: table3 projection=[int_col, bigint_col]
473-
physical_plan
474-
01)┌───────────────────────────┐
475-
02)│ ProjectionExec │
476-
03)│ -------------------- │
477-
04)│ ProjectionExec: expr: │
478-
05)│ [int_col@0 as int_col, │
479-
06)│ bigint_col@1 as │
480-
07)│ bigint_col, CAST │
481-
08)│ (int_col@0 AS Int64) + │
482-
09)│ bigint_col@1 as sum_col] │
483-
10)└─────────────┬─────────────┘
484-
11)┌─────────────┴─────────────┐
485-
12)│ DataSourceExec │
486-
13)│ -------------------- │
487-
14)│ bytes: 1560 │
488-
15)│ format: memory │
489-
16)│ rows: 1 │
490-
17)└───────────────────────────┘
491-
492466
# Query with filter on json
493467
query TT
494468
explain SELECT int_col FROM table4 WHERE string_col != 'foo';
@@ -545,6 +519,150 @@ physical_plan
545519
17)│ format: arrow │
546520
18)└───────────────────────────┘
547521

522+
523+
# Query with projection on csv
524+
query TT
525+
explain SELECT int_col, bigint_col, int_col+bigint_col AS sum_col FROM table1;
526+
----
527+
logical_plan
528+
01)Projection: table1.int_col, table1.bigint_col, CAST(table1.int_col AS Int64) + table1.bigint_col AS sum_col
529+
02)--TableScan: table1 projection=[int_col, bigint_col]
530+
physical_plan
531+
01)┌───────────────────────────┐
532+
02)│ ProjectionExec │
533+
03)│ -------------------- │
534+
04)│ ProjectionExec: expr: │
535+
05)│ [int_col@0 as int_col, │
536+
06)│ bigint_col@1 as │
537+
07)│ bigint_col, CAST │
538+
08)│ (int_col@0 AS Int64) + │
539+
09)│ bigint_col@1 as sum_col] │
540+
10)└─────────────┬─────────────┘
541+
11)┌─────────────┴─────────────┐
542+
12)│ RepartitionExec │
543+
13)└─────────────┬─────────────┘
544+
14)┌─────────────┴─────────────┐
545+
15)│ DataSourceExec │
546+
16)│ -------------------- │
547+
17)│ files: 1 │
548+
18)│ format: csv │
549+
19)└───────────────────────────┘
550+
551+
552+
# Query with projection on parquet
553+
query TT
554+
explain SELECT int_col, bigint_col, int_col+bigint_col AS sum_col FROM table2;
555+
----
556+
logical_plan
557+
01)Projection: table2.int_col, table2.bigint_col, CAST(table2.int_col AS Int64) + table2.bigint_col AS sum_col
558+
02)--TableScan: table2 projection=[int_col, bigint_col]
559+
physical_plan
560+
01)┌───────────────────────────┐
561+
02)│ ProjectionExec │
562+
03)│ -------------------- │
563+
04)│ ProjectionExec: expr: │
564+
05)│ [int_col@0 as int_col, │
565+
06)│ bigint_col@1 as │
566+
07)│ bigint_col, CAST │
567+
08)│ (int_col@0 AS Int64) + │
568+
09)│ bigint_col@1 as sum_col] │
569+
10)└─────────────┬─────────────┘
570+
11)┌─────────────┴─────────────┐
571+
12)│ RepartitionExec │
572+
13)└─────────────┬─────────────┘
573+
14)┌─────────────┴─────────────┐
574+
15)│ DataSourceExec │
575+
16)│ -------------------- │
576+
17)│ files: 1 │
577+
18)│ format: parquet │
578+
19)└───────────────────────────┘
579+
580+
581+
# Query with projection on memory
582+
query TT
583+
explain SELECT int_col, bigint_col, int_col+bigint_col AS sum_col FROM table3;
584+
----
585+
logical_plan
586+
01)Projection: table3.int_col, table3.bigint_col, CAST(table3.int_col AS Int64) + table3.bigint_col AS sum_col
587+
02)--TableScan: table3 projection=[int_col, bigint_col]
588+
physical_plan
589+
01)┌───────────────────────────┐
590+
02)│ ProjectionExec │
591+
03)│ -------------------- │
592+
04)│ ProjectionExec: expr: │
593+
05)│ [int_col@0 as int_col, │
594+
06)│ bigint_col@1 as │
595+
07)│ bigint_col, CAST │
596+
08)│ (int_col@0 AS Int64) + │
597+
09)│ bigint_col@1 as sum_col] │
598+
10)└─────────────┬─────────────┘
599+
11)┌─────────────┴─────────────┐
600+
12)│ DataSourceExec │
601+
13)│ -------------------- │
602+
14)│ bytes: 1560 │
603+
15)│ format: memory │
604+
16)│ rows: 1 │
605+
17)└───────────────────────────┘
606+
607+
608+
609+
# Query with projection on json
610+
query TT
611+
explain SELECT int_col, bigint_col, int_col+bigint_col AS sum_col FROM table4;
612+
----
613+
logical_plan
614+
01)Projection: table4.int_col, table4.bigint_col, table4.int_col + table4.bigint_col AS sum_col
615+
02)--TableScan: table4 projection=[bigint_col, int_col]
616+
physical_plan
617+
01)┌───────────────────────────┐
618+
02)│ ProjectionExec │
619+
03)│ -------------------- │
620+
04)│ ProjectionExec: expr: │
621+
05)│ [int_col@1 as int_col, │
622+
06)│ bigint_col@0 as │
623+
07)│ bigint_col, int_col │
624+
08)│ @1 + bigint_col@0 as │
625+
09)│ sum_col] │
626+
10)└─────────────┬─────────────┘
627+
11)┌─────────────┴─────────────┐
628+
12)│ RepartitionExec │
629+
13)└─────────────┬─────────────┘
630+
14)┌─────────────┴─────────────┐
631+
15)│ DataSourceExec │
632+
16)│ -------------------- │
633+
17)│ files: 1 │
634+
18)│ format: json │
635+
19)└───────────────────────────┘
636+
637+
638+
# Query with projection on arrow
639+
query TT
640+
explain SELECT int_col, bigint_col, int_col+bigint_col AS sum_col FROM table5;
641+
----
642+
logical_plan
643+
01)Projection: table5.int_col, table5.bigint_col, CAST(table5.int_col AS Int64) + table5.bigint_col AS sum_col
644+
02)--TableScan: table5 projection=[int_col, bigint_col]
645+
physical_plan
646+
01)┌───────────────────────────┐
647+
02)│ ProjectionExec │
648+
03)│ -------------------- │
649+
04)│ ProjectionExec: expr: │
650+
05)│ [int_col@0 as int_col, │
651+
06)│ bigint_col@1 as │
652+
07)│ bigint_col, CAST │
653+
08)│ (int_col@0 AS Int64) + │
654+
09)│ bigint_col@1 as sum_col] │
655+
10)└─────────────┬─────────────┘
656+
11)┌─────────────┴─────────────┐
657+
12)│ RepartitionExec │
658+
13)└─────────────┬─────────────┘
659+
14)┌─────────────┴─────────────┐
660+
15)│ DataSourceExec │
661+
16)│ -------------------- │
662+
17)│ files: 1 │
663+
18)│ format: arrow │
664+
19)└───────────────────────────┘
665+
548666
# cleanup
549667
statement ok
550668
drop table table1;

0 commit comments

Comments
 (0)