Skip to content

Commit ab2c41a

Browse files
committed
apacheGH-50859: [C++][Parquet] Build ObjectParser with simdjson utilities
Fully qualify simdjson utility calls so CMake unity builds do not resolve internal to arrow::json::internal.
1 parent 4d93dff commit ab2c41a

7 files changed

Lines changed: 18 additions & 17 deletions

File tree

‎cpp/cmake_modules/DefineOptions.cmake‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,7 @@ takes precedence over ccache if a storage backend is configured" ON)
599599
"Build support for encryption. Fail if OpenSSL is not found"
600600
OFF
601601
DEPENDS
602-
ARROW_FILESYSTEM
603-
ARROW_JSON)
602+
ARROW_FILESYSTEM)
604603

605604
#----------------------------------------------------------------------
606605
set_option_category("Gandiva")

‎cpp/cmake_modules/ThirdpartyToolchain.cmake‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ if(ARROW_WITH_OPENTELEMETRY)
383383
endif()
384384

385385
if(ARROW_PARQUET)
386-
set(ARROW_WITH_RAPIDJSON ON)
387386
set(ARROW_WITH_SIMDJSON ON)
388387
set(ARROW_WITH_THRIFT ON)
389388
endif()

‎cpp/src/arrow/CMakeLists.txt‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,11 @@ if(ARROW_WITH_OPENTELEMETRY)
645645
list(APPEND ARROW_UTIL_SRCS util/tracing_internal.cc)
646646
endif()
647647
if(ARROW_WITH_SIMDJSON)
648-
list(APPEND ARROW_UTIL_SRCS util/json_writer_internal.cc util/simdjson_internal.cc)
648+
list(APPEND
649+
ARROW_UTIL_SRCS
650+
json/object_parser.cc
651+
util/json_writer_internal.cc
652+
util/simdjson_internal.cc)
649653
endif()
650654
if(ARROW_WITH_SNAPPY)
651655
list(APPEND ARROW_UTIL_SRCS util/compression_snappy.cc)
@@ -1097,7 +1101,6 @@ if(ARROW_JSON)
10971101
json/chunker.cc
10981102
json/converter.cc
10991103
json/from_string.cc
1100-
json/object_parser.cc
11011104
json/parser.cc
11021105
json/reader.cc)
11031106
foreach(ARROW_JSON_TARGET ${ARROW_JSON_TARGETS})

‎cpp/src/arrow/json/object_parser.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace json {
2929
namespace internal {
3030

3131
/// This class is a helper to parse a json object from a string.
32-
/// It uses rapidjson::Document in implementation.
32+
/// It uses simdjson in the implementation.
3333
class ARROW_EXPORT ObjectParser {
3434
public:
3535
ObjectParser();

‎cpp/src/arrow/meson.build‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ arrow_util_deps = [threads_dep]
242242

243243
if needs_simdjson
244244
arrow_util_srcs += [
245+
'json/object_parser.cc',
245246
'util/json_writer_internal.cc',
246247
'util/simdjson_internal.cc',
247248
]
@@ -538,7 +539,6 @@ if needs_json
538539
'json/chunker.cc',
539540
'json/converter.cc',
540541
'json/from_string.cc',
541-
'json/object_parser.cc',
542542
'json/options.cc',
543543
'json/parser.cc',
544544
'json/reader.cc',

‎cpp/src/arrow/util/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ if(ARROW_WITH_SIMDJSON)
9292
SOURCES
9393
json_writer_internal_test.cc
9494
EXTRA_LINK_LIBS
95-
simdjson::simdjson)
95+
arrow::simdjson)
9696
endif()
9797

9898
add_arrow_test(async-utility-test

‎cpp/src/arrow/util/json_writer_internal.cc‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,21 @@ void JsonWriter::Double(double value) {
100100
}
101101

102102
Status JsonWriter::WriteValue(sj::value value) {
103-
return internal::VisitJsonValue(
103+
return ::arrow::internal::VisitJsonValue(
104104
value,
105105

106106
[&](sj::object object) -> Status {
107107
StartObject();
108108

109109
for (auto field : object) {
110-
ARROW_ASSIGN_OR_RAISE(
111-
auto key, internal::ResolveSimdjsonResult(field.unescaped_key(),
112-
"Failed to get object key"));
110+
ARROW_ASSIGN_OR_RAISE(auto key,
111+
::arrow::internal::ResolveSimdjsonResult(
112+
field.unescaped_key(), "Failed to get object key"));
113113

114114
Key(key);
115115

116116
ARROW_ASSIGN_OR_RAISE(auto field_value,
117-
internal::ResolveSimdjsonResult(
117+
::arrow::internal::ResolveSimdjsonResult(
118118
field.value(), "Failed to get object value"));
119119

120120
RETURN_NOT_OK(WriteValue(field_value));
@@ -128,9 +128,9 @@ Status JsonWriter::WriteValue(sj::value value) {
128128
StartArray();
129129

130130
for (auto element : array) {
131-
ARROW_ASSIGN_OR_RAISE(
132-
auto element_value,
133-
internal::ResolveSimdjsonResult(element, "Failed to iterate JSON array"));
131+
ARROW_ASSIGN_OR_RAISE(auto element_value,
132+
::arrow::internal::ResolveSimdjsonResult(
133+
element, "Failed to iterate JSON array"));
134134

135135
RETURN_NOT_OK(WriteValue(element_value));
136136
}
@@ -170,7 +170,7 @@ Status JsonWriter::WriteValue(sj::value value) {
170170
},
171171

172172
[&](sj::value value) -> Status {
173-
ARROW_ASSIGN_OR_RAISE(auto raw_json, internal::ResolveSimdjsonResult(
173+
ARROW_ASSIGN_OR_RAISE(auto raw_json, ::arrow::internal::ResolveSimdjsonResult(
174174
simdjson::to_json_string(value),
175175
"Failed to get raw JSON"));
176176
RawValue(raw_json);

0 commit comments

Comments
 (0)