@@ -158,23 +158,26 @@ physical_plan
15815802)│ CoalesceBatchesExec │
15915903)└─────────────┬─────────────┘
16016004)┌─────────────┴─────────────┐
161- 05)│ HashJoinExec ├──────────────┐
162- 06)└─────────────┬─────────────┘ │
163- 07)┌─────────────┴─────────────┐┌─────────────┴ ─────────────┐
164- 08)│ CoalesceBatchesExec ││ CoalesceBatchesExec │
165- 09)└─────────────┬─────────────┘└─────────────┬─────────────┘
161+ 05)│ HashJoinExec │
162+ 06)│ -------------------- │
163+ 07)│ on: ├─ ─────────────┐
164+ 08)│ (int_col@0 = int_col@0) │ │
165+ 09)└─────────────┬─────────────┘ │
16616610)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
167- 11)│ RepartitionExec ││ RepartitionExec │
167+ 11)│ CoalesceBatchesExec ││ CoalesceBatchesExec │
16816812)└─────────────┬─────────────┘└─────────────┬─────────────┘
16916913)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
17017014)│ RepartitionExec ││ RepartitionExec │
17117115)└─────────────┬─────────────┘└─────────────┬─────────────┘
17217216)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
173- 17)│ DataSourceExec ││ DataSourceExec │
174- 18)│ -------------------- ││ -------------------- │
175- 19)│ files: 1 ││ files: 1 │
176- 20)│ format: csv ││ format: parquet │
177- 21)└───────────────────────────┘└───────────────────────────┘
173+ 17)│ RepartitionExec ││ RepartitionExec │
174+ 18)└─────────────┬─────────────┘└─────────────┬─────────────┘
175+ 19)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
176+ 20)│ DataSourceExec ││ DataSourceExec │
177+ 21)│ -------------------- ││ -------------------- │
178+ 22)│ files: 1 ││ files: 1 │
179+ 23)│ format: csv ││ format: parquet │
180+ 24)└───────────────────────────┘└───────────────────────────┘
178181
179182# 3 Joins
180183query TT
@@ -199,33 +202,39 @@ physical_plan
19920202)│ CoalesceBatchesExec │
20020303)└─────────────┬─────────────┘
20120404)┌─────────────┴─────────────┐
202- 05)│ HashJoinExec ├───────────────────────────────────────────┐
203- 06)└─────────────┬─────────────┘ │
204- 07)┌─────────────┴─────────────┐ ┌ ─────────────┴ ─────────────┐
205- 08)│ CoalesceBatchesExec │ │ CoalesceBatchesExec │
206- 09)└─────────────┬─────────────┘ └─────────────┬─────────────┘
205+ 05)│ HashJoinExec │
206+ 06)│ -------------------- │
207+ 07)│ on: ├ ────────────────────────────── ─────────────┐
208+ 08)│ (int_col@1 = int_col@0) │ │
209+ 09)└─────────────┬─────────────┘ │
20721010)┌─────────────┴─────────────┐ ┌─────────────┴─────────────┐
208- 11)│ HashJoinExec ├──────────────┐ │ RepartitionExec │
209- 12)└─────────────┬─────────────┘ │ └─────────────┬─────────────┘
210- 13)┌─────────────┴─────────────┐┌─────────────┴─────────────┐ ┌─────────────┴─────────────┐
211- 14)│ CoalesceBatchesExec ││ CoalesceBatchesExec ││ DataSourceExec │
212- 15)│ ││ ││ -------------------- │
213- 16)│ ││ ││ bytes: 1560 │
214- 17)│ ││ ││ format: memory │
215- 18)│ ││ ││ rows: 1 │
216- 19)└ ─────────────┬ ─────────────┘└ ─────────────┬ ─────────────┘└ ───────────────────────────┘
217- 20)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
218- 21)│ RepartitionExec ││ RepartitionExec │
219- 22)└─────────────┬─────────────┘└─────────────┬─────────────┘
220- 23)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
221- 24)│ RepartitionExec ││ RepartitionExec │
222- 25)└─────────────┬─────────────┘└─────────────┬─────────────┘
211+ 11)│ CoalesceBatchesExec │ │ CoalesceBatchesExec │
212+ 12)└─────────────┬─────────────┘ └─────────────┬─────────────┘
213+ 13)┌─────────────┴─────────────┐ ┌─────────────┴─────────────┐
214+ 14)│ HashJoinExec │ │ RepartitionExec │
215+ 15)│ -------------------- │ │ │
216+ 16)│ on: ├──────────────┐ │ │
217+ 17)│ (int_col@0 = int_col@0) │ │ │ │
218+ 18)└─────────────┬─────────────┘ │ └─────────────┬─────────────┘
219+ 19)┌ ─────────────┴ ─────────────┐┌ ─────────────┴ ─────────────┐┌ ─────────────┴ ─────────────┐
220+ 20)│ CoalesceBatchesExec ││ CoalesceBatchesExec ││ DataSourceExec │
221+ 21)│ ││ ││ -------------------- │
222+ 22)│ ││ ││ bytes: 1560 │
223+ 23)│ ││ ││ format: memory │
224+ 24)│ ││ ││ rows: 1 │
225+ 25)└─────────────┬─────────────┘└─────────────┬─────────────┘└───────────────────────────┘
22322626)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
224- 27)│ DataSourceExec ││ DataSourceExec │
225- 28)│ -------------------- ││ -------------------- │
226- 29)│ files: 1 ││ files: 1 │
227- 30)│ format: csv ││ format: parquet │
228- 31)└───────────────────────────┘└───────────────────────────┘
227+ 27)│ RepartitionExec ││ RepartitionExec │
228+ 28)└─────────────┬─────────────┘└─────────────┬─────────────┘
229+ 29)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
230+ 30)│ RepartitionExec ││ RepartitionExec │
231+ 31)└─────────────┬─────────────┘└─────────────┬─────────────┘
232+ 32)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
233+ 33)│ DataSourceExec ││ DataSourceExec │
234+ 34)│ -------------------- ││ -------------------- │
235+ 35)│ files: 1 ││ files: 1 │
236+ 36)│ format: csv ││ format: parquet │
237+ 37)└───────────────────────────┘└───────────────────────────┘
229238
230239# Long Filter (demonstrate what happens with wrapping)
231240query TT
@@ -519,6 +528,95 @@ physical_plan
51952817)│ format: arrow │
52052918)└───────────────────────────┘
521530
531+ # Query with hash join.
532+ query TT
533+ explain select * from table1 inner join table2 on table1.int_col = table2.int_col and table1.string_col = table2.string_col;
534+ ----
535+ logical_plan
536+ 01)Inner Join: table1.int_col = table2.int_col, CAST(table1.string_col AS Utf8View) = table2.string_col
537+ 02)--TableScan: table1 projection=[int_col, string_col, bigint_col, date_col]
538+ 03)--TableScan: table2 projection=[int_col, string_col, bigint_col, date_col]
539+ physical_plan
540+ 01)┌───────────────────────────┐
541+ 02)│ CoalesceBatchesExec │
542+ 03)└─────────────┬─────────────┘
543+ 04)┌─────────────┴─────────────┐
544+ 05)│ HashJoinExec │
545+ 06)│ -------------------- │
546+ 07)│ on: │
547+ 08)│ (int_col@0 = int_col@0), ├──────────────┐
548+ 09)│ (CAST(table1.string_col │ │
549+ 10)│ AS Utf8View)@4 = │ │
550+ 11)│ string_col@1) │ │
551+ 12)└─────────────┬─────────────┘ │
552+ 13)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
553+ 14)│ CoalesceBatchesExec ││ CoalesceBatchesExec │
554+ 15)└─────────────┬─────────────┘└─────────────┬─────────────┘
555+ 16)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
556+ 17)│ RepartitionExec ││ RepartitionExec │
557+ 18)└─────────────┬─────────────┘└─────────────┬─────────────┘
558+ 19)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
559+ 20)│ ProjectionExec ││ RepartitionExec │
560+ 21)└─────────────┬─────────────┘└─────────────┬─────────────┘
561+ 22)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
562+ 23)│ RepartitionExec ││ DataSourceExec │
563+ 24)│ ││ -------------------- │
564+ 25)│ ││ files: 1 │
565+ 26)│ ││ format: parquet │
566+ 27)└─────────────┬─────────────┘└───────────────────────────┘
567+ 28)┌─────────────┴─────────────┐
568+ 29)│ DataSourceExec │
569+ 30)│ -------------------- │
570+ 31)│ files: 1 │
571+ 32)│ format: csv │
572+ 33)└───────────────────────────┘
573+
574+ # Query with outer hash join.
575+ query TT
576+ explain select * from table1 left outer join table2 on table1.int_col = table2.int_col and table1.string_col = table2.string_col;
577+ ----
578+ logical_plan
579+ 01)Left Join: table1.int_col = table2.int_col, CAST(table1.string_col AS Utf8View) = table2.string_col
580+ 02)--TableScan: table1 projection=[int_col, string_col, bigint_col, date_col]
581+ 03)--TableScan: table2 projection=[int_col, string_col, bigint_col, date_col]
582+ physical_plan
583+ 01)┌───────────────────────────┐
584+ 02)│ CoalesceBatchesExec │
585+ 03)└─────────────┬─────────────┘
586+ 04)┌─────────────┴─────────────┐
587+ 05)│ HashJoinExec │
588+ 06)│ -------------------- │
589+ 07)│ join_type: Left │
590+ 08)│ │
591+ 09)│ on: ├──────────────┐
592+ 10)│ (int_col@0 = int_col@0), │ │
593+ 11)│ (CAST(table1.string_col │ │
594+ 12)│ AS Utf8View)@4 = │ │
595+ 13)│ string_col@1) │ │
596+ 14)└─────────────┬─────────────┘ │
597+ 15)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
598+ 16)│ CoalesceBatchesExec ││ CoalesceBatchesExec │
599+ 17)└─────────────┬─────────────┘└─────────────┬─────────────┘
600+ 18)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
601+ 19)│ RepartitionExec ││ RepartitionExec │
602+ 20)└─────────────┬─────────────┘└─────────────┬─────────────┘
603+ 21)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
604+ 22)│ ProjectionExec ││ RepartitionExec │
605+ 23)└─────────────┬─────────────┘└─────────────┬─────────────┘
606+ 24)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
607+ 25)│ RepartitionExec ││ DataSourceExec │
608+ 26)│ ││ -------------------- │
609+ 27)│ ││ files: 1 │
610+ 28)│ ││ format: parquet │
611+ 29)└─────────────┬─────────────┘└───────────────────────────┘
612+ 30)┌─────────────┴─────────────┐
613+ 31)│ DataSourceExec │
614+ 32)│ -------------------- │
615+ 33)│ files: 1 │
616+ 34)│ format: csv │
617+ 35)└───────────────────────────┘
618+
619+
522620# cleanup
523621statement ok
524622drop table table1;
0 commit comments