@@ -54,10 +54,36 @@ STORED AS PARQUET
5454LOCATION 'test_files/scratch/explain_tree/table2.parquet';
5555
5656
57- # table3: Memoru
57+ # table3: Memory
5858statement ok
5959CREATE TABLE table3 as select * from table1;
6060
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+
6187######## Begin Queries ########
6288
6389# Filter
@@ -83,7 +109,10 @@ physical_plan
8310912)└─────────────┬─────────────┘
8411013)┌─────────────┴─────────────┐
8511114)│ DataSourceExec │
86- 15)└───────────────────────────┘
112+ 15)│ -------------------- │
113+ 16)│ files: 1 │
114+ 17)│ format: csv │
115+ 18)└───────────────────────────┘
87116
88117# Aggregate
89118query TT
@@ -110,7 +139,10 @@ physical_plan
11013915)└─────────────┬─────────────┘
11114016)┌─────────────┴─────────────┐
11214117)│ DataSourceExec │
113- 18)└───────────────────────────┘
142+ 18)│ -------------------- │
143+ 19)│ files: 1 │
144+ 20)│ format: csv │
145+ 21)└───────────────────────────┘
114146
115147# 2 Joins
116148query TT
@@ -139,7 +171,10 @@ physical_plan
13917115)└─────────────┬─────────────┘└─────────────┬─────────────┘
14017216)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
14117317)│ DataSourceExec ││ DataSourceExec │
142- 18)└───────────────────────────┘└───────────────────────────┘
174+ 18)│ -------------------- ││ -------------------- │
175+ 19)│ files: 1 ││ files: 1 │
176+ 20)│ format: csv ││ format: parquet │
177+ 21)└───────────────────────────┘└───────────────────────────┘
143178
144179# 3 Joins
145180query TT
@@ -175,18 +210,22 @@ physical_plan
17521013)┌─────────────┴─────────────┐┌─────────────┴─────────────┐┌─────────────┴─────────────┐
17621114)│ CoalesceBatchesExec ││ CoalesceBatchesExec ││ DataSourceExec │
17721215)│ ││ ││ -------------------- │
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)└───────────────────────────┘└───────────────────────────┘
190229
191230# Long Filter (demonstrate what happens with wrapping)
192231query TT
@@ -213,7 +252,156 @@ physical_plan
21325212)└─────────────┬─────────────┘
21425313)┌─────────────┴─────────────┐
21525414)│ 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 table2 WHERE string_col != 'foo';
263+ ----
264+ logical_plan
265+ 01)Projection: table2.int_col
266+ 02)--Filter: table2.string_col != Utf8View("foo")
267+ 03)----TableScan: table2 projection=[int_col, string_col], partial_filters=[table2.string_col != Utf8View("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: parquet │
286+ 18)│ │
287+ 19)│ predicate: │
288+ 20)│ string_col@1 != foo │
289+ 21)└───────────────────────────┘
290+
291+
292+ # Query with filter on parquet
293+ query TT
294+ explain SELECT int_col FROM table2 WHERE string_col != 'foo';
295+ ----
296+ logical_plan
297+ 01)Projection: table2.int_col
298+ 02)--Filter: table2.string_col != Utf8View("foo")
299+ 03)----TableScan: table2 projection=[int_col, string_col], partial_filters=[table2.string_col != Utf8View("foo")]
300+ physical_plan
301+ 01)┌───────────────────────────┐
302+ 02)│ CoalesceBatchesExec │
303+ 03)└─────────────┬─────────────┘
304+ 04)┌─────────────┴─────────────┐
305+ 05)│ FilterExec │
306+ 06)│ -------------------- │
307+ 07)│ predicate: │
308+ 08)│ string_col@1 != foo │
309+ 09)└─────────────┬─────────────┘
310+ 10)┌─────────────┴─────────────┐
311+ 11)│ RepartitionExec │
312+ 12)└─────────────┬─────────────┘
313+ 13)┌─────────────┴─────────────┐
314+ 14)│ DataSourceExec │
315+ 15)│ -------------------- │
316+ 16)│ files: 1 │
317+ 17)│ format: parquet │
318+ 18)│ │
319+ 19)│ predicate: │
320+ 20)│ string_col@1 != foo │
321+ 21)└───────────────────────────┘
322+
323+ # Query with filter on memory
324+ query TT
325+ explain SELECT int_col FROM table3 WHERE string_col != 'foo';
326+ ----
327+ logical_plan
328+ 01)Projection: table3.int_col
329+ 02)--Filter: table3.string_col != Utf8("foo")
330+ 03)----TableScan: table3 projection=[int_col, string_col]
331+ physical_plan
332+ 01)┌───────────────────────────┐
333+ 02)│ CoalesceBatchesExec │
334+ 03)└─────────────┬─────────────┘
335+ 04)┌─────────────┴─────────────┐
336+ 05)│ FilterExec │
337+ 06)│ -------------------- │
338+ 07)│ predicate: │
339+ 08)│ string_col@1 != foo │
340+ 09)└─────────────┬─────────────┘
341+ 10)┌─────────────┴─────────────┐
342+ 11)│ DataSourceExec │
343+ 12)│ -------------------- │
344+ 13)│ bytes: 1560 │
345+ 14)│ format: memory │
346+ 15)│ rows: 1 │
347+ 16)└───────────────────────────┘
348+
349+ # Query with filter on json
350+ query TT
351+ explain SELECT int_col FROM table4 WHERE string_col != 'foo';
352+ ----
353+ logical_plan
354+ 01)Projection: table4.int_col
355+ 02)--Filter: table4.string_col != Utf8("foo")
356+ 03)----TableScan: table4 projection=[int_col, string_col], partial_filters=[table4.string_col != Utf8("foo")]
357+ physical_plan
358+ 01)┌───────────────────────────┐
359+ 02)│ CoalesceBatchesExec │
360+ 03)└─────────────┬─────────────┘
361+ 04)┌─────────────┴─────────────┐
362+ 05)│ FilterExec │
363+ 06)│ -------------------- │
364+ 07)│ predicate: │
365+ 08)│ string_col@1 != foo │
366+ 09)└─────────────┬─────────────┘
367+ 10)┌─────────────┴─────────────┐
368+ 11)│ RepartitionExec │
369+ 12)└─────────────┬─────────────┘
370+ 13)┌─────────────┴─────────────┐
371+ 14)│ DataSourceExec │
372+ 15)│ -------------------- │
373+ 16)│ files: 1 │
374+ 17)│ format: json │
375+ 18)└───────────────────────────┘
376+
377+ # Query with filter on arrow
378+ query TT
379+ explain SELECT int_col FROM table5 WHERE string_col != 'foo';
380+ ----
381+ logical_plan
382+ 01)Projection: table5.int_col
383+ 02)--Filter: table5.string_col != Utf8("foo")
384+ 03)----TableScan: table5 projection=[int_col, string_col], partial_filters=[table5.string_col != Utf8("foo")]
385+ physical_plan
386+ 01)┌───────────────────────────┐
387+ 02)│ CoalesceBatchesExec │
388+ 03)└─────────────┬─────────────┘
389+ 04)┌─────────────┴─────────────┐
390+ 05)│ FilterExec │
391+ 06)│ -------------------- │
392+ 07)│ predicate: │
393+ 08)│ string_col@1 != foo │
394+ 09)└─────────────┬─────────────┘
395+ 10)┌─────────────┴─────────────┐
396+ 11)│ RepartitionExec │
397+ 12)└─────────────┬─────────────┘
398+ 13)┌─────────────┴─────────────┐
399+ 14)│ DataSourceExec │
400+ 15)│ -------------------- │
401+ 16)│ files: 1 │
402+ 17)│ format: arrow │
403+ 18)└───────────────────────────┘
404+
217405
218406
219407# cleanup
@@ -225,3 +413,9 @@ drop table table2;
225413
226414statement ok
227415drop table table3;
416+
417+ statement ok
418+ drop table table4;
419+
420+ statement ok
421+ drop table table5;
0 commit comments