Skip to content

Bugfix: set json read/write setting for binary mode too#282

Merged
alex-clickhouse merged 2 commits intomainfrom
json-mode-bugfix
Apr 13, 2026
Merged

Bugfix: set json read/write setting for binary mode too#282
alex-clickhouse merged 2 commits intomainfrom
json-mode-bugfix

Conversation

@alex-clickhouse
Copy link
Copy Markdown
Collaborator

@alex-clickhouse alex-clickhouse commented Apr 9, 2026

Previously, setting JsonReadMode = String set the setting output_format_binary_write_json_as_string = 1. But JsonReadMode = Binary did not set it to 0, and relied on the server default to work. But the server setting is not necessarily 0, so this needs to be set explicitly.

Copilot AI review requested due to automatic review settings April 9, 2026 09:54
@alex-clickhouse alex-clickhouse requested a review from mzitnik as a code owner April 9, 2026 09:54
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes JSON read/write modes more explicit by always sending ClickHouse’s binary JSON format settings for Binary mode (instead of relying on server defaults), and adds integration tests to verify the settings behavior and override precedence.

Changes:

  • Explicitly sets output_format_binary_write_json_as_string=0 when JsonReadMode.Binary.
  • Explicitly sets input_format_binary_read_json_as_string=0 when JsonWriteMode.Binary.
  • Adds tests to verify settings for String/Binary/None modes and that QueryOptions.CustomSettings can override the auto JSON setting.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ClickHouse.Driver/Json/JsonWriteMode.cs Updates enum docs to reflect explicit server setting behavior for Binary mode.
ClickHouse.Driver/Json/JsonReadMode.cs Updates enum docs to reflect explicit server setting behavior for Binary mode.
ClickHouse.Driver/ClickHouseUriBuilder.cs Injects explicit JSON format settings for both Binary and String modes, leaving None as “don’t send”.
ClickHouse.Driver.Tests/Types/JsonModeTests.cs Adds coverage for setting injection/omission across JSON modes.
ClickHouse.Driver.Tests/ClickHouseClientQueryOptionsTests.cs Adds test that per-query custom settings override the auto JSON setting.

Comment thread ClickHouse.Driver/ClickHouseUriBuilder.cs
Comment thread ClickHouse.Driver/ClickHouseUriBuilder.cs
Comment thread ClickHouse.Driver/Json/JsonReadMode.cs
Comment thread ClickHouse.Driver/Json/JsonWriteMode.cs
@alex-clickhouse
Copy link
Copy Markdown
Collaborator Author

@codex[agent] review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

@mzitnik mzitnik left a comment

Choose a reason for hiding this comment

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

LGTM

@alex-clickhouse alex-clickhouse merged commit 1edf827 into main Apr 13, 2026
17 checks passed
@alex-clickhouse alex-clickhouse deleted the json-mode-bugfix branch April 13, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants