| 680 | } // namespace |
| 681 | |
| 682 | Status CheckIntegersInRange(const ArraySpan& values, const Scalar& bound_lower, |
| 683 | const Scalar& bound_upper) { |
| 684 | Type::type type_id = values.type->id(); |
| 685 | if (bound_lower.type->id() != type_id || bound_upper.type->id() != type_id || |
| 686 | !bound_lower.is_valid || !bound_upper.is_valid) { |
| 687 | return Status::Invalid("Scalar bound types must be non-null and same type as data"); |
| 688 | } |
| 689 | |
| 690 | switch (type_id) { |
| 691 | case Type::INT8: |
| 692 | return CheckIntegersInRangeImpl<Int8Type>(values, bound_lower, bound_upper); |
| 693 | case Type::INT16: |
| 694 | return CheckIntegersInRangeImpl<Int16Type>(values, bound_lower, bound_upper); |
| 695 | case Type::INT32: |
| 696 | return CheckIntegersInRangeImpl<Int32Type>(values, bound_lower, bound_upper); |
| 697 | case Type::INT64: |
| 698 | return CheckIntegersInRangeImpl<Int64Type>(values, bound_lower, bound_upper); |
| 699 | case Type::UINT8: |
| 700 | return CheckIntegersInRangeImpl<UInt8Type>(values, bound_lower, bound_upper); |
| 701 | case Type::UINT16: |
| 702 | return CheckIntegersInRangeImpl<UInt16Type>(values, bound_lower, bound_upper); |
| 703 | case Type::UINT32: |
| 704 | return CheckIntegersInRangeImpl<UInt32Type>(values, bound_lower, bound_upper); |
| 705 | case Type::UINT64: |
| 706 | return CheckIntegersInRangeImpl<UInt64Type>(values, bound_lower, bound_upper); |
| 707 | default: |
| 708 | return Status::TypeError("Invalid index type for boundschecking"); |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | namespace { |
| 713 | |