Merged
Conversation
Fixes: #1638 The actual bug is in the `Nullable` [column here.](https://github.com/ClickHouse/clickhouse-go/blob/12088fe6b4a62f27e7cdb43d3bbebbcfccd9a5cb/lib/column/nullable.go?plain=1#L134-L136) We check if the value is nil only if type is `reflect.Pointer`. In our case, it's `reflect.Map` (which can also be nil). Following is verification using `clickhouse-client` with and without patch. ``` SELECT * FROM test_nullable_json Query id: 485b3606-fe0e-45e9-8719-f7a88e0daaf9 ┌─id─┬─payload─┐ 1. │ 2 │ {} │ └────┴─────────┘ 1 row in set. Elapsed: 0.006 sec. ``` ``` SELECT * FROM test_nullable_json Query id: f626b8e0-e71e-4ec0-ad29-256903d4a348 ┌─id─┬─payload─┐ 1. │ 2 │ ᴺᵁᴸᴸ │ └────┴─────────┘ 1 row in set. Elapsed: 0.003 sec. ``` Notice how after the patch, the column value is populated correctly as `NULL`. Also verified with original code in the description. We are able to get back the NULL column correctly as `nil` value. Locked the behavior via integration tests Signed-off-by: Kaviraj <[email protected]>
Signed-off-by: Kaviraj <[email protected]>
Signed-off-by: Kaviraj <[email protected]>
chernser
reviewed
Sep 22, 2025
chernser
reviewed
Sep 22, 2025
SpencerTorres
approved these changes
Sep 23, 2025
Signed-off-by: Kaviraj <[email protected]>
chernser
approved these changes
Sep 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #1638
See this discussion
The actual bug is in the
Nullablecolumn here.We check if the value is nil only if type is
reflect.Pointer. In our case, it'sreflect.Map(which can also be nil).Following is verification using
clickhouse-clientwith and without patch.Notice how after the patch, the column value is populated correctly as
NULL.Also verified with original code in the description. We are able to get back the NULL column correctly as
nilvalue. Locked the behavior via integration testsSummary
Checklist
Delete items not relevant to your PR: