From 8257ff73c3a510f8c668eb71585ec13db5fb125a Mon Sep 17 00:00:00 2001 From: leiysky Date: Wed, 11 Jan 2023 22:17:59 +0800 Subject: [PATCH] fix tests --- .../mode/standalone/explain/explain.test | 420 +++++++++--------- 1 file changed, 210 insertions(+), 210 deletions(-) diff --git a/tests/sqllogictests/suites/mode/standalone/explain/explain.test b/tests/sqllogictests/suites/mode/standalone/explain/explain.test index b1694db73df28..e4a1c9517551f 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain/explain.test +++ b/tests/sqllogictests/suites/mode/standalone/explain/explain.test @@ -5,84 +5,84 @@ statement ok drop table if exists t2 all statement ok -create table t1(a int, b int) +create table t1 as select number as a, number as b from numbers(1) statement ok -create table t2(a int, b int) +create table t2 as select number as a, number as b from numbers(5) query T explain select t1.a from t1 where a > 0 ---- Filter ├── filters: [gt(t1.a (#0), 0_u8)] -├── estimated rows: 0.00 +├── estimated rows: 0.33 └── TableScan ├── table: default.default.t1 ├── read rows: 0 ├── read bytes: 0 - ├── partitions total: 0 + ├── partitions total: 1 ├── partitions scanned: 0 - ├── push downs: [filters: [gt(a, 0_i32)], limit: NONE] + ├── push downs: [filters: [gt(a, 0_u64)], limit: NONE] ├── output columns: [0] - └── estimated rows: 0.00 + └── estimated rows: 1.00 query T explain select * from t1, t2 where (t1.a = t2.a and t1.a > 3) or (t1.a = t2.a and t2.a > 5 and t1.a > 1) ---- Filter ├── filters: [or(gt(t1.a (#0), 3_u8), and(gt(t2.a (#2), 5_u8), gt(t1.a (#0), 1_u8)))] -├── estimated rows: 0.00 +├── estimated rows: 0.56 └── HashJoin ├── join type: INNER - ├── build keys: [t2.a (#2)] - ├── probe keys: [t1.a (#0)] + ├── build keys: [t1.a (#0)] + ├── probe keys: [t2.a (#2)] ├── filters: [] - ├── estimated rows: 0.00 - ├── TableScan(Build) - │ ├── table: default.default.t2 - │ ├── read rows: 0 - │ ├── read bytes: 0 - │ ├── partitions total: 0 - │ ├── partitions scanned: 0 - │ ├── push downs: [filters: [], limit: NONE] - │ └── estimated rows: 0.00 - └── Filter(Probe) - ├── filters: [or(gt(t1.a (#0), 3_u8), gt(t1.a (#0), 1_u8))] - ├── estimated rows: 0.00 - └── TableScan - ├── table: default.default.t1 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 - ├── push downs: [filters: [or(gt(a, 3_i32), gt(a, 1_i32))], limit: NONE] - └── estimated rows: 0.00 + ├── estimated rows: 5.00 + ├── Filter(Build) + │ ├── filters: [or(gt(t1.a (#0), 3_u8), gt(t1.a (#0), 1_u8))] + │ ├── estimated rows: 0.33 + │ └── TableScan + │ ├── table: default.default.t1 + │ ├── read rows: 0 + │ ├── read bytes: 0 + │ ├── partitions total: 1 + │ ├── partitions scanned: 0 + │ ├── push downs: [filters: [or(gt(a, 3_u64), gt(a, 1_u64))], limit: NONE] + │ └── estimated rows: 1.00 + └── TableScan(Probe) + ├── table: default.default.t2 + ├── read rows: 5 + ├── read bytes: 94 + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── push downs: [filters: [], limit: NONE] + └── estimated rows: 5.00 query T explain select * from t1, t2 where (t1.a = t2.a and t1.a > 3) or (t1.a = t2.a) ---- HashJoin ├── join type: INNER -├── build keys: [t2.a (#2)] -├── probe keys: [t1.a (#0)] +├── build keys: [t1.a (#0)] +├── probe keys: [t2.a (#2)] ├── filters: [] -├── estimated rows: 0.00 +├── estimated rows: 5.00 ├── TableScan(Build) -│ ├── table: default.default.t2 -│ ├── read rows: 0 -│ ├── read bytes: 0 -│ ├── partitions total: 0 -│ ├── partitions scanned: 0 +│ ├── table: default.default.t1 +│ ├── read rows: 1 +│ ├── read bytes: 62 +│ ├── partitions total: 1 +│ ├── partitions scanned: 1 │ ├── push downs: [filters: [], limit: NONE] -│ └── estimated rows: 0.00 +│ └── estimated rows: 1.00 └── TableScan(Probe) - ├── table: default.default.t1 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 + ├── table: default.default.t2 + ├── read rows: 5 + ├── read bytes: 94 + ├── partitions total: 1 + ├── partitions scanned: 1 ├── push downs: [filters: [], limit: NONE] - └── estimated rows: 0.00 + └── estimated rows: 5.00 query T explain raw select * from t1, t2 where (t1.a = t2.a and t1.a > 3) or (t1.a = t2.a) @@ -516,141 +516,141 @@ query T explain select a from t1 UNION ALL select a from t2 ---- UnionAll -├── estimated rows: 0.00 +├── estimated rows: 6.00 ├── TableScan │ ├── table: default.default.t1 -│ ├── read rows: 0 -│ ├── read bytes: 0 -│ ├── partitions total: 0 -│ ├── partitions scanned: 0 +│ ├── read rows: 1 +│ ├── read bytes: 31 +│ ├── partitions total: 1 +│ ├── partitions scanned: 1 │ ├── push downs: [filters: [], limit: NONE] │ ├── output columns: [0] -│ └── estimated rows: 0.00 +│ └── estimated rows: 1.00 └── TableScan ├── table: default.default.t2 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 + ├── read rows: 5 + ├── read bytes: 47 + ├── partitions total: 1 + ├── partitions scanned: 1 ├── push downs: [filters: [], limit: NONE] ├── output columns: [0] - └── estimated rows: 0.00 + └── estimated rows: 5.00 query T explain select * from t1,t2 where (t1.a > 1 and t2.a > 2) or (t1.b < 3 and t2.b < 4) ---- Filter ├── filters: [or(and(gt(t1.a (#0), 1_u8), gt(t2.a (#2), 2_u8)), and(lt(t1.b (#1), 3_u8), lt(t2.b (#3), 4_u8)))] -├── estimated rows: 0.00 +├── estimated rows: 0.09 └── HashJoin ├── join type: CROSS ├── build keys: [] ├── probe keys: [] ├── filters: [] - ├── estimated rows: 0.00 + ├── estimated rows: 0.83 ├── Filter(Build) - │ ├── filters: [or(gt(t2.a (#2), 2_u8), lt(t2.b (#3), 4_u8))] - │ ├── estimated rows: 0.00 + │ ├── filters: [or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 3_u8))] + │ ├── estimated rows: 0.33 │ └── TableScan - │ ├── table: default.default.t2 - │ ├── read rows: 0 - │ ├── read bytes: 0 - │ ├── partitions total: 0 - │ ├── partitions scanned: 0 - │ ├── push downs: [filters: [or(gt(a, 2_i32), lt(b, 4_i32))], limit: NONE] - │ └── estimated rows: 0.00 + │ ├── table: default.default.t1 + │ ├── read rows: 1 + │ ├── read bytes: 62 + │ ├── partitions total: 1 + │ ├── partitions scanned: 1 + │ ├── push downs: [filters: [or(gt(a, 1_u64), lt(b, 3_u64))], limit: NONE] + │ └── estimated rows: 1.00 └── Filter(Probe) - ├── filters: [or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 3_u8))] - ├── estimated rows: 0.00 + ├── filters: [or(gt(t2.a (#2), 2_u8), lt(t2.b (#3), 4_u8))] + ├── estimated rows: 2.50 └── TableScan - ├── table: default.default.t1 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 - ├── push downs: [filters: [or(gt(a, 1_i32), lt(b, 3_i32))], limit: NONE] - └── estimated rows: 0.00 + ├── table: default.default.t2 + ├── read rows: 5 + ├── read bytes: 94 + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── push downs: [filters: [or(gt(a, 2_u64), lt(b, 4_u64))], limit: NONE] + └── estimated rows: 5.00 query T explain select * from t1,t2 where (t1.a > 1 and t2.a > 2) or (t1.b < 3 and t2.b < 4) or t1.a = 2 ---- Filter ├── filters: [or(or(and(gt(t1.a (#0), 1_u8), gt(t2.a (#2), 2_u8)), and(lt(t1.b (#1), 3_u8), lt(t2.b (#3), 4_u8))), eq(t1.a (#0), 2_u8))] -├── estimated rows: 0.00 +├── estimated rows: 0.19 └── HashJoin ├── join type: CROSS ├── build keys: [] ├── probe keys: [] ├── filters: [] - ├── estimated rows: 0.00 - ├── TableScan(Build) - │ ├── table: default.default.t2 - │ ├── read rows: 0 - │ ├── read bytes: 0 - │ ├── partitions total: 0 - │ ├── partitions scanned: 0 - │ ├── push downs: [filters: [], limit: NONE] - │ └── estimated rows: 0.00 - └── Filter(Probe) - ├── filters: [or(gt(t1.a (#0), 1_u8), or(lt(t1.b (#1), 3_u8), eq(t1.a (#0), 2_u8)))] - ├── estimated rows: 0.00 - └── TableScan - ├── table: default.default.t1 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 - ├── push downs: [filters: [or(gt(a, 1_i32), or(lt(b, 3_i32), eq(a, 2_i32)))], limit: NONE] - └── estimated rows: 0.00 + ├── estimated rows: 1.67 + ├── Filter(Build) + │ ├── filters: [or(gt(t1.a (#0), 1_u8), or(lt(t1.b (#1), 3_u8), eq(t1.a (#0), 2_u8)))] + │ ├── estimated rows: 0.33 + │ └── TableScan + │ ├── table: default.default.t1 + │ ├── read rows: 1 + │ ├── read bytes: 62 + │ ├── partitions total: 1 + │ ├── partitions scanned: 1 + │ ├── push downs: [filters: [or(gt(a, 1_u64), or(lt(b, 3_u64), eq(a, 2_u64)))], limit: NONE] + │ └── estimated rows: 1.00 + └── TableScan(Probe) + ├── table: default.default.t2 + ├── read rows: 5 + ├── read bytes: 94 + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── push downs: [filters: [], limit: NONE] + └── estimated rows: 5.00 statement ok drop table if exists t3 statement ok -create table t3(a int, b int) +create table t3 as select number as a, number as b from numbers(10) query T explain select * from t1,t2, t3 where (t1.a > 1 and t2.a > 2) or (t1.b < 3 and t2.b < 4) or t3.a = 2 ---- Filter ├── filters: [or(or(and(gt(t1.a (#0), 1_u8), gt(t2.a (#2), 2_u8)), and(lt(t1.b (#1), 3_u8), lt(t2.b (#3), 4_u8))), eq(t3.a (#4), 2_u8))] -├── estimated rows: 0.00 +├── estimated rows: 5.56 └── HashJoin ├── join type: CROSS ├── build keys: [] ├── probe keys: [] ├── filters: [] - ├── estimated rows: 0.00 - ├── TableScan(Build) - │ ├── table: default.default.t2 - │ ├── read rows: 0 - │ ├── read bytes: 0 - │ ├── partitions total: 0 - │ ├── partitions scanned: 0 - │ ├── push downs: [filters: [], limit: NONE] - │ └── estimated rows: 0.00 - └── HashJoin(Probe) - ├── join type: CROSS - ├── build keys: [] - ├── probe keys: [] - ├── filters: [] - ├── estimated rows: 0.00 - ├── TableScan(Build) - │ ├── table: default.default.t3 - │ ├── read rows: 0 - │ ├── read bytes: 0 - │ ├── partitions total: 0 - │ ├── partitions scanned: 0 - │ ├── push downs: [filters: [], limit: NONE] - │ └── estimated rows: 0.00 - └── TableScan(Probe) - ├── table: default.default.t1 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 - ├── push downs: [filters: [], limit: NONE] - └── estimated rows: 0.00 + ├── estimated rows: 50.00 + ├── HashJoin(Build) + │ ├── join type: CROSS + │ ├── build keys: [] + │ ├── probe keys: [] + │ ├── filters: [] + │ ├── estimated rows: 5.00 + │ ├── TableScan(Build) + │ │ ├── table: default.default.t1 + │ │ ├── read rows: 1 + │ │ ├── read bytes: 62 + │ │ ├── partitions total: 1 + │ │ ├── partitions scanned: 1 + │ │ ├── push downs: [filters: [], limit: NONE] + │ │ └── estimated rows: 1.00 + │ └── TableScan(Probe) + │ ├── table: default.default.t2 + │ ├── read rows: 5 + │ ├── read bytes: 94 + │ ├── partitions total: 1 + │ ├── partitions scanned: 1 + │ ├── push downs: [filters: [], limit: NONE] + │ └── estimated rows: 5.00 + └── TableScan(Probe) + ├── table: default.default.t3 + ├── read rows: 10 + ├── read bytes: 136 + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── push downs: [filters: [], limit: NONE] + └── estimated rows: 10.00 query T explain select * from t1,t2, t3 where ((t1.a > 1 and t2.a > 2) or (t1.b < 3 and t2.b < 4)) and t3.a > 1 @@ -660,84 +660,84 @@ HashJoin ├── build keys: [] ├── probe keys: [] ├── filters: [] -├── estimated rows: 0.00 +├── estimated rows: 0.82 ├── Filter(Build) -│ ├── filters: [gt(t3.a (#4), 1_u8)] -│ ├── estimated rows: 0.00 -│ └── TableScan -│ ├── table: default.default.t3 -│ ├── read rows: 0 -│ ├── read bytes: 0 -│ ├── partitions total: 0 -│ ├── partitions scanned: 0 -│ ├── push downs: [filters: [gt(a, 1_i32)], limit: NONE] -│ └── estimated rows: 0.00 +│ ├── filters: [or(and(gt(t1.a (#0), 1_u8), gt(t2.a (#2), 2_u8)), and(lt(t1.b (#1), 3_u8), lt(t2.b (#3), 4_u8)))] +│ ├── estimated rows: 0.09 +│ └── HashJoin +│ ├── join type: CROSS +│ ├── build keys: [] +│ ├── probe keys: [] +│ ├── filters: [] +│ ├── estimated rows: 0.83 +│ ├── Filter(Build) +│ │ ├── filters: [or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 3_u8))] +│ │ ├── estimated rows: 0.33 +│ │ └── TableScan +│ │ ├── table: default.default.t1 +│ │ ├── read rows: 1 +│ │ ├── read bytes: 62 +│ │ ├── partitions total: 1 +│ │ ├── partitions scanned: 1 +│ │ ├── push downs: [filters: [or(gt(a, 1_u64), lt(b, 3_u64))], limit: NONE] +│ │ └── estimated rows: 1.00 +│ └── Filter(Probe) +│ ├── filters: [or(gt(t2.a (#2), 2_u8), lt(t2.b (#3), 4_u8))] +│ ├── estimated rows: 2.50 +│ └── TableScan +│ ├── table: default.default.t2 +│ ├── read rows: 5 +│ ├── read bytes: 94 +│ ├── partitions total: 1 +│ ├── partitions scanned: 1 +│ ├── push downs: [filters: [or(gt(a, 2_u64), lt(b, 4_u64))], limit: NONE] +│ └── estimated rows: 5.00 └── Filter(Probe) - ├── filters: [or(and(gt(t1.a (#0), 1_u8), gt(t2.a (#2), 2_u8)), and(lt(t1.b (#1), 3_u8), lt(t2.b (#3), 4_u8)))] - ├── estimated rows: 0.00 - └── HashJoin - ├── join type: CROSS - ├── build keys: [] - ├── probe keys: [] - ├── filters: [] - ├── estimated rows: 0.00 - ├── Filter(Build) - │ ├── filters: [or(gt(t2.a (#2), 2_u8), lt(t2.b (#3), 4_u8))] - │ ├── estimated rows: 0.00 - │ └── TableScan - │ ├── table: default.default.t2 - │ ├── read rows: 0 - │ ├── read bytes: 0 - │ ├── partitions total: 0 - │ ├── partitions scanned: 0 - │ ├── push downs: [filters: [or(gt(a, 2_i32), lt(b, 4_i32))], limit: NONE] - │ └── estimated rows: 0.00 - └── Filter(Probe) - ├── filters: [or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 3_u8))] - ├── estimated rows: 0.00 - └── TableScan - ├── table: default.default.t1 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 - ├── push downs: [filters: [or(gt(a, 1_i32), lt(b, 3_i32))], limit: NONE] - └── estimated rows: 0.00 + ├── filters: [gt(t3.a (#4), 1_u8)] + ├── estimated rows: 8.89 + └── TableScan + ├── table: default.default.t3 + ├── read rows: 10 + ├── read bytes: 136 + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── push downs: [filters: [gt(a, 1_u64)], limit: NONE] + └── estimated rows: 10.00 query T explain select * from t1,t2 where ((t1.a > 1 or t1.b < 2) and t2.a > 2) or (t1.b < 3 and t2.b < 4) ---- Filter ├── filters: [or(and(or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 2_u8)), gt(t2.a (#2), 2_u8)), and(lt(t1.b (#1), 3_u8), lt(t2.b (#3), 4_u8)))] -├── estimated rows: 0.00 +├── estimated rows: 0.09 └── HashJoin ├── join type: CROSS ├── build keys: [] ├── probe keys: [] ├── filters: [] - ├── estimated rows: 0.00 + ├── estimated rows: 0.83 ├── Filter(Build) - │ ├── filters: [or(gt(t2.a (#2), 2_u8), lt(t2.b (#3), 4_u8))] - │ ├── estimated rows: 0.00 + │ ├── filters: [or(or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 2_u8)), lt(t1.b (#1), 3_u8))] + │ ├── estimated rows: 0.33 │ └── TableScan - │ ├── table: default.default.t2 - │ ├── read rows: 0 - │ ├── read bytes: 0 - │ ├── partitions total: 0 - │ ├── partitions scanned: 0 - │ ├── push downs: [filters: [or(gt(a, 2_i32), lt(b, 4_i32))], limit: NONE] - │ └── estimated rows: 0.00 + │ ├── table: default.default.t1 + │ ├── read rows: 1 + │ ├── read bytes: 62 + │ ├── partitions total: 1 + │ ├── partitions scanned: 1 + │ ├── push downs: [filters: [or(or(gt(a, 1_u64), lt(b, 2_u64)), lt(b, 3_u64))], limit: NONE] + │ └── estimated rows: 1.00 └── Filter(Probe) - ├── filters: [or(or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 2_u8)), lt(t1.b (#1), 3_u8))] - ├── estimated rows: 0.00 + ├── filters: [or(gt(t2.a (#2), 2_u8), lt(t2.b (#3), 4_u8))] + ├── estimated rows: 2.50 └── TableScan - ├── table: default.default.t1 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 - ├── push downs: [filters: [or(or(gt(a, 1_i32), lt(b, 2_i32)), lt(b, 3_i32))], limit: NONE] - └── estimated rows: 0.00 + ├── table: default.default.t2 + ├── read rows: 5 + ├── read bytes: 94 + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── push downs: [filters: [or(gt(a, 2_u64), lt(b, 4_u64))], limit: NONE] + └── estimated rows: 5.00 query T explain select * from t1,t2 where (t1.a > 1 or t1.b < 2) and (t1.a > 1 or t1.b < 2) @@ -747,26 +747,26 @@ HashJoin ├── build keys: [] ├── probe keys: [] ├── filters: [] -├── estimated rows: 0.00 -├── TableScan(Build) -│ ├── table: default.default.t2 -│ ├── read rows: 0 -│ ├── read bytes: 0 -│ ├── partitions total: 0 -│ ├── partitions scanned: 0 -│ ├── push downs: [filters: [], limit: NONE] -│ └── estimated rows: 0.00 -└── Filter(Probe) - ├── filters: [or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 2_u8))] - ├── estimated rows: 0.00 - └── TableScan - ├── table: default.default.t1 - ├── read rows: 0 - ├── read bytes: 0 - ├── partitions total: 0 - ├── partitions scanned: 0 - ├── push downs: [filters: [or(gt(a, 1_i32), lt(b, 2_i32))], limit: NONE] - └── estimated rows: 0.00 +├── estimated rows: 1.67 +├── Filter(Build) +│ ├── filters: [or(gt(t1.a (#0), 1_u8), lt(t1.b (#1), 2_u8))] +│ ├── estimated rows: 0.33 +│ └── TableScan +│ ├── table: default.default.t1 +│ ├── read rows: 1 +│ ├── read bytes: 62 +│ ├── partitions total: 1 +│ ├── partitions scanned: 1 +│ ├── push downs: [filters: [or(gt(a, 1_u64), lt(b, 2_u64))], limit: NONE] +│ └── estimated rows: 1.00 +└── TableScan(Probe) + ├── table: default.default.t2 + ├── read rows: 5 + ├── read bytes: 94 + ├── partitions total: 1 + ├── partitions scanned: 1 + ├── push downs: [filters: [], limit: NONE] + └── estimated rows: 5.00 statement ok drop table t1