Skip to content

GH-50859: [C++][Parquet] Move JsonWriter to simdjson utilities - #50990

Open
rok wants to merge 3 commits into
apache:mainfrom
rok:gh-50859-parquet-without-json
Open

GH-50859: [C++][Parquet] Move JsonWriter to simdjson utilities#50990
rok wants to merge 3 commits into
apache:mainfrom
rok:gh-50859-parquet-without-json

Conversation

@rok

@rok rok commented Aug 25, 2026

Copy link
Copy Markdown
Member

Rationale for this change

Parquet uses JsonWriter when ARROW_JSON=OFF, but its implementation was only built with Arrow JSON, causing link failures.

What changes are included in this PR?

Move JsonWriter to the simdjson utilities and update its callers and CMake/Meson builds.

Are these changes tested?

Yes. CMake shared/static and Meson Parquet builds pass with JSON disabled. Unit tests and pre-commit checks also pass.

Are there any user-facing changes?

No. This only fixes the affected build configuration.

AI disclosure - this was AI generated to test alternative approach to #50900.

@pitrou

pitrou commented Aug 25, 2026

Copy link
Copy Markdown
Member

The CI failures need fixing.

@rok

rok commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

@pitrou done.

@Reranko05 Reranko05 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rok Since simdjson_internal.cc now exists, shouldn't all the non-template functions currently in simdjson_internal.h be moved into simdjson_internal.cc, leaving only declarations in the header?

@rok

rok commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

@rok Since simdjson_internal.cc now exists, shouldn't all the non-template functions currently in simdjson_internal.h be moved into simdjson_internal.cc, leaving only declarations in the header?

Done

@Reranko05 Reranko05 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rok

rok commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

Again, this PR is purely AI generated. I will mark as ready for review once I review myself.

@pitrou

pitrou commented Aug 27, 2026

Copy link
Copy Markdown
Member

@rok Are you willing to prioritize this?

@rok

rok commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@pitrou I'll review this in about an hour and ping again

@tadeja

tadeja commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

@github-actions crossbow submit example-cpp-tutorial

@github-actions

Copy link
Copy Markdown

Revision: 973b4d2

Submitted crossbow builds: ursacomputing/crossbow @ actions-5765e8701c

Task Status
example-cpp-tutorial GitHub Actions

Parquet uses JsonWriter independently of the Arrow JSON module. Move the writer into the simdjson utilities so it is available whenever simdjson is enabled, including ARROW_JSON=OFF builds. Preserve the writer files as renames and update CMake, Meson, callers, and tests.
@rok
rok force-pushed the gh-50859-parquet-without-json branch from 973b4d2 to 5a1f424 Compare August 27, 2026 14:51
SOURCES
json_writer_internal_test.cc
EXTRA_LINK_LIBS
simdjson::simdjson)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use arrow::simdjson here instead? Both should work, but arrow alieas would hide the vendored/system simdjson.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Aug 27, 2026
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Aug 27, 2026
@rok

rok commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit example-cpp-tutorial

@github-actions

Copy link
Copy Markdown

Revision: 86e85bd

Submitted crossbow builds: ursacomputing/crossbow @ actions-e4578321bd

Task Status
example-cpp-tutorial GitHub Actions

@rok
rok marked this pull request as ready for review August 27, 2026 15:50
@rok
rok requested review from lidavidm, pitrou and wgtmac as code owners August 27, 2026 15:50
Copilot AI lite review requested due to automatic review settings August 27, 2026 15:50
@rok

rok commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit test-ubuntu-24.04-cpp-minimal-with-formats test-ubuntu-24.04-cpp-gcc-13-bundled test-ubuntu-24.04-cpp

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Parquet (and other components) linking failures when ARROW_JSON=OFF by relocating arrow::json::JsonWriter and related simdjson helpers into Arrow util code that is built whenever simdjson support is enabled.

Changes:

  • Update Parquet and other call sites to include arrow/util/json_writer_internal.h instead of the JSON module header.
  • Move/enable building of JsonWriter and simdjson utility implementations outside the ARROW_JSON feature gate (CMake + Meson).
  • Refactor simdjson_internal.h to use exported (non-inline) function declarations with a new simdjson_internal.cc implementation, and relocate/adjust unit tests accordingly.

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cpp/src/parquet/types.cc Switch JsonWriter include to util header to avoid JSON-gated dependency.
cpp/src/parquet/printer.cc Switch JsonWriter include to util header.
cpp/src/parquet/geospatial/util_json_internal.cc Switch JsonWriter include to util header.
cpp/src/parquet/encryption/local_wrap_kms_client.cc Switch JsonWriter include to util header.
cpp/src/parquet/encryption/key_metadata.cc Switch JsonWriter include to util header.
cpp/src/parquet/encryption/key_material.cc Switch JsonWriter include to util header.
cpp/src/parquet/encryption/file_system_key_material_store.cc Switch JsonWriter include to util header.
cpp/src/arrow/util/simdjson_internal.h Move simdjson helpers from inline definitions to exported declarations and adjust namespace style.
cpp/src/arrow/util/simdjson_internal.cc New translation unit providing implementations for simdjson helpers previously inlined.
cpp/src/arrow/util/meson.build Add JsonWriter internal test to util test suite when simdjson is needed; adjust deps.
cpp/src/arrow/util/json_writer_internal.h New util header location for JsonWriter API used by Parquet when JSON is disabled.
cpp/src/arrow/util/json_writer_internal.cc Update implementation to include the new util header path.
cpp/src/arrow/util/json_writer_internal_test.cc Update test include to new util header path.
cpp/src/arrow/util/CMakeLists.txt Add a dedicated JsonWriter internal test target when simdjson is enabled.
cpp/src/arrow/meson.build Ensure simdjson dependency and util simdjson/json-writer sources are built when needed (incl. Parquet).
cpp/src/arrow/json/meson.build Remove JsonWriter internal test from JSON test executable.
cpp/src/arrow/json/CMakeLists.txt Remove JsonWriter internal test from JSON test target.
cpp/src/arrow/integration/json_internal.cc Switch JsonWriter include to util header.
cpp/src/arrow/integration/json_integration.cc Switch JsonWriter include to util header.
cpp/src/arrow/integration/json_integration_test.cc Switch JsonWriter include to util header.
cpp/src/arrow/flight/sql/odbc/odbc_impl/json_converter.cc Switch JsonWriter include to util header.
cpp/src/arrow/extension/variable_shape_tensor.cc Switch JsonWriter include to util header.
cpp/src/arrow/extension/opaque.cc Switch JsonWriter include to util header.
cpp/src/arrow/extension/fixed_shape_tensor.cc Switch JsonWriter include to util header.
cpp/src/arrow/dataset/file_json_test.cc Switch JsonWriter include to util header.
cpp/src/arrow/CMakeLists.txt Build and link JsonWriter + simdjson utility sources when simdjson is enabled; remove JSON-gated build of JsonWriter.
cpp/meson.build Introduce needs_simdjson (driven by JSON or Parquet) to control simdjson-dependent compilation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown

Revision: 86e85bd

Submitted crossbow builds: ursacomputing/crossbow @ actions-b71eaadb5c

Task Status
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions

@rok

rok commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@pitrou this is ready for humans!

@rok rok added the CI: Extra: C++ Run extra C++ CI label Aug 27, 2026
Copilot AI review requested due to automatic review settings August 27, 2026 17:14
@rok

rok commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit test-ubuntu-24.04-cpp-minimal-with-formats test-ubuntu-24.04-cpp-gcc-13-bundled test-ubuntu-24.04-cpp example-cpp-tutorial

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 1 comment.

Comment on lines 20 to 22
#include "arrow/json/object_parser.h"
#include "arrow/util/json_writer_internal.h"
#include "arrow/util/secure_string.h"
@github-actions

Copy link
Copy Markdown

Revision: 4d93dff

Submitted crossbow builds: ursacomputing/crossbow @ actions-fca50b3ffc

Task Status
example-cpp-tutorial GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions

@rok

rok commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

#50912 switched flight ODBC from RapidJSON to simdjson JsonWriter, but did not enable ARROW_WITH_SIMDJSON for ODBC-only builds. This PR now (4d93dff) makes JsonWriter available independently of ARROW_JSON, so it's possible to build ARROW_FLIGHT_SQL_ODBC=ON with ARROW_JSON=OFF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants