Skip to content

Commit

Permalink
adding typed Finish method to other builders
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed May 6, 2019
1 parent a59638b commit eefa577
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cpp/src/arrow/array/builder_binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ class ARROW_EXPORT BinaryBuilder : public ArrayBuilder {

Status FinishInternal(std::shared_ptr<ArrayData>* out) override;

using ArrayBuilder::Finish;

Status Finish(std::shared_ptr<BinaryArray>* out) { return FinishTyped(out); }

/// \return size of values buffer so far
int64_t value_data_length() const { return value_data_builder_.length(); }
/// \return capacity of values buffer
Expand Down Expand Up @@ -186,6 +190,10 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
/// \return Status
Status AppendValues(const char** values, int64_t length,
const uint8_t* valid_bytes = NULLPTR);

using ArrayBuilder::Finish;

Status Finish(std::shared_ptr<StringArray>* out) { return FinishTyped(out); }
};

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -254,6 +262,10 @@ class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
Status Resize(int64_t capacity) override;
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;

using ArrayBuilder::Finish;

Status Finish(std::shared_ptr<FixedSizeBinaryArray>* out) { return FinishTyped(out); }

/// \return size of values buffer so far
int64_t value_data_length() const { return byte_builder_.length(); }

Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/array/builder_decimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class ARROW_EXPORT Decimal128Builder : public FixedSizeBinaryBuilder {
Status Append(const Decimal128& val);

Status FinishInternal(std::shared_ptr<ArrayData>* out) override;

using ArrayBuilder::Finish;

Status Finish(std::shared_ptr<Decimal128Array>* out) { return FinishTyped(out); }
};

using DecimalBuilder = Decimal128Builder;
Expand Down
8 changes: 8 additions & 0 deletions cpp/src/arrow/array/builder_dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class ARROW_EXPORT DictionaryBuilder : public ArrayBuilder {
Status Resize(int64_t capacity) override;
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;

using ArrayBuilder::Finish;

Status Finish(std::shared_ptr<DictionaryArray>* out) { return FinishTyped(out); }

/// is the dictionary builder in the delta building mode
bool is_building_delta() { return delta_offset_ > 0; }

Expand Down Expand Up @@ -139,6 +143,10 @@ class ARROW_EXPORT DictionaryBuilder<NullType> : public ArrayBuilder {
Status Resize(int64_t capacity) override;
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;

using ArrayBuilder::Finish;

Status Finish(std::shared_ptr<DictionaryArray>* out) { return FinishTyped(out); }

protected:
AdaptiveIntBuilder values_builder_;
};
Expand Down
8 changes: 8 additions & 0 deletions cpp/src/arrow/array/builder_nested.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class ARROW_EXPORT ListBuilder : public ArrayBuilder {
void Reset() override;
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;

using ArrayBuilder::Finish;

Status Finish(std::shared_ptr<ListArray>* out) { return FinishTyped(out); }

/// \brief Vector append
///
/// If passed, valid_bytes is of equal length to values, and any zero byte
Expand Down Expand Up @@ -96,6 +100,10 @@ class ARROW_EXPORT StructBuilder : public ArrayBuilder {

Status FinishInternal(std::shared_ptr<ArrayData>* out) override;

using ArrayBuilder::Finish;

Status Finish(std::shared_ptr<StructArray>* out) { return FinishTyped(out); }

/// Null bitmap is of equal length to every child field, and any zero byte
/// will be considered as a null for that field, but users must using app-
/// end methods or advance methods of the child builders' independently to
Expand Down

0 comments on commit eefa577

Please sign in to comment.