mirror of
https://github.com/nushell/nushell.git
synced 2025-05-19 17:30:45 +02:00
fix: inefficient select with large row number (#15730)
Fixes #15716 # Description Returns None early if the input iterator is depleted. # User-Facing Changes Should be none # Tests + Formatting +1 # After Submitting
This commit is contained in:
parent
a9252c5075
commit
8352a09117
@ -310,7 +310,7 @@ impl Iterator for NthIterator {
|
|||||||
return self.input.next();
|
return self.input.next();
|
||||||
} else {
|
} else {
|
||||||
self.current += 1;
|
self.current += 1;
|
||||||
let _ = self.input.next();
|
let _ = self.input.next()?;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,6 +134,12 @@ fn selects_a_row() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn selects_large_row_number() {
|
||||||
|
let actual = nu!("seq 1 5 | select 9999999999 | to nuon");
|
||||||
|
assert_eq!(actual.out, "[]");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn selects_many_rows() {
|
fn selects_many_rows() {
|
||||||
Playground::setup("select_test_2", |dirs, sandbox| {
|
Playground::setup("select_test_2", |dirs, sandbox| {
|
||||||
|
Loading…
Reference in New Issue
Block a user