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

Method validate_slice_length

r/src/array.cpp:65–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void arrow::r::validate_slice_length(R_xlen_t length, int64_t available) {
66 if (length == NA_INTEGER) {
67 cpp11::stop("Slice 'length' cannot be NA");
68 }
69 if (length < 0) {
70 cpp11::stop("Slice 'length' cannot be negative");
71 }
72 if (length > available) {
73 // For an unknown reason, cpp11::warning() crashes here; however, this
74 // should throw an exception if Rf_warning() jumps, so we need
75 // cpp11::safe[]().
76 cpp11::safe[Rf_warning]("Slice 'length' greater than available length");
77 }
78}
79
80// [[arrow::export]]
81std::shared_ptr<arrow::Array> Array__Slice1(const std::shared_ptr<arrow::Array>& array,

Callers

nothing calls this directly

Calls 1

stopFunction · 0.85

Tested by

no test coverage detected