mirror of
https://github.com/nushell/nushell.git
synced 2025-05-19 09:20: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();
|
||||
} else {
|
||||
self.current += 1;
|
||||
let _ = self.input.next();
|
||||
let _ = self.input.next()?;
|
||||
continue;
|
||||
}
|
||||
} 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]
|
||||
fn selects_many_rows() {
|
||||
Playground::setup("select_test_2", |dirs, sandbox| {
|
||||
|
Loading…
Reference in New Issue
Block a user