Skip to content

Commit 803dd89

Browse files
kmjungemkornfield
authored andcommitted
ARROW-6073: [C++] Reset Decimal128Builder in Finish().
This change updates the FinishInternal implementation in Decimal128Builder to reset the internal state at finish time, honoring the contract for array builders. Closes apache#4970 from kmjung/arrow-6073 and squashes the following commits: 32fdb8f <Kenneth Jung> Reset Decimal128Builder in Finish(). Authored-by: Kenneth Jung <kmj@google.com> Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
1 parent d2b65ea commit 803dd89

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

cpp/src/arrow/array-test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,6 +1755,7 @@ class DecimalTest : public ::testing::TestWithParam<int> {
17551755

17561756
std::shared_ptr<Array> out;
17571757
FinishAndCheckPadding(builder.get(), &out);
1758+
ASSERT_EQ(builder->length(), 0);
17581759

17591760
std::vector<uint8_t> raw_bytes;
17601761

cpp/src/arrow/array/builder_decimal.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Status Decimal128Builder::FinishInternal(std::shared_ptr<ArrayData>* out) {
6969
RETURN_NOT_OK(null_bitmap_builder_.Finish(&null_bitmap));
7070

7171
*out = ArrayData::Make(type_, length_, {null_bitmap, data}, null_count_);
72-
72+
capacity_ = length_ = null_count_ = 0;
7373
return Status::OK();
7474
}
7575

0 commit comments

Comments
 (0)