MCPcopy Create free account
hub / github.com/apache/arrow / CheckIntegersInRange

Function CheckIntegersInRange

cpp/src/arrow/util/int_util.cc:682–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

680} // namespace
681
682Status 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
712namespace {
713

Callers 5

IntegersCanFitImplFunction · 0.85
CheckInRangePassesFunction · 0.85
CheckInRangeFailsFunction · 0.85
TESTFunction · 0.85

Calls 3

InvalidFunction · 0.50
TypeErrorFunction · 0.50
idMethod · 0.45

Tested by 3

CheckInRangePassesFunction · 0.68
CheckInRangeFailsFunction · 0.68
TESTFunction · 0.68