Fix drop nth with open end range on 32-bit platforms (#5808)

Fixes #5793

Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
nibon7 2022-06-16 19:39:48 +08:00 committed by GitHub
parent 8c0d60d0fb
commit 8b368b6a4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,9 +137,16 @@ impl Command for DropNth {
// check for equality to isize::MAX because for some reason,
// the parser returns isize::MAX when we provide a range without upper bound (e.g., 5.. )
let to = to as usize;
let mut to = to as usize;
let from = from as usize;
if let PipelineData::Value(Value::List { ref vals, span: _ }, _) = input {
let max = from + vals.len() - 1;
if to > max {
to = max;
}
};
if to > 0 && to as isize == isize::MAX {
lower_bound = Some(from);
vec![from]