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

Function CheckIndexBounds

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

\brief Branchless boundschecking of the values. Processes batches of values at a time and shortcircuits when encountering an out-of-bounds index in a batch

Source from the content-addressed store, hash-verified

564/// values at a time and shortcircuits when encountering an out-of-bounds
565/// index in a batch
566Status CheckIndexBounds(const ArraySpan& values, uint64_t upper_limit) {
567 switch (values.type->id()) {
568 case Type::INT8:
569 return CheckIndexBoundsImpl<int8_t>(values, upper_limit);
570 case Type::INT16:
571 return CheckIndexBoundsImpl<int16_t>(values, upper_limit);
572 case Type::INT32:
573 return CheckIndexBoundsImpl<int32_t>(values, upper_limit);
574 case Type::INT64:
575 return CheckIndexBoundsImpl<int64_t>(values, upper_limit);
576 case Type::UINT8:
577 return CheckIndexBoundsImpl<uint8_t>(values, upper_limit);
578 case Type::UINT16:
579 return CheckIndexBoundsImpl<uint16_t>(values, upper_limit);
580 case Type::UINT32:
581 return CheckIndexBoundsImpl<uint32_t>(values, upper_limit);
582 case Type::UINT64:
583 return CheckIndexBoundsImpl<uint64_t>(values, upper_limit);
584 default:
585 return Status::Invalid("Invalid index type for boundschecking");
586 }
587}
588
589// ----------------------------------------------------------------------
590// Utilities for casting from one integer type to another

Callers 12

WriteIndicesUniformMethod · 0.85
WriteIndicesVaryingMethod · 0.85
WriteIndicesMethod · 0.85
FromArraysMethod · 0.85
BoundsCheckPassesFunction · 0.85
BoundsCheckFailsFunction · 0.85
TESTFunction · 0.85
CheckIndexBoundsInt32Function · 0.85
CheckIndexBoundsUInt32Function · 0.85
FixedWidthTakeExecFunction · 0.85
NullTakeExecFunction · 0.85
TakeExecFunction · 0.85

Calls 2

InvalidFunction · 0.50
idMethod · 0.45

Tested by 3

BoundsCheckPassesFunction · 0.68
BoundsCheckFailsFunction · 0.68
TESTFunction · 0.68