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

Class ExecValue

cpp/src/arrow/compute/exec.h:275–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273/// @{
274
275struct ExecValue {
276 ArraySpan array = {};
277 const Scalar* scalar = NULLPTR;
278
279 ExecValue(const Scalar* scalar) // NOLINT implicit conversion
280 : scalar(scalar) {}
281
282 ExecValue(ArraySpan array) // NOLINT implicit conversion
283 : array(std::move(array)) {}
284
285 ExecValue(const ArrayData& array) { // NOLINT implicit conversion
286 this->array.SetMembers(array);
287 }
288
289 ExecValue() = default;
290 ExecValue(const ExecValue& other) = default;
291 ExecValue& operator=(const ExecValue& other) = default;
292 ExecValue(ExecValue&& other) = default;
293 ExecValue& operator=(ExecValue&& other) = default;
294
295 int64_t length() const { return this->is_array() ? this->array.length : 1; }
296
297 bool is_array() const { return this->scalar == NULLPTR; }
298 bool is_scalar() const { return !this->is_array(); }
299
300 void SetArray(const ArrayData& array) {
301 this->array.SetMembers(array);
302 this->scalar = NULLPTR;
303 }
304
305 void SetScalar(const Scalar* scalar) { this->scalar = scalar; }
306
307 template <typename ExactType>
308 const ExactType& scalar_as() const {
309 return ::arrow::internal::checked_cast<const ExactType&>(*this->scalar);
310 }
311
312 /// XXX: here temporarily for compatibility with datum, see
313 /// e.g. MakeStructExec in scalar_nested.cc
314 int64_t null_count() const {
315 if (this->is_array()) {
316 return this->array.GetNullCount();
317 } else {
318 return this->scalar->is_valid ? 0 : 1;
319 }
320 }
321
322 const DataType* type() const {
323 if (this->is_array()) {
324 return array.type;
325 } else {
326 return scalar->type.get();
327 }
328 }
329};
330
331struct ARROW_EXPORT ExecResult {
332 // The default value of the variant is ArraySpan

Callers 3

BM_CastDispatchBaselineFunction · 0.70
InitMethod · 0.50
EncodeMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected