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: 4 additions & 0 deletions cpp/src/arrow/json/chunker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ class ParsingBoundaryFinder : public BoundaryFinder {
auto data = buffer_->mutable_data();
std::memcpy(data, partial.data(), partial.size());
std::memcpy(data + partial.size(), block.data(), block.size());
// simdjson >= 5.2.0 may look at bytes past the input when it delimits documents
// (simdjson/simdjson#3031), so stale padding contents could change where
// documents are cut. Zero the padding to make this deterministic.
std::memset(data + data_size, 0, simdjson::SIMDJSON_PADDING);
auto view = simdjson::padded_string_view(data, /*len=*/data_size,
/*capacity=*/buffer_->capacity());
DCHECK(view.has_sufficient_padding());
Expand Down
12 changes: 7 additions & 5 deletions cpp/src/arrow/json/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -945,18 +945,20 @@ class ParseImpl : public BlockParser {
RETURN_NOT_OK(struct_builder->Append());

ARROW_ASSIGN_OR_RAISE(
auto object, arrow::internal::ResolveSimdjsonResult(value.get_object(),
"Failed to get JSON object"));
auto object,
arrow::internal::ResolveSimdjsonResult(
value.get_object(), "JSON parse error: Failed to get JSON object"));

for (auto field_result : object) {
ARROW_ASSIGN_OR_RAISE(auto field,
arrow::internal::ResolveSimdjsonResult(
std::move(field_result),
"JSON parse error: Failed to iterate JSON object"));

ARROW_ASSIGN_OR_RAISE(auto key,
arrow::internal::ResolveSimdjsonResult(
field.unescaped_key(), "Failed to get JSON object key"));
ARROW_ASSIGN_OR_RAISE(
auto key,
arrow::internal::ResolveSimdjsonResult(
field.unescaped_key(), "JSON parse error: Failed to get JSON object key"));

RETURN_NOT_OK(ParseObjectField(key, field.value()));
}
Expand Down
Loading