This function returns the next/previous value depending on the `INC` value. If `true`, it returns the next value; otherwise it returns the previous value.
(value: ScalarValue)
| 1280 | /// This function returns the next/previous value depending on the `INC` value. |
| 1281 | /// If `true`, it returns the next value; otherwise it returns the previous value. |
| 1282 | fn next_value_helper<const INC: bool>(value: ScalarValue) -> ScalarValue { |
| 1283 | use ScalarValue::*; |
| 1284 | match value { |
| 1285 | // f32/f64::NEG_INF/INF and f32/f64::NaN values should not emerge at this point. |
| 1286 | Float32(Some(val)) => { |
| 1287 | debug_assert!(val.is_finite(), "Non-standardized floating point usage"); |
| 1288 | Float32(Some(if INC { next_up(val) } else { next_down(val) })) |
| 1289 | } |
| 1290 | Float64(Some(val)) => { |
| 1291 | debug_assert!(val.is_finite(), "Non-standardized floating point usage"); |
| 1292 | Float64(Some(if INC { next_up(val) } else { next_down(val) })) |
| 1293 | } |
| 1294 | Int8(Some(val)) => Int8(Some(increment_decrement::<INC, i8>(val))), |
| 1295 | Int16(Some(val)) => Int16(Some(increment_decrement::<INC, i16>(val))), |
| 1296 | Int32(Some(val)) => Int32(Some(increment_decrement::<INC, i32>(val))), |
| 1297 | Int64(Some(val)) => Int64(Some(increment_decrement::<INC, i64>(val))), |
| 1298 | UInt8(Some(val)) => UInt8(Some(increment_decrement::<INC, u8>(val))), |
| 1299 | UInt16(Some(val)) => UInt16(Some(increment_decrement::<INC, u16>(val))), |
| 1300 | UInt32(Some(val)) => UInt32(Some(increment_decrement::<INC, u32>(val))), |
| 1301 | UInt64(Some(val)) => UInt64(Some(increment_decrement::<INC, u64>(val))), |
| 1302 | DurationSecond(Some(val)) => { |
| 1303 | DurationSecond(Some(increment_decrement::<INC, i64>(val))) |
| 1304 | } |
| 1305 | DurationMillisecond(Some(val)) => { |
| 1306 | DurationMillisecond(Some(increment_decrement::<INC, i64>(val))) |
| 1307 | } |
| 1308 | DurationMicrosecond(Some(val)) => { |
| 1309 | DurationMicrosecond(Some(increment_decrement::<INC, i64>(val))) |
| 1310 | } |
| 1311 | DurationNanosecond(Some(val)) => { |
| 1312 | DurationNanosecond(Some(increment_decrement::<INC, i64>(val))) |
| 1313 | } |
| 1314 | TimestampSecond(Some(val), tz) => { |
| 1315 | TimestampSecond(Some(increment_decrement::<INC, i64>(val)), tz) |
| 1316 | } |
| 1317 | TimestampMillisecond(Some(val), tz) => { |
| 1318 | TimestampMillisecond(Some(increment_decrement::<INC, i64>(val)), tz) |
| 1319 | } |
| 1320 | TimestampMicrosecond(Some(val), tz) => { |
| 1321 | TimestampMicrosecond(Some(increment_decrement::<INC, i64>(val)), tz) |
| 1322 | } |
| 1323 | TimestampNanosecond(Some(val), tz) => { |
| 1324 | TimestampNanosecond(Some(increment_decrement::<INC, i64>(val)), tz) |
| 1325 | } |
| 1326 | IntervalYearMonth(Some(val)) => { |
| 1327 | IntervalYearMonth(Some(increment_decrement::<INC, i32>(val))) |
| 1328 | } |
| 1329 | IntervalDayTime(Some(val)) => IntervalDayTime(Some(increment_decrement::< |
| 1330 | INC, |
| 1331 | arrow::datatypes::IntervalDayTime, |
| 1332 | >(val))), |
| 1333 | IntervalMonthDayNano(Some(val)) => { |
| 1334 | IntervalMonthDayNano(Some(increment_decrement::< |
| 1335 | INC, |
| 1336 | arrow::datatypes::IntervalMonthDayNano, |
| 1337 | >(val))) |
| 1338 | } |
| 1339 | _ => value, // Unbounded values return without change. |