Skip to content

Commit 3317f83

Browse files
committed
ARROW-14056: [Doc][C++] Document ArrayData
Also ensure that all concrete datatype and array classes are documented. Closes apache#11201 from pitrou/ARROW-14056-doc-array-data Authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 18ca1e9 commit 3317f83

12 files changed

Lines changed: 406 additions & 348 deletions

File tree

‎cpp/apidoc/Doxyfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,8 @@ EXCLUDE_PATTERNS = *-test.cc \
925925
# Note that the wildcards are matched against the file with absolute path, so to
926926
# exclude all test directories use the pattern */test/*
927927

928-
EXCLUDE_SYMBOLS = detail \
929-
internal \
928+
EXCLUDE_SYMBOLS = *::detail \
929+
*::internal \
930930
_* \
931931
BitUtil \
932932
SSEUtil

‎cpp/src/arrow/array.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@
2222

2323
#pragma once
2424

25+
/// \defgroup numeric-arrays Concrete classes for numeric arrays
26+
/// @{
27+
/// @}
28+
29+
/// \defgroup binary-arrays Concrete classes for binary/string arrays
30+
/// @{
31+
/// @}
32+
33+
/// \defgroup nested-arrays Concrete classes for nested arrays
34+
/// @{
35+
/// @}
36+
2537
#include "arrow/array/array_base.h" // IWYU pragma: keep
2638
#include "arrow/array/array_binary.h" // IWYU pragma: keep
2739
#include "arrow/array/array_decimal.h" // IWYU pragma: keep

‎cpp/src/arrow/array/array_binary.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737

3838
namespace arrow {
3939

40+
/// \addtogroup binary-arrays
41+
///
42+
/// @{
43+
4044
// ----------------------------------------------------------------------
4145
// Binary and String
4246

@@ -252,4 +256,6 @@ class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
252256
int32_t byte_width_;
253257
};
254258

259+
/// @}
260+
255261
} // namespace arrow

‎cpp/src/arrow/array/array_decimal.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
namespace arrow {
3030

31+
/// \addtogroup numeric-arrays
32+
///
33+
/// @{
34+
3135
// ----------------------------------------------------------------------
3236
// Decimal128Array
3337

@@ -63,4 +67,6 @@ class ARROW_EXPORT Decimal256Array : public FixedSizeBinaryArray {
6367
std::string FormatValue(int64_t i) const;
6468
};
6569

70+
/// @}
71+
6672
} // namespace arrow

‎cpp/src/arrow/array/array_nested.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838

3939
namespace arrow {
4040

41+
/// \addtogroup nested-arrays
42+
///
43+
/// @{
44+
4145
// ----------------------------------------------------------------------
4246
// ListArray
4347

@@ -524,4 +528,6 @@ class ARROW_EXPORT DenseUnionArray : public UnionArray {
524528
void SetData(const std::shared_ptr<ArrayData>& data);
525529
};
526530

531+
/// @}
532+
527533
} // namespace arrow

‎cpp/src/arrow/array/array_primitive.h‎

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,52 @@
3535

3636
namespace arrow {
3737

38-
/// Concrete Array class for numeric data.
38+
/// Concrete Array class for boolean data
39+
class ARROW_EXPORT BooleanArray : public PrimitiveArray {
40+
public:
41+
using TypeClass = BooleanType;
42+
using IteratorType = stl::ArrayIterator<BooleanArray>;
43+
44+
explicit BooleanArray(const std::shared_ptr<ArrayData>& data);
45+
46+
BooleanArray(int64_t length, const std::shared_ptr<Buffer>& data,
47+
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
48+
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
49+
50+
bool Value(int64_t i) const {
51+
return BitUtil::GetBit(reinterpret_cast<const uint8_t*>(raw_values_),
52+
i + data_->offset);
53+
}
54+
55+
bool GetView(int64_t i) const { return Value(i); }
56+
57+
/// \brief Return the number of false (0) values among the valid
58+
/// values. Result is not cached.
59+
int64_t false_count() const;
60+
61+
/// \brief Return the number of true (1) values among the valid
62+
/// values. Result is not cached.
63+
int64_t true_count() const;
64+
65+
IteratorType begin() const { return IteratorType(*this); }
66+
67+
IteratorType end() const { return IteratorType(*this, length()); }
68+
69+
protected:
70+
using PrimitiveArray::PrimitiveArray;
71+
};
72+
73+
/// \addtogroup numeric-arrays
74+
///
75+
/// @{
76+
77+
/// \brief Concrete Array class for numeric data with a corresponding C type
78+
///
79+
/// This class is templated on the corresponding DataType subclass for the
80+
/// given data, for example NumericArray<Int8Type> or NumericArray<Date32Type>.
81+
///
82+
/// Note that convenience aliases are available for all accepted types
83+
/// (for example Int8Array for NumericArray<Int8Type>).
3984
template <typename TYPE>
4085
class NumericArray : public PrimitiveArray {
4186
public:
@@ -72,41 +117,6 @@ class NumericArray : public PrimitiveArray {
72117
using PrimitiveArray::PrimitiveArray;
73118
};
74119

75-
/// Concrete Array class for boolean data
76-
class ARROW_EXPORT BooleanArray : public PrimitiveArray {
77-
public:
78-
using TypeClass = BooleanType;
79-
using IteratorType = stl::ArrayIterator<BooleanArray>;
80-
81-
explicit BooleanArray(const std::shared_ptr<ArrayData>& data);
82-
83-
BooleanArray(int64_t length, const std::shared_ptr<Buffer>& data,
84-
const std::shared_ptr<Buffer>& null_bitmap = NULLPTR,
85-
int64_t null_count = kUnknownNullCount, int64_t offset = 0);
86-
87-
bool Value(int64_t i) const {
88-
return BitUtil::GetBit(reinterpret_cast<const uint8_t*>(raw_values_),
89-
i + data_->offset);
90-
}
91-
92-
bool GetView(int64_t i) const { return Value(i); }
93-
94-
/// \brief Return the number of false (0) values among the valid
95-
/// values. Result is not cached.
96-
int64_t false_count() const;
97-
98-
/// \brief Return the number of true (1) values among the valid
99-
/// values. Result is not cached.
100-
int64_t true_count() const;
101-
102-
IteratorType begin() const { return IteratorType(*this); }
103-
104-
IteratorType end() const { return IteratorType(*this, length()); }
105-
106-
protected:
107-
using PrimitiveArray::PrimitiveArray;
108-
};
109-
110120
/// DayTimeArray
111121
/// ---------------------
112122
/// \brief Array of Day and Millisecond values.
@@ -163,4 +173,6 @@ class ARROW_EXPORT MonthDayNanoIntervalArray : public PrimitiveArray {
163173
const uint8_t* raw_values() const { return raw_values_ + data_->offset * byte_width(); }
164174
};
165175

176+
/// @}
177+
166178
} // namespace arrow

0 commit comments

Comments
 (0)