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

Function DetectNullGeometry

cpp/src/arrow/compute/kernels/vector_search_sorted.cc:122–157  ·  view source on GitHub ↗

Detect the NullGeometry of a primitive or run-end-encoded array

Source from the content-addressed store, hash-verified

120
121/// Detect the NullGeometry of a primitive or run-end-encoded array
122NullGeometry DetectNullGeometry(const Array& array) {
123 if (array.length() == 0) {
124 return NullGeometry::Empty;
125 }
126 if (array.type_id() == Type::RUN_END_ENCODED) {
127 const auto& ree_array = checked_cast<const RunEndEncodedArray&>(array);
128 auto range = ::arrow::ree_util::FindPhysicalRange(*array.data(), array.offset(),
129 array.length());
130 return DetectNullGeometry(*ree_array.values()->Slice(range.first, range.second));
131 }
132 bool null_at_start = array.IsNull(0);
133 bool null_at_end = array.IsNull(array.length() - 1);
134 if (null_at_start && !null_at_end) {
135 return NullGeometry::AtStart;
136 }
137 if (!null_at_start && null_at_end) {
138 return NullGeometry::AtEnd;
139 }
140 if (null_at_start && null_at_end) {
141 return NullGeometry::AllNulls;
142 }
143
144 // No nulls, look at NaNs
145 bool nan_at_start = IsNanPrimitive(array, 0);
146 bool nan_at_end = IsNanPrimitive(array, array.length() - 1);
147 if (nan_at_start && !nan_at_end) {
148 return NullGeometry::AtStart;
149 }
150 if (!nan_at_start && nan_at_end) {
151 return NullGeometry::AtEnd;
152 }
153 if (nan_at_start && nan_at_end) {
154 return NullGeometry::AllNans;
155 }
156 return NullGeometry::NoNulls;
157}
158
159/// Detect the NullGeometry of a chunked array
160NullGeometry DetectNullGeometry(const ChunkedArray& chunked_array) {

Callers 1

DetectNullPlacementMethod · 0.85

Calls 10

IsNanPrimitiveFunction · 0.85
FindPhysicalRangeFunction · 0.50
lengthMethod · 0.45
type_idMethod · 0.45
dataMethod · 0.45
offsetMethod · 0.45
SliceMethod · 0.45
valuesMethod · 0.45
IsNullMethod · 0.45
chunksMethod · 0.45

Tested by

no test coverage detected