-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-1280: [C++] add fixed size list type #4278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f9258dd
dae1275
59ce758
3256051
ddb46fd
17b55c5
ca02bda
920a251
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -522,6 +522,43 @@ class ARROW_EXPORT ListArray : public Array { | |
| std::shared_ptr<Array> values_; | ||
| }; | ||
|
|
||
| // ---------------------------------------------------------------------- | ||
| // FixedSizeListArray | ||
|
|
||
| /// Concrete Array class for fixed size list data | ||
| class ARROW_EXPORT FixedSizeListArray : public Array { | ||
|
||
| public: | ||
| using TypeClass = FixedSizeListType; | ||
|
|
||
| explicit FixedSizeListArray(const std::shared_ptr<ArrayData>& data); | ||
|
|
||
| FixedSizeListArray(const std::shared_ptr<DataType>& type, int64_t length, | ||
| const std::shared_ptr<Array>& values, | ||
| const std::shared_ptr<Buffer>& null_bitmap = NULLPTR, | ||
| int64_t null_count = kUnknownNullCount, int64_t offset = 0); | ||
|
|
||
| const FixedSizeListType* list_type() const; | ||
|
|
||
| /// \brief Return array object containing the list's values | ||
| std::shared_ptr<Array> values() const; | ||
|
|
||
| std::shared_ptr<DataType> value_type() const; | ||
|
|
||
| // Neither of these functions will perform boundschecking | ||
| int32_t value_offset(int64_t i) const { | ||
| i += data_->offset; | ||
| return static_cast<int32_t>(list_size_ * i); | ||
| } | ||
| int32_t value_length(int64_t i = 0) const { return list_size_; } | ||
|
|
||
| protected: | ||
| void SetData(const std::shared_ptr<ArrayData>& data); | ||
| int32_t list_size_; | ||
|
|
||
| private: | ||
| std::shared_ptr<Array> values_; | ||
| }; | ||
|
|
||
| // ---------------------------------------------------------------------- | ||
| // Binary and String | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, this builds an invalid FixedSizeListArray? No values are appended to the child array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does build an invalid array, but the point of this test is just to check that the field name is correctly propagated to the built array