ClickHouse#81794 Pretty print JSON columns in Vertical format#88524
ClickHouse#81794 Pretty print JSON columns in Vertical format#88524alexey-milovidov merged 7 commits intoClickHouse:masterfrom
Conversation
|
Workflow [PR], commit [95c2885] Summary: ❌
|
| if (col.isNullAt(row_num)) | ||
| serializeNullJSON(ostr); | ||
| else | ||
| else if (settings.pretty.charset == FormatSettings::Pretty::Charset::UTF8) { |
There was a problem hiding this comment.
charset is not the best switch for this. It should be controlled by a new setting in FormatFactorySettings.
There was a problem hiding this comment.
This looks strange anyway. Shouldn't it be a separate method, SerializationNullable::serializeTextJSONPretty?
There was a problem hiding this comment.
charsetis not the best switch for this. It should be controlled by a new setting in FormatFactorySettings.
Yeah I copied that from
and it appears to be used in other places as well. We could introduce a new property in this PR if you want?This looks strange anyway. Shouldn't it be a separate method,
SerializationNullable::serializeTextJSONPretty?
Yeah, let's do that. It was pretty much duplicated but it's more consistent.
Here it goes: d462932
alexey-milovidov
left a comment
There was a problem hiding this comment.
The change is generally good!
| ────── | ||
| id: 2 | ||
| data: { | ||
|
|
There was a problem hiding this comment.
Interesting why do we print an empty line?
There was a problem hiding this comment.
Or pass the indent that will make it roughly aligned?
There was a problem hiding this comment.
Interesting why do we print an empty line?
ClickHouse/src/DataTypes/Serializations/SerializationJSON.cpp
Lines 147 to 150 in 9e89905
ClickHouse/src/DataTypes/Serializations/SerializationJSON.cpp
Lines 283 to 293 in 9e89905
Do you want me to change that here, too? It might be a bit out of scope for this LHF issue, wdyt?
There was a problem hiding this comment.
That's ok, let's keep it as is.
|
There are some failing tests that seem unrelated? Are those expeted to be green? |
|
@FRosner this breaks our CI. Could you please add a setting for the feature? Then we could use |
Oops! Sorry. Which CI is broken how? Can you elaborate? |
|
@FRosner (I'll answer for @darkleaf): our regression tests assert output in Vertical format, which supposedly after this PR includes pretty printed jsons |
|
Thanks for the context. I'm not the one to decide how to handle this (this is my first contribution and I'm not working for ClickHouse at this point), so I'll let @alexey-milovidov or someone else decide. If anyone wants my 2 cents, though: Parsing an output format that is documented to be "only appropriate for outputting a query result, but not for parsing" might not be ideal. Why are you relying on vertical output format? Can't you use another format that is meant to be machine-readable? |
Our team members read this files on code review, so it should be human readable. We don't parse, we only diff it. I’d be glad to see a setting similar to these. |
|
I'd prefer if @darkleaf would introduce the required setting in a separate pull request. |


Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
JSONcolumns are now pretty printed when usingVerticalformat. Closes #81794.Documentation entry for user-facing changes
Test Execution