@@ -54,10 +54,36 @@ STORED AS PARQUET
54
54
LOCATION 'test_files/scratch/explain_tree/table2.parquet';
55
55
56
56
57
- # table3: Memoru
57
+ # table3: Memory
58
58
statement ok
59
59
CREATE TABLE table3 as select * from table1;
60
60
61
+ # table4: JSON
62
+ query I
63
+ COPY (SELECT * from table1)
64
+ TO 'test_files/scratch/explain_tree/table4.json'
65
+ ----
66
+ 3
67
+
68
+ statement ok
69
+ CREATE EXTERNAL TABLE table4
70
+ STORED AS JSON
71
+ LOCATION 'test_files/scratch/explain_tree/table4.json';
72
+
73
+ # table5: ARROW
74
+ query I
75
+ COPY (SELECT * from table1)
76
+ TO 'test_files/scratch/explain_tree/table5.arrow'
77
+ ----
78
+ 3
79
+
80
+ statement ok
81
+ CREATE EXTERNAL TABLE table5
82
+ STORED AS ARROW
83
+ LOCATION 'test_files/scratch/explain_tree/table5.arrow';
84
+
85
+
86
+
61
87
######## Begin Queries ########
62
88
63
89
# Filter
@@ -83,7 +109,10 @@ physical_plan
83
109
12)└─────────────┬─────────────┘
84
110
13)┌─────────────┴─────────────┐
85
111
14)│ DataSourceExec │
86
- 15)└───────────────────────────┘
112
+ 15)│ -------------------- │
113
+ 16)│ files: 1 │
114
+ 17)│ format: csv │
115
+ 18)└───────────────────────────┘
87
116
88
117
# Aggregate
89
118
query TT
@@ -110,7 +139,10 @@ physical_plan
110
139
15)└─────────────┬─────────────┘
111
140
16)┌─────────────┴─────────────┐
112
141
17)│ DataSourceExec │
113
- 18)└───────────────────────────┘
142
+ 18)│ -------------------- │
143
+ 19)│ files: 1 │
144
+ 20)│ format: csv │
145
+ 21)└───────────────────────────┘
114
146
115
147
# 2 Joins
116
148
query TT
@@ -139,7 +171,10 @@ physical_plan
139
171
15)└─────────────┬─────────────┘└─────────────┬─────────────┘
140
172
16)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
141
173
17)│ DataSourceExec ││ DataSourceExec │
142
- 18)└───────────────────────────┘└───────────────────────────┘
174
+ 18)│ -------------------- ││ -------------------- │
175
+ 19)│ files: 1 ││ files: 1 │
176
+ 20)│ format: csv ││ format: parquet │
177
+ 21)└───────────────────────────┘└───────────────────────────┘
143
178
144
179
# 3 Joins
145
180
query TT
@@ -175,18 +210,22 @@ physical_plan
175
210
13)┌─────────────┴─────────────┐┌─────────────┴─────────────┐┌─────────────┴─────────────┐
176
211
14)│ CoalesceBatchesExec ││ CoalesceBatchesExec ││ DataSourceExec │
177
212
15)│ ││ ││ -------------------- │
178
- 16)│ ││ ││ partition_sizes: [1] │
179
- 17)│ ││ ││ partitions: 1 │
180
- 18)└─────────────┬─────────────┘└─────────────┬─────────────┘└───────────────────────────┘
181
- 19)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
182
- 20)│ RepartitionExec ││ RepartitionExec │
183
- 21)└─────────────┬─────────────┘└─────────────┬─────────────┘
184
- 22)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
185
- 23)│ RepartitionExec ││ RepartitionExec │
186
- 24)└─────────────┬─────────────┘└─────────────┬─────────────┘
187
- 25)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
188
- 26)│ DataSourceExec ││ DataSourceExec │
189
- 27)└───────────────────────────┘└───────────────────────────┘
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)└─────────────┬─────────────┘└─────────────┬─────────────┘
223
+ 26)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
224
+ 27)│ DataSourceExec ││ DataSourceExec │
225
+ 28)│ -------------------- ││ -------------------- │
226
+ 29)│ files: 1 ││ files: 1 │
227
+ 30)│ format: csv ││ format: parquet │
228
+ 31)└───────────────────────────┘└───────────────────────────┘
190
229
191
230
# Long Filter (demonstrate what happens with wrapping)
192
231
query TT
@@ -213,9 +252,153 @@ physical_plan
213
252
12)└─────────────┬─────────────┘
214
253
13)┌─────────────┴─────────────┐
215
254
14)│ DataSourceExec │
216
- 15)└───────────────────────────┘
255
+ 15)│ -------------------- │
256
+ 16)│ files: 1 │
257
+ 17)│ format: csv │
258
+ 18)└───────────────────────────┘
259
+
260
+ # Query with filter on csv
261
+ query TT
262
+ explain SELECT int_col FROM table1 WHERE string_col != 'foo';
263
+ ----
264
+ logical_plan
265
+ 01)Projection: table1.int_col
266
+ 02)--Filter: table1.string_col != Utf8("foo")
267
+ 03)----TableScan: table1 projection=[int_col, string_col], partial_filters=[table1.string_col != Utf8("foo")]
268
+ physical_plan
269
+ 01)┌───────────────────────────┐
270
+ 02)│ CoalesceBatchesExec │
271
+ 03)└─────────────┬─────────────┘
272
+ 04)┌─────────────┴─────────────┐
273
+ 05)│ FilterExec │
274
+ 06)│ -------------------- │
275
+ 07)│ predicate: │
276
+ 08)│ string_col@1 != foo │
277
+ 09)└─────────────┬─────────────┘
278
+ 10)┌─────────────┴─────────────┐
279
+ 11)│ RepartitionExec │
280
+ 12)└─────────────┬─────────────┘
281
+ 13)┌─────────────┴─────────────┐
282
+ 14)│ DataSourceExec │
283
+ 15)│ -------------------- │
284
+ 16)│ files: 1 │
285
+ 17)│ format: csv │
286
+ 18)└───────────────────────────┘
217
287
218
288
289
+ # Query with filter on parquet
290
+ query TT
291
+ explain SELECT int_col FROM table2 WHERE string_col != 'foo';
292
+ ----
293
+ logical_plan
294
+ 01)Projection: table2.int_col
295
+ 02)--Filter: table2.string_col != Utf8View("foo")
296
+ 03)----TableScan: table2 projection=[int_col, string_col], partial_filters=[table2.string_col != Utf8View("foo")]
297
+ physical_plan
298
+ 01)┌───────────────────────────┐
299
+ 02)│ CoalesceBatchesExec │
300
+ 03)└─────────────┬─────────────┘
301
+ 04)┌─────────────┴─────────────┐
302
+ 05)│ FilterExec │
303
+ 06)│ -------------------- │
304
+ 07)│ predicate: │
305
+ 08)│ string_col@1 != foo │
306
+ 09)└─────────────┬─────────────┘
307
+ 10)┌─────────────┴─────────────┐
308
+ 11)│ RepartitionExec │
309
+ 12)└─────────────┬─────────────┘
310
+ 13)┌─────────────┴─────────────┐
311
+ 14)│ DataSourceExec │
312
+ 15)│ -------------------- │
313
+ 16)│ files: 1 │
314
+ 17)│ format: parquet │
315
+ 18)│ │
316
+ 19)│ predicate: │
317
+ 20)│ string_col@1 != foo │
318
+ 21)└───────────────────────────┘
319
+
320
+ # Query with filter on memory
321
+ query TT
322
+ explain SELECT int_col FROM table3 WHERE string_col != 'foo';
323
+ ----
324
+ logical_plan
325
+ 01)Projection: table3.int_col
326
+ 02)--Filter: table3.string_col != Utf8("foo")
327
+ 03)----TableScan: table3 projection=[int_col, string_col]
328
+ physical_plan
329
+ 01)┌───────────────────────────┐
330
+ 02)│ CoalesceBatchesExec │
331
+ 03)└─────────────┬─────────────┘
332
+ 04)┌─────────────┴─────────────┐
333
+ 05)│ FilterExec │
334
+ 06)│ -------------------- │
335
+ 07)│ predicate: │
336
+ 08)│ string_col@1 != foo │
337
+ 09)└─────────────┬─────────────┘
338
+ 10)┌─────────────┴─────────────┐
339
+ 11)│ DataSourceExec │
340
+ 12)│ -------------------- │
341
+ 13)│ bytes: 1560 │
342
+ 14)│ format: memory │
343
+ 15)│ rows: 1 │
344
+ 16)└───────────────────────────┘
345
+
346
+ # Query with filter on json
347
+ query TT
348
+ explain SELECT int_col FROM table4 WHERE string_col != 'foo';
349
+ ----
350
+ logical_plan
351
+ 01)Projection: table4.int_col
352
+ 02)--Filter: table4.string_col != Utf8("foo")
353
+ 03)----TableScan: table4 projection=[int_col, string_col], partial_filters=[table4.string_col != Utf8("foo")]
354
+ physical_plan
355
+ 01)┌───────────────────────────┐
356
+ 02)│ CoalesceBatchesExec │
357
+ 03)└─────────────┬─────────────┘
358
+ 04)┌─────────────┴─────────────┐
359
+ 05)│ FilterExec │
360
+ 06)│ -------------------- │
361
+ 07)│ predicate: │
362
+ 08)│ string_col@1 != foo │
363
+ 09)└─────────────┬─────────────┘
364
+ 10)┌─────────────┴─────────────┐
365
+ 11)│ RepartitionExec │
366
+ 12)└─────────────┬─────────────┘
367
+ 13)┌─────────────┴─────────────┐
368
+ 14)│ DataSourceExec │
369
+ 15)│ -------------------- │
370
+ 16)│ files: 1 │
371
+ 17)│ format: json │
372
+ 18)└───────────────────────────┘
373
+
374
+ # Query with filter on arrow
375
+ query TT
376
+ explain SELECT int_col FROM table5 WHERE string_col != 'foo';
377
+ ----
378
+ logical_plan
379
+ 01)Projection: table5.int_col
380
+ 02)--Filter: table5.string_col != Utf8("foo")
381
+ 03)----TableScan: table5 projection=[int_col, string_col], partial_filters=[table5.string_col != Utf8("foo")]
382
+ physical_plan
383
+ 01)┌───────────────────────────┐
384
+ 02)│ CoalesceBatchesExec │
385
+ 03)└─────────────┬─────────────┘
386
+ 04)┌─────────────┴─────────────┐
387
+ 05)│ FilterExec │
388
+ 06)│ -------------------- │
389
+ 07)│ predicate: │
390
+ 08)│ string_col@1 != foo │
391
+ 09)└─────────────┬─────────────┘
392
+ 10)┌─────────────┴─────────────┐
393
+ 11)│ RepartitionExec │
394
+ 12)└─────────────┬─────────────┘
395
+ 13)┌─────────────┴─────────────┐
396
+ 14)│ DataSourceExec │
397
+ 15)│ -------------------- │
398
+ 16)│ files: 1 │
399
+ 17)│ format: arrow │
400
+ 18)└───────────────────────────┘
401
+
219
402
# cleanup
220
403
statement ok
221
404
drop table table1;
@@ -225,3 +408,9 @@ drop table table2;
225
408
226
409
statement ok
227
410
drop table table3;
411
+
412
+ statement ok
413
+ drop table table4;
414
+
415
+ statement ok
416
+ drop table table5;
0 commit comments