@@ -44,6 +44,7 @@ class ARROW_EXPORT ChunkedArray {
44
44
// / \return the total length of the chunked array; computed on construction
45
45
int64_t length () const { return length_; }
46
46
47
+ // / \return the total number of nulls among all chunks
47
48
int64_t null_count () const { return null_count_; }
48
49
49
50
int num_chunks () const { return static_cast <int >(chunks_.size ()); }
@@ -53,6 +54,20 @@ class ARROW_EXPORT ChunkedArray {
53
54
54
55
const ArrayVector& chunks () const { return chunks_; }
55
56
57
+ // / \brief Construct a zero-copy slice of the chunked array with the
58
+ // / indicated offset and length
59
+ // /
60
+ // / \param[in] offset the position of the first element in the constructed
61
+ // / slice
62
+ // / \param[in] length the length of the slice. If there are not enough
63
+ // / elements in the chunked array, the length will be adjusted accordingly
64
+ // /
65
+ // / \return a new object wrapped in std::shared_ptr<ChunkedArray>
66
+ std::shared_ptr<ChunkedArray> Slice (int64_t offset, int64_t length) const ;
67
+
68
+ // / \brief Slice from offset until end of the chunked array
69
+ std::shared_ptr<ChunkedArray> Slice (int64_t offset) const ;
70
+
56
71
std::shared_ptr<DataType> type () const ;
57
72
58
73
bool Equals (const ChunkedArray& other) const ;
@@ -67,8 +82,9 @@ class ARROW_EXPORT ChunkedArray {
67
82
ARROW_DISALLOW_COPY_AND_ASSIGN (ChunkedArray);
68
83
};
69
84
85
+ // / \class Column
70
86
// / \brief An immutable column data structure consisting of a field (type
71
- // / metadata) and a logical chunked data array
87
+ // / metadata) and a chunked data array
72
88
class ARROW_EXPORT Column {
73
89
public:
74
90
Column (const std::shared_ptr<Field>& field, const ArrayVector& chunks);
@@ -97,6 +113,24 @@ class ARROW_EXPORT Column {
97
113
// / \return the column's data as a chunked logical array
98
114
std::shared_ptr<ChunkedArray> data () const { return data_; }
99
115
116
+ // / \brief Construct a zero-copy slice of the column with the indicated
117
+ // / offset and length
118
+ // /
119
+ // / \param[in] offset the position of the first element in the constructed
120
+ // / slice
121
+ // / \param[in] length the length of the slice. If there are not enough
122
+ // / elements in the column, the length will be adjusted accordingly
123
+ // /
124
+ // / \return a new object wrapped in std::shared_ptr<Column>
125
+ std::shared_ptr<Column> Slice (int64_t offset, int64_t length) const {
126
+ return std::make_shared<Column>(field_, data_->Slice (offset, length));
127
+ }
128
+
129
+ // / \brief Slice from offset until end of the column
130
+ std::shared_ptr<Column> Slice (int64_t offset) const {
131
+ return std::make_shared<Column>(field_, data_->Slice (offset));
132
+ }
133
+
100
134
bool Equals (const Column& other) const ;
101
135
bool Equals (const std::shared_ptr<Column>& other) const ;
102
136
0 commit comments