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
3 changes: 1 addition & 2 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,7 @@ takes precedence over ccache if a storage backend is configured" ON)
"Build support for encryption. Fail if OpenSSL is not found"
OFF
DEPENDS
ARROW_FILESYSTEM
ARROW_JSON)
ARROW_FILESYSTEM)

#----------------------------------------------------------------------
set_option_category("Gandiva")
Expand Down
5 changes: 2 additions & 3 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ if(ARROW_WITH_OPENTELEMETRY)
endif()

if(ARROW_PARQUET)
set(ARROW_WITH_RAPIDJSON ON)
set(ARROW_WITH_SIMDJSON ON)
set(ARROW_WITH_THRIFT ON)
endif()
Expand Down Expand Up @@ -411,11 +410,11 @@ if(ARROW_AZURE)
set(ARROW_WITH_AZURE_SDK ON)
endif()

if(ARROW_JSON OR ARROW_FLIGHT_SQL_ODBC)
if(ARROW_JSON)
set(ARROW_WITH_RAPIDJSON ON)
endif()

if(ARROW_JSON)
if(ARROW_JSON OR ARROW_FLIGHT_SQL_ODBC)
set(ARROW_WITH_SIMDJSON ON)
endif()

Expand Down
1 change: 1 addition & 0 deletions cpp/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ needs_testing = (get_option('testing').enabled()
or needs_integration
)
needs_json = get_option('json').enabled() or needs_testing
needs_simdjson = needs_json or needs_parquet
needs_brotli = get_option('brotli').enabled() or needs_fuzzing
needs_bz2 = get_option('bz2').enabled()
needs_lz4 = get_option('lz4').enabled()
Expand Down
11 changes: 9 additions & 2 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,9 @@ endif()
if(ARROW_WITH_OPENTELEMETRY)
list(APPEND ARROW_UTIL_SRCS util/tracing_internal.cc)
endif()
if(ARROW_WITH_SIMDJSON)
list(APPEND ARROW_UTIL_SRCS util/simdjson_internal.cc)
endif()
if(ARROW_WITH_SNAPPY)
list(APPEND ARROW_UTIL_SRCS util/compression_snappy.cc)
endif()
Expand All @@ -664,6 +667,12 @@ foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS})
target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE ${ARROW_XSIMD})
endforeach()

if(ARROW_WITH_SIMDJSON)
foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS})
target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE arrow::simdjson)
endforeach()
endif()

if(ARROW_USE_BOOST)
foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS})
target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE Boost::headers)
Expand Down Expand Up @@ -1088,8 +1097,6 @@ if(ARROW_JSON)
json/chunker.cc
json/converter.cc
json/from_string.cc
json/json_writer_internal.cc
json/object_parser.cc
json/parser.cc
json/reader.cc)
foreach(ARROW_JSON_TARGET ${ARROW_JSON_TARGETS})
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/dataset/file_json_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#include "arrow/dataset/plan.h"
#include "arrow/dataset/test_util_internal.h"
#include "arrow/filesystem/mockfs.h"
#include "arrow/json/json_writer_internal.h"
#include "arrow/json/parser.h"
#include "arrow/testing/gtest_util.h"
#include "arrow/testing/util.h"
#include "arrow/util/logging_internal.h"
#include "arrow/util/simdjson_internal.h"

namespace arrow {

Expand Down Expand Up @@ -104,11 +104,11 @@ struct WriteVisitor {
return Status::OK();
}

json::JsonWriter& writer_;
::arrow::internal::JsonWriter& writer_;
const Scalar& scalar_;
};

Status WriteJson(const StructScalar& scalar, json::JsonWriter* writer) {
Status WriteJson(const StructScalar& scalar, ::arrow::internal::JsonWriter* writer) {
WriteVisitor visitor{*writer, scalar};
return VisitWriteableTypeId(Type::STRUCT, &visitor);
}
Expand All @@ -122,7 +122,7 @@ class JsonFormatHelper {
std::stringstream ss;

for (const auto& scalar : scalars) {
json::JsonWriter writer;
::arrow::internal::JsonWriter writer;
RETURN_NOT_OK(WriteJson(*scalar, &writer));

ARROW_ASSIGN_OR_RAISE(auto json, writer.GetString());
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/extension/fixed_shape_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@

#include "arrow/array/array_nested.h"
#include "arrow/array/array_primitive.h"
#include "arrow/json/json_writer_internal.h"
#include "arrow/tensor.h"
#include "arrow/util/logging_internal.h"
#include "arrow/util/print_internal.h"
#include "arrow/util/simdjson_internal.h"
#include "arrow/util/sort_internal.h"
#include "arrow/util/string.h"

using ::arrow::json::JsonWriter;
using ::arrow::internal::JsonWriter;

namespace arrow::extension {

Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/extension/opaque.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

#include <sstream>

#include "arrow/json/json_writer_internal.h"
#include "arrow/util/logging_internal.h"
#include "arrow/util/simdjson_internal.h"

#include <simdjson.h>

using ::arrow::json::JsonWriter;
using ::arrow::internal::JsonWriter;

namespace arrow::extension {

Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/extension/variable_shape_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "arrow/extension/variable_shape_tensor.h"

#include "arrow/array/array_primitive.h"
#include "arrow/json/json_writer_internal.h"
#include "arrow/scalar.h"
#include "arrow/tensor.h"
#include "arrow/util/logging_internal.h"
Expand All @@ -32,7 +31,7 @@
#include "arrow/util/sort_internal.h"
#include "arrow/util/string.h"

using ::arrow::json::JsonWriter;
using ::arrow::internal::JsonWriter;

namespace arrow::extension {

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/flight/sql/odbc/odbc_impl/json_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <boost/beast/core/detail/base64.hpp>
#include "arrow/builder.h"
#include "arrow/flight/sql/odbc/odbc_impl/util.h"
#include "arrow/json/json_writer_internal.h"
#include "arrow/scalar.h"
#include "arrow/util/simdjson_internal.h"
#include "arrow/visitor.h"

using boost::beast::detail::base64::encode;
Expand All @@ -30,7 +30,7 @@ namespace base64 = boost::beast::detail::base64;

namespace arrow::flight::sql::odbc {

using ::arrow::json::JsonWriter;
using ::arrow::internal::JsonWriter;
using util::ThrowIfNotOK;

namespace {
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/integration/json_integration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "arrow/integration/json_internal.h"
#include "arrow/io/file.h"
#include "arrow/ipc/dictionary.h"
#include "arrow/json/json_writer_internal.h"
#include "arrow/record_batch.h"
#include "arrow/result.h"
#include "arrow/status.h"
Expand All @@ -40,7 +39,7 @@
using arrow::ipc::DictionaryFieldMapper;
using arrow::ipc::DictionaryMemo;

using JsonWriter = arrow::json::JsonWriter;
using JsonWriter = arrow::internal::JsonWriter;

namespace arrow::internal::integration {

Expand Down
5 changes: 2 additions & 3 deletions cpp/src/arrow/integration/json_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "arrow/ipc/reader.h"
#include "arrow/ipc/test_common.h"
#include "arrow/ipc/writer.h"
#include "arrow/json/json_writer_internal.h"
#include "arrow/pretty_print.h"
#include "arrow/status.h"
#include "arrow/testing/builder.h"
Expand Down Expand Up @@ -725,7 +724,7 @@ static const char* json_example6 = R"example(
)example";

void TestSchemaRoundTrip(const std::shared_ptr<Schema>& schema) {
arrow::json::JsonWriter writer;
arrow::internal::JsonWriter writer;

DictionaryFieldMapper mapper(*schema);

Expand All @@ -749,7 +748,7 @@ void TestSchemaRoundTrip(const std::shared_ptr<Schema>& schema) {
void TestArrayRoundTrip(const Array& array) {
static std::string name = "dummy";

arrow::json::JsonWriter writer;
arrow::internal::JsonWriter writer;

ASSERT_OK(json::WriteArray(name, array, &writer));

Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/integration/json_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "arrow/array/builder_time.h"
#include "arrow/extension_type.h"
#include "arrow/ipc/dictionary.h"
#include "arrow/json/json_writer_internal.h"
#include "arrow/record_batch.h"
#include "arrow/result.h"
#include "arrow/scalar.h"
Expand Down Expand Up @@ -66,7 +65,7 @@ using arrow::ipc::DictionaryFieldMapper;
using arrow::ipc::DictionaryMemo;
using arrow::ipc::internal::FieldPosition;

using JsonWriter = arrow::json::JsonWriter;
using JsonWriter = arrow::internal::JsonWriter;

namespace arrow::internal::integration::json {

Expand Down
13 changes: 6 additions & 7 deletions cpp/src/arrow/integration/json_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,25 @@ using JsonValue = simdjson::dom::element;
using JsonObject = simdjson::dom::object;
using JsonArray = simdjson::dom::array;

namespace arrow::json {
namespace arrow::internal {
class JsonWriter;
} // namespace arrow::json
} // namespace arrow::internal

namespace arrow::internal::integration::json {

/// \brief Append integration test Schema format to JSON writer
ARROW_EXPORT
Status WriteSchema(const Schema& schema, const ipc::DictionaryFieldMapper& mapper,
arrow::json::JsonWriter*);
JsonWriter*);

ARROW_EXPORT
Status WriteDictionary(int64_t id, const std::shared_ptr<Array>& dictionary,
arrow::json::JsonWriter*);
Status WriteDictionary(int64_t id, const std::shared_ptr<Array>& dictionary, JsonWriter*);

ARROW_EXPORT
Status WriteRecordBatch(const RecordBatch& batch, arrow::json::JsonWriter*);
Status WriteRecordBatch(const RecordBatch& batch, JsonWriter*);

ARROW_EXPORT
Status WriteArray(const std::string& name, const Array& array, arrow::json::JsonWriter*);
Status WriteArray(const std::string& name, const Array& array, JsonWriter*);

ARROW_EXPORT
Result<std::shared_ptr<Schema>> ReadSchema(const JsonValue& json_obj, MemoryPool* pool,
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/arrow/json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ add_arrow_test(test
chunker_test.cc
converter_test.cc
from_string_test.cc
json_writer_internal_test.cc
object_parser_test.cc
parser_test.cc
reader_test.cc
PREFIX
Expand Down
Loading
Loading