Skip to content

Commit 646d93f

Browse files
committed
chore: more join test case for virtual column
Signed-off-by: Kould <[email protected]>
1 parent 748787a commit 646d93f

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

tests/sqllogictests/suites/mode/standalone/ee/explain_virtual_column.test

+109
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,115 @@ HashJoin
353353
├── virtual columns: [v['b']]
354354
└── estimated rows: 1.00
355355

356+
query T
357+
explain select * from t1 join t2 on t1.v['b'] = t2.v['b'];
358+
----
359+
HashJoin
360+
├── output columns: [t1.a (#0), t1.v (#1), t2.a (#2), t2.v (#3)]
361+
├── join type: INNER
362+
├── build keys: [v['b'] (#5)]
363+
├── probe keys: [v['b'] (#4)]
364+
├── keys is null equal: [false]
365+
├── filters: []
366+
├── estimated rows: 1.00
367+
├── TableScan(Build)
368+
│ ├── table: default.test_virtual_db.t2
369+
│ ├── output columns: [a (#2), v (#3), v['b'] (#5)]
370+
│ ├── read rows: 1
371+
│ ├── read size: < 1 KiB
372+
│ ├── partitions total: 1
373+
│ ├── partitions scanned: 1
374+
│ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
375+
│ ├── push downs: [filters: [], limit: NONE]
376+
│ ├── virtual columns: [v['b']]
377+
│ └── estimated rows: 1.00
378+
└── TableScan(Probe)
379+
├── table: default.test_virtual_db.t1
380+
├── output columns: [a (#0), v (#1), v['b'] (#4)]
381+
├── read rows: 1
382+
├── read size: < 1 KiB
383+
├── partitions total: 1
384+
├── partitions scanned: 1
385+
├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
386+
├── push downs: [filters: [], limit: NONE]
387+
├── virtual columns: [v['b']]
388+
└── estimated rows: 1.00
389+
390+
query T
391+
explain select * from t1 join t2 on t1.v['b'] > t2.a;
392+
----
393+
HashJoin
394+
├── output columns: [t1.a (#0), t1.v (#1), t2.a (#2), t2.v (#3)]
395+
├── join type: INNER
396+
├── build keys: []
397+
├── probe keys: []
398+
├── keys is null equal: []
399+
├── filters: [TRY_CAST(v['b'] (#4) AS Int32 NULL) > t2.a (#2)]
400+
├── estimated rows: 1.00
401+
├── TableScan(Build)
402+
│ ├── table: default.test_virtual_db.t2
403+
│ ├── output columns: [a (#2), v (#3)]
404+
│ ├── read rows: 1
405+
│ ├── read size: < 1 KiB
406+
│ ├── partitions total: 1
407+
│ ├── partitions scanned: 1
408+
│ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
409+
│ ├── push downs: [filters: [], limit: NONE]
410+
│ └── estimated rows: 1.00
411+
└── TableScan(Probe)
412+
├── table: default.test_virtual_db.t1
413+
├── output columns: [a (#0), v (#1), v['b'] (#4)]
414+
├── read rows: 1
415+
├── read size: < 1 KiB
416+
├── partitions total: 1
417+
├── partitions scanned: 1
418+
├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
419+
├── push downs: [filters: [], limit: NONE]
420+
├── virtual columns: [v['b']]
421+
└── estimated rows: 1.00
422+
423+
query T
424+
explain select t1.v['b'], sum(t2.a) from t1 join t2 on t1.v['b'] = t2.a group by t1.v['b'];
425+
----
426+
AggregateFinal
427+
├── output columns: [sum(t2.a) (#5), t1.v['b'] (#4)]
428+
├── group by: [v['b']]
429+
├── aggregate functions: [sum(a)]
430+
├── estimated rows: 1.00
431+
└── AggregatePartial
432+
├── group by: [v['b']]
433+
├── aggregate functions: [sum(a)]
434+
├── estimated rows: 1.00
435+
└── HashJoin
436+
├── output columns: [t1.v['b'] (#4), t2.a (#2)]
437+
├── join type: INNER
438+
├── build keys: [t2.a (#2)]
439+
├── probe keys: [CAST(v['b'] (#4) AS Int32 NULL)]
440+
├── keys is null equal: [false]
441+
├── filters: []
442+
├── estimated rows: 1.00
443+
├── TableScan(Build)
444+
│ ├── table: default.test_virtual_db.t2
445+
│ ├── output columns: [a (#2)]
446+
│ ├── read rows: 1
447+
│ ├── read size: < 1 KiB
448+
│ ├── partitions total: 1
449+
│ ├── partitions scanned: 1
450+
│ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
451+
│ ├── push downs: [filters: [], limit: NONE]
452+
│ └── estimated rows: 1.00
453+
└── TableScan(Probe)
454+
├── table: default.test_virtual_db.t1
455+
├── output columns: [v['b'] (#4)]
456+
├── read rows: 1
457+
├── read size: < 1 KiB
458+
├── partitions total: 1
459+
├── partitions scanned: 1
460+
├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
461+
├── push downs: [filters: [], limit: NONE]
462+
├── virtual columns: [v['b']]
463+
└── estimated rows: 1.00
464+
356465
statement ok
357466
drop table t1
358467

0 commit comments

Comments
 (0)