Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leiysky committed Aug 25, 2022
1 parent 0c5dd4d commit ee87f9b
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 40 deletions.
12 changes: 8 additions & 4 deletions src/query/storages/fuse/src/fuse_part.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apach&e License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
Expand Down Expand Up @@ -88,9 +88,13 @@ impl FusePartInfo {
pub fn from_part(info: &PartInfoPtr) -> Result<&FusePartInfo> {
match info.as_any().downcast_ref::<FusePartInfo>() {
Some(part_ref) => Ok(part_ref),
None => Err(ErrorCode::LogicalError(
"Cannot downcast from PartInfo to FusePartInfo.",
)),
None => {
let dbg = format!("{:?}", info);
tracing::info!("{}", dbg);
Err(ErrorCode::LogicalError(
"Cannot downcast from PartInfo to FusePartInfo.",
))
}
}
}
}
Expand Down
57 changes: 57 additions & 0 deletions tests/logictest/auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
statement query T
explain select * from numbers(1) t, numbers(2) t1 where t.number = t1.number;

----
Exchange(Merge)
└── HashJoin: INNER, build keys: [t1.number (#1)], probe keys: [t.number (#0)], join filters: []
├── Exchange(Hash): keys: [t.number (#0)]
│ └── Scan: default.system.numbers, filters: []
└── Exchange(Hash): keys: [t1.number (#1)]
└── Scan: default.system.numbers, filters: []

statement query T
explain select * from numbers(1) t, numbers(2) t1, numbers(3) t2 where t.number = t1.number and t.number = t2.number;

----
Exchange(Merge)
└── HashJoin: INNER, build keys: [t2.number (#2)], probe keys: [t.number (#0)], join filters: []
├── HashJoin: INNER, build keys: [t1.number (#1)], probe keys: [t.number (#0)], join filters: []
│ ├── Exchange(Hash): keys: [t.number (#0)]
│ │ └── Scan: default.system.numbers, filters: []
│ └── Exchange(Hash): keys: [t1.number (#1)]
│ └── Scan: default.system.numbers, filters: []
└── Exchange(Hash): keys: [t2.number (#2)]
└── Scan: default.system.numbers, filters: []

statement query T
explain select * from (select number as a, number+1 as b from numbers(1)) t, numbers(2) t1, numbers(3) t2 where a = t1.number and b = t2.number;

----
Exchange(Merge)
└── HashJoin: INNER, build keys: [t2.number (#4)], probe keys: [t.b (#1)], join filters: []
├── Exchange(Hash): keys: [t.b (#1)]
│ └── HashJoin: INNER, build keys: [t1.number (#3)], probe keys: [t.a (#0)], join filters: []
│ ├── Exchange(Hash): keys: [t.a (#0)]
│ │ └── EvalScalar: [+(numbers.number (#0), 1)]
│ │ └── Scan: default.system.numbers, filters: []
│ └── Exchange(Hash): keys: [t1.number (#3)]
│ └── Scan: default.system.numbers, filters: []
└── Exchange(Hash): keys: [t2.number (#4)]
└── Scan: default.system.numbers, filters: []

statement query T
explain select * from (select sum(number) as number from numbers(1) group by number) t, numbers(2) t1 where t.number = t1.number;

----
Exchange(Merge)
└── HashJoin: INNER, build keys: [t1.number (#4)], probe keys: [t.number (#1)], join filters: []
├── Exchange(Hash): keys: [t.number (#1)]
│ └── Project: [number (#1)]
│ └── EvalScalar: [sum(number) (#3)]
│ └── Aggregate(Final): group items: [numbers.number (#0)], aggregate functions: [sum(number)]
│ └── Aggregate(Partial): group items: [numbers.number (#0)], aggregate functions: [sum(number)]
│ └── Exchange(Hash): keys: [numbers.number (#0)]
│ └── Scan: default.system.numbers, filters: []
└── Exchange(Hash): keys: [t1.number (#4)]
└── Scan: default.system.numbers, filters: []

69 changes: 33 additions & 36 deletions tests/logictest/suites/mode/cluster/exchange.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,55 @@ explain select * from numbers(1) t, numbers(2) t1 where t.number = t1.number;

----
Exchange(Merge)
HashJoin: INNER, build keys: [t1.number (#1)], probe keys: [t.number (#0)], join filters: []
Exchange(Hash): keys: [t.number (#0)]
Scan: default.system.numbers, filters: []
Exchange(Hash): keys: [t1.number (#1)]
Scan: default.system.numbers, filters: []

└── HashJoin: INNER, build keys: [t1.number (#1)], probe keys: [t.number (#0)], join filters: []
├── Exchange(Hash): keys: [t.number (#0)]
│ └── Scan: default.system.numbers, filters: []
└── Exchange(Hash): keys: [t1.number (#1)]
└── Scan: default.system.numbers, filters: []

statement query T
explain select * from numbers(1) t, numbers(2) t1, numbers(3) t2 where t.number = t1.number and t.number = t2.number;

----
Exchange(Merge)
HashJoin: INNER, build keys: [t2.number (#2)], probe keys: [t.number (#0)], join filters: []
HashJoin: INNER, build keys: [t1.number (#1)], probe keys: [t.number (#0)], join filters: []
Exchange(Hash): keys: [t.number (#0)]
Scan: default.system.numbers, filters: []
Exchange(Hash): keys: [t1.number (#1)]
Scan: default.system.numbers, filters: []
Exchange(Hash): keys: [t2.number (#2)]
Scan: default.system.numbers, filters: []

└── HashJoin: INNER, build keys: [t2.number (#2)], probe keys: [t.number (#0)], join filters: []
├── HashJoin: INNER, build keys: [t1.number (#1)], probe keys: [t.number (#0)], join filters: []
│ ├── Exchange(Hash): keys: [t.number (#0)]
│ │ └── Scan: default.system.numbers, filters: []
│ └── Exchange(Hash): keys: [t1.number (#1)]
│ └── Scan: default.system.numbers, filters: []
└── Exchange(Hash): keys: [t2.number (#2)]
└── Scan: default.system.numbers, filters: []

statement query T
explain select * from (select number as a, number+1 as b from numbers(1)) t, numbers(2) t1, numbers(3) t2 where a = t1.number and b = t2.number;

----
Exchange(Merge)
HashJoin: INNER, build keys: [t2.number (#4)], probe keys: [t.b (#1)], join filters: []
Exchange(Hash): keys: [t.b (#1)]
HashJoin: INNER, build keys: [t1.number (#3)], probe keys: [t.a (#0)], join filters: []
Exchange(Hash): keys: [t.a (#0)]
EvalScalar: [+(numbers.number (#0), 1)]
Scan: default.system.numbers, filters: []
Exchange(Hash): keys: [t1.number (#3)]
Scan: default.system.numbers, filters: []
Exchange(Hash): keys: [t2.number (#4)]
Scan: default.system.numbers, filters: []

└── HashJoin: INNER, build keys: [t2.number (#4)], probe keys: [t.b (#1)], join filters: []
├── Exchange(Hash): keys: [t.b (#1)]
│ └── HashJoin: INNER, build keys: [t1.number (#3)], probe keys: [t.a (#0)], join filters: []
│ ├── Exchange(Hash): keys: [t.a (#0)]
│ │ └── EvalScalar: [+(numbers.number (#0), 1)]
│ │ └── Scan: default.system.numbers, filters: []
│ └── Exchange(Hash): keys: [t1.number (#3)]
│ └── Scan: default.system.numbers, filters: []
└── Exchange(Hash): keys: [t2.number (#4)]
└── Scan: default.system.numbers, filters: []

statement query T
explain select * from (select sum(number) as number from numbers(1) group by number) t, numbers(2) t1 where t.number = t1.number;

----
Exchange(Merge)
HashJoin: INNER, build keys: [t1.number (#4)], probe keys: [t.number (#1)], join filters: []
Exchange(Hash): keys: [t.number (#1)]
Project: [number (#1)]
EvalScalar: [sum(number) (#3)]
Aggregate(Final): group items: [numbers.number (#0)], aggregate functions: [sum(number)]
Aggregate(Partial): group items: [numbers.number (#0)], aggregate functions: [sum(number)]
Exchange(Hash): keys: [numbers.number (#0)]
Scan: default.system.numbers, filters: []
Exchange(Hash): keys: [t1.number (#4)]
Scan: default.system.numbers, filters: []
└── HashJoin: INNER, build keys: [t1.number (#4)], probe keys: [t.number (#1)], join filters: []
├── Exchange(Hash): keys: [t.number (#1)]
└── Project: [number (#1)]
└── EvalScalar: [sum(number) (#3)]
└── Aggregate(Final): group items: [numbers.number (#0)], aggregate functions: [sum(number)]
└── Aggregate(Partial): group items: [numbers.number (#0)], aggregate functions: [sum(number)]
└── Exchange(Hash): keys: [numbers.number (#0)]
└── Scan: default.system.numbers, filters: []
└── Exchange(Hash): keys: [t1.number (#4)]
└── Scan: default.system.numbers, filters: []

0 comments on commit ee87f9b

Please sign in to comment.