Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
array.h
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
18 #ifndef ARROW_ARRAY_H
19 #define ARROW_ARRAY_H
20 
21 #include <cmath>
22 #include <cstdint>
23 #include <memory>
24 #include <string>
25 #include <vector>
26 
27 #include "arrow/buffer.h"
28 #include "arrow/type.h"
29 #include "arrow/type_fwd.h"
30 #include "arrow/type_traits.h"
31 #include "arrow/util/bit-util.h"
32 #include "arrow/util/macros.h"
33 #include "arrow/util/visibility.h"
34 #include "arrow/visitor.h"
35 
36 namespace arrow {
37 
38 using BufferVector = std::vector<std::shared_ptr<Buffer>>;
39 
40 // When slicing, we do not know the null count of the sliced range without
41 // doing some computation. To avoid doing this eagerly, we set the null count
42 // to -1 (any negative number will do). When Array::null_count is called the
43 // first time, the null count will be computed. See ARROW-33
44 constexpr int64_t kUnknownNullCount = -1;
45 
46 class MemoryPool;
47 class Status;
48 
49 template <typename T>
50 struct Decimal;
51 
52 // ----------------------------------------------------------------------
53 // Generic array data container
54 
86 struct ARROW_EXPORT ArrayData {
87  ArrayData() : length(0) {}
88 
89  ArrayData(const std::shared_ptr<DataType>& type, int64_t length,
90  int64_t null_count = kUnknownNullCount, int64_t offset = 0)
91  : type(type), length(length), null_count(null_count), offset(offset) {}
92 
93  ArrayData(const std::shared_ptr<DataType>& type, int64_t length,
94  const std::vector<std::shared_ptr<Buffer>>& buffers,
95  int64_t null_count = kUnknownNullCount, int64_t offset = 0)
96  : ArrayData(type, length, null_count, offset) {
97  this->buffers = buffers;
98  }
99 
100  ArrayData(const std::shared_ptr<DataType>& type, int64_t length,
101  std::vector<std::shared_ptr<Buffer>>&& buffers,
102  int64_t null_count = kUnknownNullCount, int64_t offset = 0)
103  : ArrayData(type, length, null_count, offset) {
104  this->buffers = std::move(buffers);
105  }
106 
107  // Move constructor
108  ArrayData(ArrayData&& other) noexcept
109  : type(std::move(other.type)),
110  length(other.length),
111  null_count(other.null_count),
112  offset(other.offset),
113  buffers(std::move(other.buffers)),
114  child_data(std::move(other.child_data)) {}
115 
116  ArrayData(const ArrayData& other) noexcept
117  : type(other.type),
118  length(other.length),
119  null_count(other.null_count),
120  offset(other.offset),
121  buffers(other.buffers),
122  child_data(other.child_data) {}
123 
124  // Move assignment
126  type = std::move(other.type);
127  length = other.length;
128  null_count = other.null_count;
129  offset = other.offset;
130  buffers = std::move(other.buffers);
131  child_data = std::move(other.child_data);
132  return *this;
133  }
134 
135  std::shared_ptr<ArrayData> ShallowCopy() const {
136  return std::make_shared<ArrayData>(*this);
137  }
138 
139  std::shared_ptr<DataType> type;
140  int64_t length;
141  int64_t null_count;
142  int64_t offset;
143  std::vector<std::shared_ptr<Buffer>> buffers;
144  std::vector<std::shared_ptr<ArrayData>> child_data;
145 };
146 
147 #ifndef ARROW_NO_DEPRECATED_API
148 
155 ARROW_EXPORT
156 Status MakeArray(const std::shared_ptr<ArrayData>& data, std::shared_ptr<Array>* out);
157 
158 #endif
159 
163 ARROW_EXPORT
164 std::shared_ptr<Array> MakeArray(const std::shared_ptr<ArrayData>& data);
165 
166 // ----------------------------------------------------------------------
167 // User array accessor types
168 
180 class ARROW_EXPORT Array {
181  public:
182  virtual ~Array() = default;
183 
185  bool IsNull(int64_t i) const {
186  return null_bitmap_data_ != NULLPTR &&
187  BitUtil::BitNotSet(null_bitmap_data_, i + data_->offset);
188  }
189 
192  bool IsValid(int64_t i) const {
193  return null_bitmap_data_ != NULLPTR &&
194  BitUtil::GetBit(null_bitmap_data_, i + data_->offset);
195  }
196 
198  int64_t length() const { return data_->length; }
199 
202  int64_t offset() const { return data_->offset; }
203 
208  int64_t null_count() const;
209 
210  std::shared_ptr<DataType> type() const { return data_->type; }
211  Type::type type_id() const { return data_->type->id(); }
212 
217  std::shared_ptr<Buffer> null_bitmap() const { return data_->buffers[0]; }
218 
223  const uint8_t* null_bitmap_data() const { return null_bitmap_data_; }
224 
225  bool Equals(const Array& arr) const;
226  bool Equals(const std::shared_ptr<Array>& arr) const;
227 
228  bool ApproxEquals(const std::shared_ptr<Array>& arr) const;
229  bool ApproxEquals(const Array& arr) const;
230 
233  bool RangeEquals(int64_t start_idx, int64_t end_idx, int64_t other_start_idx,
234  const std::shared_ptr<Array>& other) const;
235 
236  bool RangeEquals(const Array& other, int64_t start_idx, int64_t end_idx,
237  int64_t other_start_idx) const;
238 
239  Status Accept(ArrayVisitor* visitor) const;
240 
250  std::shared_ptr<Array> Slice(int64_t offset, int64_t length) const;
251 
253  std::shared_ptr<Array> Slice(int64_t offset) const;
254 
255  std::shared_ptr<ArrayData> data() const { return data_; }
256 
257  int num_fields() const { return static_cast<int>(data_->child_data.size()); }
258 
260  std::string ToString() const;
261 
262  protected:
263  Array() {}
264 
265  std::shared_ptr<ArrayData> data_;
266  const uint8_t* null_bitmap_data_;
267 
269  inline void SetData(const std::shared_ptr<ArrayData>& data) {
270  if (data->buffers.size() > 0 && data->buffers[0]) {
271  null_bitmap_data_ = data->buffers[0]->data();
272  } else {
273  null_bitmap_data_ = NULLPTR;
274  }
275  data_ = data;
276  }
277 
278  private:
280 };
281 
282 static inline std::ostream& operator<<(std::ostream& os, const Array& x) {
283  os << x.ToString();
284  return os;
285 }
286 
287 class ARROW_EXPORT FlatArray : public Array {
288  protected:
289  using Array::Array;
290 };
291 
293 class ARROW_EXPORT NullArray : public FlatArray {
294  public:
296 
297  explicit NullArray(const std::shared_ptr<ArrayData>& data) { SetData(data); }
298  explicit NullArray(int64_t length);
299 
300  private:
301  inline void SetData(const std::shared_ptr<ArrayData>& data) {
302  null_bitmap_data_ = NULLPTR;
303  data->null_count = data->length;
304  data_ = data;
305  }
306 };
307 
309 class ARROW_EXPORT PrimitiveArray : public FlatArray {
310  public:
311  PrimitiveArray(const std::shared_ptr<DataType>& type, int64_t length,
312  const std::shared_ptr<Buffer>& data,
313  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
314  int64_t null_count = 0, int64_t offset = 0);
315 
317  std::shared_ptr<Buffer> values() const { return data_->buffers[1]; }
318 
320  const uint8_t* raw_values() const;
321 
322  protected:
324 
325  inline void SetData(const std::shared_ptr<ArrayData>& data) {
326  auto values = data->buffers[1];
327  this->Array::SetData(data);
328  raw_values_ = values == NULLPTR ? NULLPTR : values->data();
329  }
330 
331  explicit inline PrimitiveArray(const std::shared_ptr<ArrayData>& data) {
332  SetData(data);
333  }
334 
335  const uint8_t* raw_values_;
336 };
337 
338 template <typename TYPE>
339 class ARROW_EXPORT NumericArray : public PrimitiveArray {
340  public:
341  using TypeClass = TYPE;
342  using value_type = typename TypeClass::c_type;
343 
344  explicit NumericArray(const std::shared_ptr<ArrayData>& data);
345 
346  // Only enable this constructor without a type argument for types without additional
347  // metadata
348  template <typename T1 = TYPE>
350  typename std::enable_if<TypeTraits<T1>::is_parameter_free, int64_t>::type length,
351  const std::shared_ptr<Buffer>& data,
352  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR, int64_t null_count = 0,
353  int64_t offset = 0)
354  : PrimitiveArray(TypeTraits<T1>::type_singleton(), length, data, null_bitmap,
355  null_count, offset) {}
356 
357  const value_type* raw_values() const {
358  return reinterpret_cast<const value_type*>(raw_values_) + data_->offset;
359  }
360 
361  value_type Value(int64_t i) const { return raw_values()[i]; }
362 
363  protected:
365 };
366 
367 class ARROW_EXPORT BooleanArray : public PrimitiveArray {
368  public:
370 
371  explicit BooleanArray(const std::shared_ptr<ArrayData>& data);
372 
373  BooleanArray(int64_t length, const std::shared_ptr<Buffer>& data,
374  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
375  int64_t null_count = 0, int64_t offset = 0);
376 
377  bool Value(int64_t i) const {
378  return BitUtil::GetBit(reinterpret_cast<const uint8_t*>(raw_values_),
379  i + data_->offset);
380  }
381 
382  protected:
384 };
385 
386 // ----------------------------------------------------------------------
387 // ListArray
388 
389 class ARROW_EXPORT ListArray : public Array {
390  public:
392 
393  explicit ListArray(const std::shared_ptr<ArrayData>& data);
394 
395  ListArray(const std::shared_ptr<DataType>& type, int64_t length,
396  const std::shared_ptr<Buffer>& value_offsets,
397  const std::shared_ptr<Array>& values,
398  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR, int64_t null_count = 0,
399  int64_t offset = 0);
400 
414  static Status FromArrays(const Array& offsets, const Array& values, MemoryPool* pool,
415  std::shared_ptr<Array>* out);
416 
418  std::shared_ptr<Array> values() const;
419 
421  std::shared_ptr<Buffer> value_offsets() const { return data_->buffers[1]; }
422 
423  std::shared_ptr<DataType> value_type() const;
424 
426  const int32_t* raw_value_offsets() const { return raw_value_offsets_ + data_->offset; }
427 
428  // Neither of these functions will perform boundschecking
429  int32_t value_offset(int64_t i) const { return raw_value_offsets_[i + data_->offset]; }
430  int32_t value_length(int64_t i) const {
431  i += data_->offset;
432  return raw_value_offsets_[i + 1] - raw_value_offsets_[i];
433  }
434 
435  protected:
436  void SetData(const std::shared_ptr<ArrayData>& data);
437  const int32_t* raw_value_offsets_;
438 
439  private:
440  std::shared_ptr<Array> values_;
441 };
442 
443 // ----------------------------------------------------------------------
444 // Binary and String
445 
446 class ARROW_EXPORT BinaryArray : public FlatArray {
447  public:
449 
450  explicit BinaryArray(const std::shared_ptr<ArrayData>& data);
451 
452  BinaryArray(int64_t length, const std::shared_ptr<Buffer>& value_offsets,
453  const std::shared_ptr<Buffer>& data,
454  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
455  int64_t null_count = 0, int64_t offset = 0);
456 
457  // Return the pointer to the given elements bytes
458  // TODO(emkornfield) introduce a StringPiece or something similar to capture zero-copy
459  // pointer + offset
460  const uint8_t* GetValue(int64_t i, int32_t* out_length) const {
461  // Account for base offset
462  i += data_->offset;
463 
464  const int32_t pos = raw_value_offsets_[i];
465  *out_length = raw_value_offsets_[i + 1] - pos;
466  return raw_data_ + pos;
467  }
468 
473  std::string GetString(int64_t i) const {
474  int32_t length = 0;
475  const uint8_t* bytes = GetValue(i, &length);
476  return std::string(reinterpret_cast<const char*>(bytes), static_cast<size_t>(length));
477  }
478 
480  std::shared_ptr<Buffer> value_offsets() const { return data_->buffers[1]; }
481 
483  std::shared_ptr<Buffer> value_data() const { return data_->buffers[2]; }
484 
485  const int32_t* raw_value_offsets() const { return raw_value_offsets_ + data_->offset; }
486 
487  // Neither of these functions will perform boundschecking
488  int32_t value_offset(int64_t i) const { return raw_value_offsets_[i + data_->offset]; }
489  int32_t value_length(int64_t i) const {
490  i += data_->offset;
491  return raw_value_offsets_[i + 1] - raw_value_offsets_[i];
492  }
493 
494  protected:
495  // For subclasses
497 
499  void SetData(const std::shared_ptr<ArrayData>& data);
500 
501  // Constructor that allows sub-classes/builders to propagate there logical type up the
502  // class hierarchy.
503  BinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
504  const std::shared_ptr<Buffer>& value_offsets,
505  const std::shared_ptr<Buffer>& data,
506  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
507  int64_t null_count = 0, int64_t offset = 0);
508 
509  const int32_t* raw_value_offsets_;
510  const uint8_t* raw_data_;
511 };
512 
513 class ARROW_EXPORT StringArray : public BinaryArray {
514  public:
516 
517  explicit StringArray(const std::shared_ptr<ArrayData>& data);
518 
519  StringArray(int64_t length, const std::shared_ptr<Buffer>& value_offsets,
520  const std::shared_ptr<Buffer>& data,
521  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
522  int64_t null_count = 0, int64_t offset = 0);
523 
524  // Construct a std::string
525  // TODO: std::bad_alloc possibility
526  std::string GetString(int64_t i) const {
527  int32_t nchars;
528  const uint8_t* str = GetValue(i, &nchars);
529  return std::string(reinterpret_cast<const char*>(str), nchars);
530  }
531 };
532 
533 // ----------------------------------------------------------------------
534 // Fixed width binary
535 
536 class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
537  public:
539 
540  explicit FixedSizeBinaryArray(const std::shared_ptr<ArrayData>& data);
541 
542  FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
543  const std::shared_ptr<Buffer>& data,
544  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
545  int64_t null_count = 0, int64_t offset = 0);
546 
547  const uint8_t* GetValue(int64_t i) const;
548  const uint8_t* Value(int64_t i) const { return GetValue(i); }
549 
550  int32_t byte_width() const { return byte_width_; }
551 
552  protected:
553  inline void SetData(const std::shared_ptr<ArrayData>& data) {
554  this->PrimitiveArray::SetData(data);
555  byte_width_ = static_cast<const FixedSizeBinaryType&>(*type()).byte_width();
556  }
557 
558  int32_t byte_width_;
559 };
560 
561 // ----------------------------------------------------------------------
562 // DecimalArray
563 class ARROW_EXPORT DecimalArray : public FixedSizeBinaryArray {
564  public:
566 
568 
570  explicit DecimalArray(const std::shared_ptr<ArrayData>& data);
571 
572  std::string FormatValue(int64_t i) const;
573 };
574 
575 // ----------------------------------------------------------------------
576 // Struct
577 
578 class ARROW_EXPORT StructArray : public Array {
579  public:
581 
582  explicit StructArray(const std::shared_ptr<ArrayData>& data);
583 
584  StructArray(const std::shared_ptr<DataType>& type, int64_t length,
585  const std::vector<std::shared_ptr<Array>>& children,
586  std::shared_ptr<Buffer> null_bitmap = NULLPTR, int64_t null_count = 0,
587  int64_t offset = 0);
588 
589  // Return a shared pointer in case the requestor desires to share ownership
590  // with this array.
591  std::shared_ptr<Array> field(int pos) const;
592 
593  private:
594  // For caching boxed child data
595  mutable std::vector<std::shared_ptr<Array>> boxed_fields_;
596 };
597 
598 // ----------------------------------------------------------------------
599 // Union
600 
601 class ARROW_EXPORT UnionArray : public Array {
602  public:
604  using type_id_t = uint8_t;
605 
606  explicit UnionArray(const std::shared_ptr<ArrayData>& data);
607 
608  UnionArray(const std::shared_ptr<DataType>& type, int64_t length,
609  const std::vector<std::shared_ptr<Array>>& children,
610  const std::shared_ptr<Buffer>& type_ids,
611  const std::shared_ptr<Buffer>& value_offsets = NULLPTR,
612  const std::shared_ptr<Buffer>& null_bitmap = NULLPTR, int64_t null_count = 0,
613  int64_t offset = 0);
614 
616  std::shared_ptr<Buffer> type_ids() const { return data_->buffers[1]; }
617 
619  std::shared_ptr<Buffer> value_offsets() const { return data_->buffers[2]; }
620 
621  const type_id_t* raw_type_ids() const { return raw_type_ids_ + data_->offset; }
622  const int32_t* raw_value_offsets() const { return raw_value_offsets_ + data_->offset; }
623 
624  UnionMode mode() const { return static_cast<const UnionType&>(*type()).mode(); }
625 
626  std::shared_ptr<Array> child(int pos) const;
627 
629  const Array* UnsafeChild(int pos) const;
630 
631  protected:
632  void SetData(const std::shared_ptr<ArrayData>& data);
633 
635  const int32_t* raw_value_offsets_;
636 
637  // For caching boxed child data
638  mutable std::vector<std::shared_ptr<Array>> boxed_fields_;
639 };
640 
641 // ----------------------------------------------------------------------
642 // DictionaryArray (categorical and dictionary-encoded in memory)
643 
644 // A dictionary array contains an array of non-negative integers (the
645 // "dictionary indices") along with a data type containing a "dictionary"
646 // corresponding to the distinct values represented in the data.
647 //
648 // For example, the array
649 //
650 // ["foo", "bar", "foo", "bar", "foo", "bar"]
651 //
652 // with dictionary ["bar", "foo"], would have dictionary array representation
653 //
654 // indices: [1, 0, 1, 0, 1, 0]
655 // dictionary: ["bar", "foo"]
656 //
657 // The indices in principle may have any integer type (signed or unsigned),
658 // though presently data in IPC exchanges must be signed int32.
659 class ARROW_EXPORT DictionaryArray : public Array {
660  public:
662 
663  explicit DictionaryArray(const std::shared_ptr<ArrayData>& data);
664 
665  DictionaryArray(const std::shared_ptr<DataType>& type,
666  const std::shared_ptr<Array>& indices);
667 
668  std::shared_ptr<Array> indices() const;
669  std::shared_ptr<Array> dictionary() const;
670 
671  const DictionaryType* dict_type() const { return dict_type_; }
672 
673  private:
674  void SetData(const std::shared_ptr<ArrayData>& data);
675 
676  const DictionaryType* dict_type_;
677  std::shared_ptr<Array> indices_;
678 };
679 
680 // ----------------------------------------------------------------------
681 // extern templates and other details
682 
683 // Only instantiate these templates once
700 
708 ARROW_EXPORT
709 Status ValidateArray(const Array& array);
710 
711 } // namespace arrow
712 
713 #endif // ARROW_ARRAY_H
Definition: type.h:485
Definition: array.h:536
void SetData(const std::shared_ptr< ArrayData > &data)
Definition: array.h:553
Definition: array.h:339
int64_t offset() const
A relative position into another array&#39;s data, to enable zero-copy slicing.
Definition: array.h:202
const int32_t * raw_value_offsets() const
Return pointer to raw value offsets accounting for any slice offset.
Definition: array.h:426
BinaryArray()
Definition: array.h:496
const uint8_t * Value(int64_t i) const
Definition: array.h:548
ArrayData()
Definition: array.h:87
Definition: array.h:563
bool IsValid(int64_t i) const
Return true if value at index is valid (not null).
Definition: array.h:192
Status ValidateArray(const Array &array)
Perform any validation checks to determine obvious inconsistencies with the array&#39;s internal data...
const uint8_t * GetValue(int64_t i, int32_t *out_length) const
Definition: array.h:460
int64_t offset
Definition: array.h:142
std::shared_ptr< Buffer > type_ids() const
Note that this buffer does not account for any slice offset.
Definition: array.h:616
type
Definition: type.h:45
std::vector< std::shared_ptr< Buffer > > buffers
Definition: array.h:143
const uint8_t * null_bitmap_data() const
Raw pointer to the null bitmap.
Definition: array.h:223
PrimitiveArray(const std::shared_ptr< ArrayData > &data)
Definition: array.h:331
int32_t byte_width() const
Definition: array.h:550
int64_t length
Definition: array.h:140
Definition: array.h:367
int32_t value_offset(int64_t i) const
Definition: array.h:429
std::shared_ptr< Buffer > null_bitmap() const
Buffer for the null bitmap.
Definition: array.h:217
Definition: array.h:287
const int32_t * raw_value_offsets_
Definition: array.h:437
std::shared_ptr< ArrayData > data() const
Definition: array.h:255
#define NULLPTR
Definition: macros.h:69
const type_id_t * raw_type_ids_
Definition: array.h:634
std::vector< std::shared_ptr< Buffer > > BufferVector
Definition: array.h:38
Status MakeArray(const std::shared_ptr< ArrayData > &data, std::shared_ptr< Array > *out)
Create a strongly-typed Array instance from generic ArrayData.
int32_t value_offset(int64_t i) const
Definition: array.h:488
Definition: status.h:106
std::string GetString(int64_t i) const
Definition: array.h:526
PrimitiveArray()
Definition: array.h:323
Definition: type_traits.h:29
std::shared_ptr< DataType > dictionary(const std::shared_ptr< DataType > &index_type, const std::shared_ptr< Array > &values, bool ordered=false)
Create an instance of Dictionary type.
const int32_t * raw_value_offsets_
Definition: array.h:635
const type_id_t * raw_type_ids() const
Definition: array.h:621
Array()
Definition: array.h:263
const DictionaryType * dict_type() const
Definition: array.h:671
Type::type type_id() const
Definition: array.h:211
std::shared_ptr< ArrayData > ShallowCopy() const
Definition: array.h:135
int64_t null_count
Definition: array.h:141
ArrayData(const std::shared_ptr< DataType > &type, int64_t length, std::vector< std::shared_ptr< Buffer >> &&buffers, int64_t null_count=kUnknownNullCount, int64_t offset=0)
Definition: array.h:100
Definition: type.h:312
const uint8_t * raw_values_
Definition: array.h:335
Definition: type.h:433
std::shared_ptr< Field > field(const std::string &name, const std::shared_ptr< DataType > &type, bool nullable=true, const std::shared_ptr< const KeyValueMetadata > &metadata=NULLPTR)
Create a Field instance.
Definition: type.h:326
Definition: type.h:408
ArrayData(const std::shared_ptr< DataType > &type, int64_t length, const std::vector< std::shared_ptr< Buffer >> &buffers, int64_t null_count=kUnknownNullCount, int64_t offset=0)
Definition: array.h:93
TYPE TypeClass
Definition: array.h:341
bool IsNull(int64_t i) const
Return true if value at index is null. Does not boundscheck.
Definition: array.h:185
void SetData(const std::shared_ptr< ArrayData > &data)
Protected method for constructors.
Definition: array.h:269
const uint8_t * raw_data_
Definition: array.h:510
Definition: type.h:474
ArrayData(const std::shared_ptr< DataType > &type, int64_t length, int64_t null_count=kUnknownNullCount, int64_t offset=0)
Definition: array.h:89
const int32_t * raw_value_offsets_
Definition: array.h:509
const int32_t * raw_value_offsets() const
Definition: array.h:485
typename TypeClass::c_type value_type
Definition: array.h:342
Definition: type.h:501
Definition: visitor.h:27
ArrayData & operator=(ArrayData &&other)
Definition: array.h:125
Definition: array.h:513
std::shared_ptr< Buffer > value_offsets() const
Note that this buffer does not account for any slice offset.
Definition: array.h:480
std::string GetString(int64_t i) const
Get binary value as a std::string.
Definition: array.h:473
constexpr int64_t kUnknownNullCount
Definition: array.h:44
std::string ToString() const
void SetData(const std::shared_ptr< ArrayData > &data)
Definition: array.h:325
Top-level namespace for Apache Arrow C++ API.
Definition: allocator.h:29
std::shared_ptr< DataType > type
Definition: array.h:139
std::shared_ptr< Buffer > value_offsets() const
Note that this buffer does not account for any slice offset.
Definition: array.h:619
Array base type Immutable data array with some logical type and some length.
Definition: array.h:180
Definition: array.h:389
std::shared_ptr< DataType > type() const
Definition: array.h:210
std::shared_ptr< Buffer > value_offsets() const
Note that this buffer does not account for any slice offset.
Definition: array.h:421
value_type Value(int64_t i) const
Definition: array.h:361
NumericArray(typename std::enable_if< TypeTraits< T1 >::is_parameter_free, int64_t >::type length, const std::shared_ptr< Buffer > &data, const std::shared_ptr< Buffer > &null_bitmap=NULLPTR, int64_t null_count=0, int64_t offset=0)
Definition: array.h:349
int64_t length() const
Size in the number of elements this array contains.
Definition: array.h:198
#define ARROW_EXTERN_TEMPLATE
Definition: visibility.h:50
UnionMode mode() const
Definition: array.h:624
std::shared_ptr< Buffer > value_data() const
Note that this buffer does not account for any slice offset.
Definition: array.h:483
std::shared_ptr< ArrayData > data_
Definition: array.h:265
Definition: array.h:446
Definition: array.h:601
const int32_t * raw_value_offsets() const
Definition: array.h:622
std::vector< std::shared_ptr< Array > > boxed_fields_
Definition: array.h:638
ArrayData(const ArrayData &other) noexcept
Definition: array.h:116
ArrayData(ArrayData &&other) noexcept
Definition: array.h:108
const value_type * raw_values() const
Definition: array.h:357
Mutable container for generic Arrow array data.
Definition: array.h:86
int32_t value_length(int64_t i) const
Definition: array.h:489
Definition: array.h:659
int32_t byte_width_
Definition: array.h:558
Definition: type.h:709
Base class for memory allocation.
Definition: memory_pool.h:34
Definition: array.h:50
bool Value(int64_t i) const
Definition: array.h:377
uint8_t type_id_t
Definition: array.h:604
Definition: array.h:578
int num_fields() const
Definition: array.h:257
const uint8_t * null_bitmap_data_
Definition: array.h:266
Definition: type.h:522
#define ARROW_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:23
NullArray(const std::shared_ptr< ArrayData > &data)
Definition: array.h:297
UnionMode
Definition: type.h:520
std::shared_ptr< Buffer > values() const
Does not account for any slice offset.
Definition: array.h:317
std::vector< std::shared_ptr< ArrayData > > child_data
Definition: array.h:144
int32_t value_length(int64_t i) const
Definition: array.h:430
Definition: type.h:451
Base class for fixed-size logical types.
Definition: array.h:309
Degenerate null type Array.
Definition: array.h:293
FixedSizeBinaryArray(const std::shared_ptr< ArrayData > &data)