From 49a4332eaa4f2642c894caeb6f6a01938b9b7e74 Mon Sep 17 00:00:00 2001 From: Krishnanand G <118352827+Krishnanand-G@users.noreply.github.com> Date: Tue, 18 Aug 2026 14:19:44 +0530 Subject: [PATCH] GH-50859: [C++] Build JsonWriter when Parquet is enabled without JSON json_writer_internal.cc lived in the ARROW_JSON object library, so ARROW_JSON=OFF left parquet tools with undefined JsonWriter symbols. Signed-off-by: Krishnanand G <118352827+Krishnanand-G@users.noreply.github.com> --- cpp/src/arrow/CMakeLists.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index c5bc01c8ef9..1a9c947c2d7 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -1070,6 +1070,18 @@ else() set(ARROW_IPC_TARGET_STATIC) endif() +# Parquet (LogicalType::ToJSON, encryption, geospatial) calls JsonWriter +# even when ARROW_JSON=OFF. Keep the writer in its own object library. +if(ARROW_JSON OR ARROW_PARQUET) + arrow_add_object_library(ARROW_JSON_WRITER json/json_writer_internal.cc) + foreach(ARROW_JSON_WRITER_TARGET ${ARROW_JSON_WRITER_TARGETS}) + target_link_libraries(${ARROW_JSON_WRITER_TARGET} PRIVATE arrow::simdjson) + endforeach() +else() + set(ARROW_JSON_WRITER_TARGET_SHARED) + set(ARROW_JSON_WRITER_TARGET_STATIC) +endif() + if(ARROW_JSON) arrow_add_object_library(ARROW_JSON extension/fixed_shape_tensor.cc @@ -1081,7 +1093,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) @@ -1195,6 +1206,7 @@ add_arrow_lib(arrow ${ARROW_IO_TARGET_SHARED} ${ARROW_IPC_TARGET_SHARED} ${ARROW_JSON_TARGET_SHARED} + ${ARROW_JSON_WRITER_TARGET_SHARED} ${ARROW_MEMORY_POOL_TARGET_SHARED} ${ARROW_ORC_TARGET_SHARED} ${ARROW_TELEMETRY_TARGET_SHARED} @@ -1211,6 +1223,7 @@ add_arrow_lib(arrow ${ARROW_IO_TARGET_STATIC} ${ARROW_IPC_TARGET_STATIC} ${ARROW_JSON_TARGET_STATIC} + ${ARROW_JSON_WRITER_TARGET_STATIC} ${ARROW_MEMORY_POOL_TARGET_STATIC} ${ARROW_ORC_TARGET_STATIC} ${ARROW_TELEMETRY_TARGET_STATIC}