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

Method FullyValidateOffsets

cpp/src/arrow/array/validate.cc:834–854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832 /// \pre basic validation has already been performed
833 template <typename offset_type>
834 Status FullyValidateOffsets(int64_t offset_limit) {
835 const auto* offsets = data.GetValues<offset_type>(1);
836 auto prev_offset = offsets[0];
837 if (prev_offset < 0) {
838 return Status::Invalid("Offset invariant failure: array starts at negative offset ",
839 prev_offset);
840 }
841 for (int64_t i = 1; i <= data.length; ++i) {
842 const auto current_offset = offsets[i];
843 if (current_offset < prev_offset) {
844 return Status::Invalid("Offset invariant failure: non-monotonic offset at slot ",
845 i, ": ", current_offset, " < ", prev_offset);
846 }
847 if (current_offset > offset_limit) {
848 return Status::Invalid("Offset invariant failure: offset for slot ", i,
849 " out of bounds: ", current_offset, " > ", offset_limit);
850 }
851 prev_offset = current_offset;
852 }
853 return Status::OK();
854 }
855
856 template <typename offset_type>
857 Status OutOfBoundsListViewOffset(int64_t slot, int64_t offset_limit) {

Callers

nothing calls this directly

Calls 2

InvalidFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected