ClickHouse / ClickHouse/ClickHouse

Print invisible characters in Vertical format

Open
#85,179 2 comments 5 reactions 0 assignees View on GitHub
comp-formats external usability
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

### Company or project name

GMonit.ru - Observability platform

### Describe the improvement

We find Vertical format very useful.

But in cases when a row contains binary data, it often happens that Vertical format omits (doesn't print) some characters/bytes and this might be confusing for people.

So we propose to add a setting to Vertical (or add a new format) that will allow it to print [those characters](https://invisible-characters.com/).

### Which ClickHouse versions are affected?

25.3.4

### How to reproduce

Example of current Vertical behaviour:

```
click-house-instance :) SELECT arrayReduce('topKState(5)', ['abc', 'qwe']) as a FORMAT Vertical

SELECT arrayReduce('topKState(5)', ['abc', 'qwe']) AS a
FORMAT Vertical

Query id: 392f0ea0-d1e8-4f3f-912f-aa1be8a09965

Row 1:
──────
a: qweabc�

1 row in set. Elapsed: 0.003 sec.
```

Examples of TSV and JSON formats. We'd like Vertical to be able to print something similar:

```
click-house-instance :) SELECT arrayReduce('topKState(5)', ['abc', 'qwe']) as a FORMAT TSV

SELECT arrayReduce('topKState(5)', ['abc', 'qwe']) AS a
FORMAT TSV

Query id: a4f2ce7e-29ee-417e-84ce-cbdc30c67f07

qwe\0abc\0�\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0

1 row in set. Elapsed: 0.003 sec.

click-house-instance :) SELECT arrayReduce('topKState(5)', ['abc', 'qwe']) as a FORMAT JSON

SELECT arrayReduce('topKState(5)', ['abc', 'qwe']) AS a
FORMAT JSON

Query id: 24b236e0-002a-42f3-b92b-27ea63eda8ff

{
"meta":
[
{
"name": "a",
"type": "AggregateFunction(topK(5), String)"
}
],

"data":
[
{
"a": "\u0002\u0003qwe\u0001\u0000\u0003abc\u0001\u0000�\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
}
],

"rows": 1,

"statistics":
{
"elapsed": 0.017433157,
"rows_read": 1,
"bytes_read": 1
}
}

1 row in set. Elapsed: 0.017 sec.
```

### Error message and/or stacktrace

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.