diff --git a/src/query/Cargo.toml b/src/query/Cargo.toml index 400784201f..36f06ebc64 100644 --- a/src/query/Cargo.toml +++ b/src/query/Cargo.toml @@ -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" diff --git a/src/query/src/dist_plan/analyzer.rs b/src/query/src/dist_plan/analyzer.rs index 7e274fc155..9095ddb6e4 100644 --- a/src/query/src/dist_plan/analyzer.rs +++ b/src/query/src/dist_plan/analyzer.rs @@ -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)); + } }