test: add unit test for distributed limit pushdown (#1917)

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
Ruihang Xia
2023-07-10 14:40:18 +08:00
committed by GitHub
parent b31fad5d52
commit 8e256b317d
2 changed files with 26 additions and 0 deletions

View File

@@ -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"

View File

@@ -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));
}
}