Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cpp/src/arrow/array/array_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -3260,6 +3260,21 @@ TEST_F(TestAdaptiveUIntBuilder, TestAppendEmptyValue) {
AssertArraysEqual(*result_, *ArrayFromJSON(uint8(), "[null, null, 0, 42, 0, 0]"));
}

TEST_F(TestAdaptiveUIntBuilder, TestAppendValuesAfterAppend) {
ASSERT_OK(builder_->Append(1));
ASSERT_OK(builder_->Append(2));
ASSERT_OK(builder_->Append(3));
ASSERT_OK(builder_->Append(4));
std::vector<uint64_t> values{5, 6, 7, 8};
ASSERT_OK(builder_->AppendValues(values.data(), values.size()));
Done();
ASSERT_OK(result_->ValidateFull());

std::shared_ptr<Array> expected;
ArrayFromVector<UInt8Type>({1, 2, 3, 4, 5, 6, 7, 8}, &expected);
AssertArraysEqual(*expected, *result_);
}

TEST(TestAdaptiveUIntBuilderWithStartIntSize, TestReset) {
auto builder = std::make_shared<AdaptiveUIntBuilder>(
static_cast<uint8_t>(sizeof(uint16_t)), default_memory_pool());
Expand Down
1 change: 1 addition & 0 deletions cpp/src/arrow/array/builder_adaptive.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -349,6 +349,7 @@ Status AdaptiveUIntBuilder::AppendValuesInternal(const uint64_t* values, int64_t

Status AdaptiveUIntBuilder::AppendValues(const uint64_t* values, int64_t length,
const uint8_t* valid_bytes) {
RETURN_NOT_OK(CommitPendingData());
RETURN_NOT_OK(Reserve(length));

return AppendValuesInternal(values, length, valid_bytes);
Expand Down
Loading