fix(servers): report the dryrun row limit instead of "data is required" (#10491)

* test(servers): expect the dryrun row limit in the error message

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* fix(servers): report the dryrun row limit instead of "data is required"

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

---------

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>
This commit is contained in:
dayan02dev
2026-11-17 22:28:50 +00:00
committed by GitHub
parent 95809cd3da
commit 2d2e351dbd
2 changed files with 56 additions and 3 deletions
+17 -3
View File
@@ -571,12 +571,15 @@ fn check_pipeline_name_exists(pipeline_name: Option<String>) -> Result<String> {
})
}
/// Check if the data length less than 10
/// The maximum number of rows the pipeline dryrun API accepts.
const MAX_DRYRUN_ROWS: usize = 10;
/// Check that the dryrun data has at most [`MAX_DRYRUN_ROWS`] rows.
fn check_data_valid(data_len: usize) -> Result<()> {
ensure!(
data_len <= 10,
data_len <= MAX_DRYRUN_ROWS,
InvalidParameterSnafu {
reason: "data is required",
reason: format!("dryrun data must not exceed {MAX_DRYRUN_ROWS} rows, got {data_len}"),
}
);
Ok(())
@@ -1124,6 +1127,17 @@ mod tests {
use super::*;
#[test]
fn test_check_data_valid() {
assert!(check_data_valid(0).is_ok());
assert!(check_data_valid(10).is_ok());
let err = check_data_valid(11).unwrap_err();
assert_eq!(
err.output_msg(),
"Invalid request parameter: dryrun data must not exceed 10 rows, got 11"
);
}
#[test]
fn test_transform_ndjson() {
let s = "{\"a\": 1}\n{\"b\": 2}";