mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-18 14:00:39 +00:00
test: add unit test for distributed limit pushdown (#1917)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -52,6 +52,7 @@ tokio.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
approx_eq = "0.1"
|
||||
catalog = { path = "../catalog", features = ["testing"] }
|
||||
common-function-macro = { path = "../common/function-macro" }
|
||||
format_num = "0.1"
|
||||
num = "0.4"
|
||||
|
||||
@@ -314,4 +314,29 @@ mod test {
|
||||
);
|
||||
assert_eq!(expected, format!("{:?}", result));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transform_single_limit() {
|
||||
let numbers_table = Arc::new(NumbersTable::new(0)) as _;
|
||||
let table_source = Arc::new(DefaultTableSource::new(Arc::new(
|
||||
DfTableProviderAdapter::new(numbers_table),
|
||||
)));
|
||||
|
||||
let plan = LogicalPlanBuilder::scan_with_filters("t", table_source, None, vec![])
|
||||
.unwrap()
|
||||
.limit(0, Some(1))
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let config = ConfigOptions::default();
|
||||
let result = DistPlannerAnalyzer {}.analyze(plan, &config).unwrap();
|
||||
let expected = String::from(
|
||||
"Limit: skip=0, fetch=1\
|
||||
\n MergeScan [is_placeholder=false]\
|
||||
\n Limit: skip=0, fetch=1\
|
||||
\n TableScan: t",
|
||||
);
|
||||
assert_eq!(expected, format!("{:?}", result));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user