Skip to content
Closed
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
4 changes: 3 additions & 1 deletion cpp/src/arrow/types/primitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ class PrimitiveBuilder : public ArrayBuilder {
int32_t new_capacity = util::next_power2(length_ + length);
RETURN_NOT_OK(Resize(new_capacity));
}
memcpy(raw_buffer() + length_, values, length * elsize_);
if (length > 0) {
memcpy(raw_buffer() + length_, values, length * elsize_);
}

if (null_bytes != nullptr) {
AppendNulls(null_bytes, length);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/types/string-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class TestStringBuilder : public TestBuilder {
};

TEST_F(TestStringBuilder, TestScalarAppend) {
std::vector<std::string> strings = {"a", "bb", "", "", "ccc"};
std::vector<std::string> strings = {"", "bb", "a", "", "ccc"};
std::vector<uint8_t> is_null = {0, 0, 0, 1, 0};

int N = strings.size();
Expand Down
6 changes: 3 additions & 3 deletions python/pyarrow/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ def test_list_format(self):
assert result == expected

def test_string_format(self):
arr = pyarrow.from_pylist(['foo', None, 'bar'])
arr = pyarrow.from_pylist(['', None, 'foo'])
result = fmt.array_format(arr)
expected = """\
[
'foo',
'',
NA,
'bar'
'foo'
]"""
assert result == expected

Expand Down