@@ -158,23 +158,26 @@ physical_plan
158
158
02)│ CoalesceBatchesExec │
159
159
03)└─────────────┬─────────────┘
160
160
04)┌─────────────┴─────────────┐
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)└─────────────┬─────────────┘ │
166
166
10)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
167
- 11)│ RepartitionExec ││ RepartitionExec │
167
+ 11)│ CoalesceBatchesExec ││ CoalesceBatchesExec │
168
168
12)└─────────────┬─────────────┘└─────────────┬─────────────┘
169
169
13)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
170
170
14)│ RepartitionExec ││ RepartitionExec │
171
171
15)└─────────────┬─────────────┘└─────────────┬─────────────┘
172
172
16)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
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)└───────────────────────────┘└───────────────────────────┘
178
181
179
182
# 3 Joins
180
183
query TT
@@ -199,33 +202,39 @@ physical_plan
199
202
02)│ CoalesceBatchesExec │
200
203
03)└─────────────┬─────────────┘
201
204
04)┌─────────────┴─────────────┐
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)└─────────────┬─────────────┘ │
207
210
10)┌─────────────┴─────────────┐ ┌─────────────┴─────────────┐
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)└─────────────┬─────────────┘└─────────────┬─────────────┘└───────────────────────────┘
223
226
26)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
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)└───────────────────────────┘└───────────────────────────┘
229
238
230
239
# Long Filter (demonstrate what happens with wrapping)
231
240
query TT
@@ -519,6 +528,95 @@ physical_plan
519
528
17)│ format: arrow │
520
529
18)└───────────────────────────┘
521
530
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
+
522
620
# cleanup
523
621
statement ok
524
622
drop table table1;
0 commit comments