> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# output_format_* 格式设置

> ClickHouse 在 output_format_* 自动生成组中的格式设置。

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>类型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>默认值</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          无需重启即可更改
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

这些设置是根据[源文件](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/FormatFactorySettings.h)自动生成的。

<div id="output_format_always_write_decimal_point_in_float_and_decimal">
  ## output\_format\_always\_write\_decimal\_point\_in\_float\_and\_decimal
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "新增设置：在文本格式中，始终为浮点数和 Decimal 数字输出小数点，即使该值为整数。"}]}]} />

在文本格式中，始终为浮点数和 Decimal 数字输出小数点，即使该值为整数也是如此。例如，输出 `1.` 而不是 `1`。

默认禁用。

<div id="output_format_arrow_compression_method">
  ## output\_format\_arrow\_compression\_method
</div>

<SettingsInfoBlock type="ArrowCompression" default_value="lz4_frame" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.3"},{"label": "lz4_frame"},{"label": "默认对 Arrow 输出格式使用 lz4 压缩"}]}]} />

Arrow 输出格式的压缩方法。支持的编解码器：lz4\_frame、zstd、none (未压缩)

<div id="output_format_arrow_date_as_uint16">
  ## output\_format\_arrow\_date\_as\_uint16
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "默认将 Date 写为 Arrow DATE32，而不是普通的 UInt16。"}]}]} />

将 Date 值写为普通的 16 位数字 (读取时为 UInt16) ，而不是转换为 32 位的 Arrow DATE32 类型 (读取时为 Date32) 。

<div id="output_format_arrow_fixed_string_as_fixed_byte_array">
  ## output\_format\_arrow\_fixed\_string\_as\_fixed\_byte\_array
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.2"},{"label": "1"},{"label": "默认对 FixedString 列使用 Arrow FIXED_SIZE_BINARY 类型"}]}]} />

对 FixedString 列，使用 Arrow FIXED\_SIZE\_BINARY 类型而不是 Binary 类型。

<div id="output_format_arrow_low_cardinality_as_dictionary">
  ## output\_format\_arrow\_low\_cardinality\_as\_dictionary
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

启用将输出中的 LowCardinality 类型表示为 Dictionary Arrow 类型

<div id="output_format_arrow_string_as_string">
  ## output\_format\_arrow\_string\_as\_string
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "ClickHouse 允许 String 类型包含任意二进制数据，而该类型通常使用 UTF-8。Parquet\/ORC\/Arrow 的 String 仅支持 UTF-8。因此，你可以为 ClickHouse 的 String 类型选择使用哪种 Arrow 数据类型——String 或 Binary。虽然 Binary 在语义上更准确、兼容性也更好，但默认使用 String 在大多数情况下更符合用户预期。"}]}]} />

对 String 列使用 Arrow 的 String 类型而非 Binary

<div id="output_format_arrow_unsupported_types_as_binary">
  ## output\_format\_arrow\_unsupported\_types\_as\_binary
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "新增设置：将不受支持的 CH 类型转换为 Arrow binary，而不是抛出 UNKNOWN_TYPE 异常。"}]}]} />

将无法转换的输出类型作为原始二进制数据输出。如果为 false，则此类类型会抛出 UNKNOWN\_TYPE 异常。

<div id="output_format_arrow_use_64_bit_indexes_for_dictionary">
  ## output\_format\_arrow\_use\_64\_bit\_indexes\_for\_dictionary
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "0"},{"label": "允许在 Arrow 字典中使用 64 位索引类型"}]}, {"id": "row-2","items": [{"label": "24.1"},{"label": "0"},{"label": "允许在 Arrow 字典中使用 64 位索引类型"}]}]} />

在 Arrow 格式中，始终对字典索引使用 64 位整数

<div id="output_format_arrow_use_native_writer">
  ## output\_format\_arrow\_use\_native\_writer
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "1"},{"label": "新增设置：对 Arrow 和 ArrowStream 格式使用原生 ClickHouse 写入器，而不是基于 Apache Arrow 库的写入器。"}]}]} />

对 Arrow 和 ArrowStream 格式使用原生 ClickHouse 写入器，而不是基于 Apache Arrow 库的写入器。

<div id="output_format_arrow_use_signed_indexes_for_dictionary">
  ## output\_format\_arrow\_use\_signed\_indexes\_for\_dictionary
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "1"},{"label": "默认对 Arrow 字典使用有符号索引类型，这是推荐做法"}]}]} />

在 Arrow 格式中对字典索引使用有符号整数

<div id="output_format_avro_codec">
  ## output\_format\_avro\_codec
</div>

用于输出的压缩编解码器。可选值：'null'、'deflate'、'snappy'、'zstd'。

<div id="output_format_avro_confluent_subject">
  ## output\_format\_avro\_confluent\_subject
</div>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": ""},{"label": "新增设置：用于指定写入 AvroConfluent output 时，在 Confluent Schema Registry 中注册 schema 所使用的 subject name。"}]}]} />

对于 AvroConfluent output format：在 Confluent Schema Registry 中注册 schema 时使用的 subject name。写入 AvroConfluent output 时为必填项。

<div id="output_format_avro_rows_in_file">
  ## output\_format\_avro\_rows\_in\_file
</div>

<SettingsInfoBlock type="UInt64" default_value="1" />

单个文件中的最大行数 (如果存储支持)

<div id="output_format_avro_string_column_pattern">
  ## output\_format\_avro\_string\_column\_pattern
</div>

对于 Avro 格式：用于选择作为 AVRO 字符串输出的 String 列的正则表达式。

<div id="output_format_avro_sync_interval">
  ## output\_format\_avro\_sync\_interval
</div>

<SettingsInfoBlock type="UInt64" default_value="16384" />

以字节为单位的同步间隔。

<div id="output_format_binary_encode_types_in_binary_format">
  ## output\_format\_binary\_encode\_types\_in\_binary\_format
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "0"},{"label": "新增设置，允许在 RowBinaryWithNamesAndTypes 输出格式中以二进制格式写入类型名称"}]}]} />

在 RowBinaryWithNamesAndTypes 输出格式中，以二进制格式写入数据类型，而不是类型名称

<div id="output_format_binary_write_json_as_string">
  ## output\_format\_binary\_write\_json\_as\_string
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "新增设置，用于在 RowBinary 输出格式中将 JSON type 的值写为 JSON 字符串"}]}]} />

在 RowBinary 输出格式中，将 [JSON](/docs/zh/reference/data-types/newjson) data type 的值写为 JSON [String](/docs/zh/reference/data-types/string) 值。

<div id="output_format_bson_string_as_string">
  ## output\_format\_bson\_string\_as\_string
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

对 String 列使用 BSON String 类型，而不是 Binary。

<div id="output_format_compression_level">
  ## output\_format\_compression\_level
</div>

<SettingsInfoBlock type="UInt64" default_value="3" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "3"},{"label": "允许在查询输出中调整压缩级别"}]}]} />

查询输出被压缩时使用的默认压缩级别。该设置会在 `SELECT` 查询使用 `INTO OUTFILE` 时，或将数据写入表函数 `file`、`url`、`hdfs`、`s3` 或 `azureBlobStorage` 时生效。

可能的取值：从 `1` 到 `22`

<div id="output_format_compression_zstd_window_log">
  ## output\_format\_compression\_zstd\_window\_log
</div>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "0"},{"label": "允许在使用 zstd 压缩时修改查询输出中的 zstd window log"}]}]} />

可在输出压缩方法为 `zstd` 时使用。如果该值大于 `0`，此设置会显式指定压缩窗口大小 (`2` 的幂) ，并为 zstd 压缩启用长距离模式。这有助于获得更高的压缩率。

Possible values: 非负数。请注意，如果该值过小或过大，`zstdlib` 将抛出异常。典型值范围为 `20` (window size = `1MB`) 到 `30` (window size = `1GB`) 。

<div id="output_format_csv_crlf_end_of_line">
  ## output\_format\_csv\_crlf\_end\_of\_line
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

如果设置为 true，CSV 格式的行尾将使用 \r\n 而不是 \n。

<div id="output_format_csv_header_serialize_tuple_into_separate_columns">
  ## output\_format\_csv\_header\_serialize\_tuple\_into\_separate\_columns
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "1"},{"label": "新设置。当启用 output_format_csv_serialize_tuple_into_separate_columns 时，CSVWithNames\/CSVWithNamesAndTypes 的表头现在会将 Tuple 列展平为其叶子字段，使表头列数与数据一致。设置为 false 可恢复为之前的单名称表头。"}]}]} />

当启用 [output\_format\_csv\_serialize\_tuple\_into\_separate\_columns](/docs/zh/reference/settings/formats/output-format#output_format_csv_serialize_tuple_into_separate_columns) 时，`CSVWithNames` 和 `CSVWithNamesAndTypes` 的表头会将每个 Tuple 列展平为其叶子字段 (点号名称如 `t.a`、`t.b`，以及叶子类型名称) ，因此表头的列数与数据相同。对于 `CustomSeparated*`，只有在 `format_custom_escaping_rule = 'CSV'` 且 `format_custom_field_delimiter` 是与 `format_csv_delimiter` 相同的单个字符时，才会应用这种展平；否则 (例如默认的制表符分隔符，或 `format_custom_field_delimiter = '|'`) ，表头将保持未展平状态，以便继续与数据匹配。将其设置为 `0` 可保留之前的行为，即表头保留单个顶层 Tuple 名称和类型。

注意：当 `input_format_with_names_use_header = 1` 时，展平后的表头不会按名称读回到 Tuple 中。要将此类数据重新读入 Tuple，可以在输出时将此设置设为 `0`，或者在读取时使用 `input_format_with_names_use_header = 0` (并且对于 `*WithNamesAndTypes` 格式 `CSVWithNamesAndTypes` 和 `CustomSeparatedWithNamesAndTypes`，还需设置 `input_format_with_types_use_header = 0`，否则展平后的类型行会拿去与单个顶层 Tuple 输入字段做校验，并因此被拒绝) 。

<div id="output_format_csv_serialize_tuple_into_separate_columns">
  ## output\_format\_csv\_serialize\_tuple\_into\_separate\_columns
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "1"},{"label": "新增了一种在 CSV 格式中解释 Tuple 的方式。"}]}, {"id": "row-2","items": [{"label": "24.3"},{"label": "1"},{"label": "新增了一种在 CSV 格式中解释 Tuple 的方式。"}]}]} />

如果将其设为 true，则 CSV 格式中的 Tuple 会被序列化为单独的列 (即会丢失其在 Tuple 中的嵌套结构)

<div id="output_format_decimal_trailing_zeros">
  ## output\_format\_decimal\_trailing\_zeros
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.9"},{"label": "0"},{"label": "默认情况下，为了让输出更美观，Decimal 类型的文本表示不会输出末尾的零"}]}]} />

输出 Decimal 值时保留末尾的零。例如，输出 `1.230000` 而不是 `1.23`。

默认禁用。

<div id="output_format_float_precision">
  ## output\_format\_float\_precision
</div>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "用于控制浮点输出中小数位数的新设置"}]}]} />

当该值非 0 时，将浮点输出 (`Float32`、`Float64`、`BFloat16`) 格式化为小数点后最多保留这么多位数字 (会去除末尾的零) 。
当值为 0 (默认值) 时，使用最短的 round-trip 表示形式。

如果某个值大到不适合使用定点表示法，或其绝对值小到按指定精度舍入后会丢失所有有效数字 (尾数会变为 `±0`) ，则会改用科学计数法输出。在这些回退情况下，尾数的小数位数可能会超过指定的位数。

有效范围：0 到 100。

<div id="output_format_image_height">
  ## output\_format\_image\_height
</div>

<SettingsInfoBlock type="UInt64" default_value="1024" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1024"},{"label": "新增设置：用于控制 `PNG` 等图像输出格式的输出图像高度。"}]}]} />

对于 `PNG` 等图像输出格式，输出图像的高度 (单位为像素) 。

默认值：1024。

<div id="output_format_image_terminal_mode">
  ## output\_format\_image\_terminal\_mode
</div>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": ""},{"label": "新增设置，用于控制是否通过内联图像协议将 PNG 等图像输出格式直接渲染到终端。"}]}]} />

对于 `PNG` 等图像输出格式，使用内联图像协议将图像直接输出到终端，而不是写出原始图像字节。

可能的值：

* \`\` (空) — 写出原始图像字节 (默认) 。
* `iterm` — 使用 iTerm2 内联图像协议。
* `kitty` — 使用 Kitty 图形协议。
* `sixel` — 使用 Sixel 协议。
* `auto` — 如果输出目标是终端，则检测其支持情况并使用 `iterm`、`kitty` 或 `sixel` (按此顺序) ；否则写出原始图像字节。

默认值：\`\` (空) 。

<div id="output_format_image_width">
  ## output\_format\_image\_width
</div>

<SettingsInfoBlock type="UInt64" default_value="1024" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1024"},{"label": "用于控制 PNG 等图像输出格式的输出图像宽度的新设置。"}]}]} />

PNG 等图像输出格式的输出图像宽度，以像素为单位。

默认值：1024。

<div id="output_format_json_array_of_rows">
  ## output\_format\_json\_array\_of\_rows
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

启用后，可在 [JSONEachRow](/docs/zh/reference/formats/JSON/JSONEachRow) 格式中将所有行作为一个 JSON 数组输出。

Possible values:

* 1 — ClickHouse 将所有行输出为一个数组，其中每一行都采用 `JSONEachRow` 格式。
* 0 — ClickHouse 以 `JSONEachRow` 格式分别输出每一行。

**启用此设置时的查询示例**

查询：

```sql theme={null}
SET output_format_json_array_of_rows = 1;
SELECT number FROM numbers(3) FORMAT JSONEachRow;
```

结果：

```text theme={null}
[
{"number":"0"},
{"number":"1"},
{"number":"2"}
]
```

**禁用该设置时的查询示例**

查询：

```sql theme={null}
SET output_format_json_array_of_rows = 0;
SELECT number FROM numbers(3) FORMAT JSONEachRow;
```

结果：

```text theme={null}
{"number":"0"}
{"number":"1"}
{"number":"2"}
```

<div id="output_format_json_escape_forward_slashes">
  ## output\_format\_json\_escape\_forward\_slashes
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

控制在 JSON 输出格式中，是否对字符串输出中的正斜杠进行转义。此设置旨在与 JavaScript 保持兼容。不要将其与始终会被转义的反斜杠混淆。

默认启用。

<div id="output_format_json_map_as_array_of_tuples">
  ## output\_format\_json\_map\_as\_array\_of\_tuples
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "0"},{"label": "新增设置"}]}]} />

将 Map 列序列化为由 Tuple 组成的 JSON 数组。

默认禁用。

<div id="output_format_json_named_tuples_as_objects">
  ## output\_format\_json\_named\_tuples\_as\_objects
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.6"},{"label": "1"},{"label": "默认情况下允许在 JSON 格式中将命名元组序列化为 JSON 对象"}]}]} />

将命名元组列序列化为 JSON 对象。

默认启用。

<div id="output_format_json_pretty_print">
  ## output\_format\_json\_pretty\_print
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "默认在 JSON 输出格式中以 Pretty 格式输出值"}]}]} />

此设置决定了使用 JSON 输出格式时，`data` 数组中的 Tuple、Map 和 Array 等嵌套结构的显示方式。

例如，输出不再是：

```json theme={null}
"data":
[
  {
    "tuple": {"a":1,"b":2,"c":3},
    "array": [1,2,3],
    "map": {"a":1,"b":2,"c":3}
  }
],
```

输出格式如下：

```json theme={null}
"data":
[
    {
        "tuple": {
            "a": 1,
            "b": 2,
            "c": 3
        },
        "array": [
            1,
            2,
            3
        ],
        "map": {
            "a": 1,
            "b": 2,
            "c": 3
        }
    }
],
```

默认启用。

<div id="output_format_json_quote_64bit_floats">
  ## output\_format\_json\_quote\_64bit\_floats
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

控制在 JSON\* 格式中输出 64 位[浮点数](/docs/zh/reference/data-types/float)时，是否为其加上引号。

默认情况下禁用。

<div id="output_format_json_quote_64bit_integers">
  ## output\_format\_json\_quote\_64bit\_integers
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "默认禁用 JSON 中 64 位整数的引号包裹"}]}]} />

控制在以 [JSON](/docs/zh/reference/formats/JSON/JSON) 格式输出时，是否为 64 位或更大的[整数](/docs/zh/reference/data-types/int-uint) (如 `UInt64` 或 `Int128`) 添加引号。
默认情况下，这类整数会被引号括起来。此行为与大多数 JavaScript 实现兼容。

可能的值：

* 0 — 整数输出时不带引号。
* 1 — 整数会被引号括起来。

<div id="output_format_json_quote_decimals">
  ## output\_format\_json\_quote\_decimals
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

控制在 JSON 输出格式中是否将 Decimal 值用引号括起来。

默认禁用。

<div id="output_format_json_quote_denormals">
  ## output\_format\_json\_quote\_denormals
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

允许在 [JSON](/docs/zh/reference/formats/JSON/JSON) 输出格式中输出 `+nan`、`-nan`、`+inf` 和 `-inf`。

可能的值：

* 0 — 已禁用。
* 1 — 已启用。

**示例**

考虑以下表 `account_orders`：

```text theme={null}
┌─id─┬─name───┬─duration─┬─period─┬─area─┐
│  1 │ Andrew │       20 │      0 │  400 │
│  2 │ John   │       40 │      0 │    0 │
│  3 │ Bob    │       15 │      0 │ -100 │
└────┴────────┴──────────┴────────┴──────┘
```

当 `output_format_json_quote_denormals = 0` 时，查询结果的输出中会返回 `null` 值：

```sql theme={null}
SELECT area/period FROM account_orders FORMAT JSON;
```

```json theme={null}
{
        "meta":
        [
                {
                        "name": "divide(area, period)",
                        "type": "Float64"
                }
        ],

        "data":
        [
                {
                        "divide(area, period)": null
                },
                {
                        "divide(area, period)": null
                },
                {
                        "divide(area, period)": null
                }
        ],

        "rows": 3,

        "statistics":
        {
                "elapsed": 0.003648093,
                "rows_read": 3,
                "bytes_read": 24
        }
}
```

当 `output_format_json_quote_denormals = 1` 时，查询将返回：

```json theme={null}
{
        "meta":
        [
                {
                        "name": "divide(area, period)",
                        "type": "Float64"
                }
        ],

        "data":
        [
                {
                        "divide(area, period)": "inf"
                },
                {
                        "divide(area, period)": "-nan"
                },
                {
                        "divide(area, period)": "-inf"
                }
        ],

        "rows": 3,

        "statistics":
        {
                "elapsed": 0.000070241,
                "rows_read": 3,
                "bytes_read": 24
        }
}
```

<div id="output_format_json_skip_null_value_in_named_tuples">
  ## output\_format\_json\_skip\_null\_value\_in\_named\_tuples
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

将命名元组列序列化为 JSON 对象时，跳过值为 NULL 的键值对。仅当 output\_format\_json\_named\_tuples\_as\_objects 为 true 时，此设置才生效。

<div id="output_format_json_validate_utf8">
  ## output\_format\_json\_validate\_utf8
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

控制是否在 JSON 输出格式中验证 UTF-8 序列；不影响 JSON/JSONCompact/JSONColumnsWithMetadata 格式，这些格式始终会验证 UTF-8。

默认禁用。

<div id="output_format_markdown_escape_special_characters">
  ## output\_format\_markdown\_escape\_special\_characters
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

启用后，会对 Markdown 中的特殊字符进行转义。

[Common Mark](https://spec.commonmark.org/0.30/#example-12) 定义了以下可转义的特殊字符：

```
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
```

可选值：

* 0 — 禁用。
* 1 — 启用。

<div id="output_format_msgpack_uuid_representation">
  ## output\_format\_msgpack\_uuid\_representation
</div>

<SettingsInfoBlock type="MsgPackUUIDRepresentation" default_value="ext" />

UUID 在 MsgPack 格式中的输出方式。

<div id="output_format_native_encode_types_in_binary_format">
  ## output\_format\_native\_encode\_types\_in\_binary\_format
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "0"},{"label": "新增设置，允许在 Native 输出格式中以二进制格式写入类型名称"}]}]} />

在 Native 输出格式中，以二进制格式写入数据类型，而不是写入类型名称

<div id="output_format_native_use_flattened_dynamic_and_json_serialization">
  ## output\_format\_native\_use\_flattened\_dynamic\_and\_json\_serialization
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "0"},{"label": "为 Native 格式添加扁平化的 Dynamic\/JSON 序列化"}]}]} />

以扁平化格式写入 [JSON](/docs/zh/reference/data-types/newjson) 和 [Dynamic](/docs/zh/reference/data-types/dynamic) 列中的数据 (所有类型/路径均作为独立的子列) 。

<div id="output_format_native_write_json_as_string">
  ## output\_format\_native\_write\_json\_as\_string
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "新增设置，允许在 Native 格式 中将 JSON 列写入为单个 String 列"}]}]} />

将 [JSON](/docs/zh/reference/data-types/newjson) 列的数据写入为包含 JSON 字符串的 [String](/docs/zh/reference/data-types/string) 列，而不是使用默认的原生 JSON 序列化。

<div id="output_format_orc_compression_block_size">
  ## output\_format\_orc\_compression\_block\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="262144" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "262144"},{"label": "新增设置"}]}]} />

ORC 输出格式的压缩块大小，以字节为单位。

<div id="output_format_orc_compression_method">
  ## output\_format\_orc\_compression\_method
</div>

<SettingsInfoBlock type="ORCCompression" default_value="zstd" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "zstd"},{"label": "Parquet\/ORC\/Arrow 支持多种压缩方法，包括 lz4 和 zstd。ClickHouse 支持所有这些压缩方法。而一些功能较弱的工具（例如 'duckdb'）不支持速度更快的 `lz4` 压缩方法，因此我们默认设置为 zstd。"}]}, {"id": "row-2","items": [{"label": "23.3"},{"label": "lz4_frame"},{"label": "默认在 ORC 输出格式中使用 lz4 压缩"}]}]} />

ORC 输出格式的压缩方法。支持的编解码器：lz4、snappy、zlib、zstd、none (未压缩)

<div id="output_format_orc_dictionary_key_size_threshold">
  ## output\_format\_orc\_dictionary\_key\_size\_threshold
</div>

<SettingsInfoBlock type="Double" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "对于 ORC 输出格式中的字符串列，如果不同值的数量超过非 NULL 行总数的该比例，则关闭字典编码；否则启用字典编码"}]}]} />

对于 ORC 输出格式中的字符串列，如果不同值的数量超过非 NULL 行总数的该比例，则关闭字典编码；否则启用字典编码

<div id="output_format_orc_row_index_stride">
  ## output\_format\_orc\_row\_index\_stride
</div>

<SettingsInfoBlock type="UInt64" default_value="10000" />

ORC 输出格式中的目标行索引步长

<div id="output_format_orc_string_as_string">
  ## output\_format\_orc\_string\_as\_string
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "ClickHouse 允许在 String 类型中存储任意二进制数据，而该类型通常通常采用 UTF-8 编码。Parquet\/ORC\/Arrow 的 String 仅支持 UTF-8。因此，你可以为 ClickHouse 的 String 类型选择使用哪种 Arrow 数据类型：String 或 Binary。虽然 Binary 在语义上更准确、兼容性也更好，但默认使用 String 在大多数情况下更符合用户预期。"}]}]} />

对 String 列使用 ORC String 类型，而不是 Binary

<div id="output_format_orc_writer_time_zone_name">
  ## output\_format\_orc\_writer\_time\_zone\_name
</div>

<SettingsInfoBlock type="String" default_value="GMT" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "GMT"},{"label": "ORC 写入器的时区名称，默认时区为 GMT。"}]}]} />

ORC 写入器的时区名称，默认时区为 GMT。

<div id="output_format_parallel_formatting">
  ## output\_format\_parallel\_formatting
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

启用或禁用数据格式的并行格式化功能。仅 [TSV](/docs/zh/reference/formats/TabSeparated/TabSeparated)、[TSKV](/docs/zh/reference/formats/TabSeparated/TSKV)、[CSV](/docs/zh/reference/formats/CSV/CSV) 和 [JSONEachRow](/docs/zh/reference/formats/JSON/JSONEachRow) 格式支持此功能。

可选值：

* 1 — 启用。
* 0 — 禁用。

<div id="output_format_parquet_batch_size">
  ## output\_format\_parquet\_batch\_size
</div>

<SettingsInfoBlock type="NonZeroUInt64" default_value="1024" />

每处理这么多行就检查一次页大小。如果列中值的平均大小超过几个 KB，建议适当减小该值。

<div id="output_format_parquet_bloom_filter_bits_per_value">
  ## output\_format\_parquet\_bloom\_filter\_bits\_per\_value
</div>

<SettingsInfoBlock type="Double" default_value="10.5" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "10.5"},{"label": "新设置。"}]}]} />

Parquet 布隆过滤器中每个不同值大致使用的位数。估计的误报率如下：

* 6   位 - 10%
* 10.5 位 -  1%
* 16.9 位 -  0.1%
* 26.4 位 -  0.01%
* 41   位 -  0.001%

<div id="output_format_parquet_bloom_filter_flush_threshold_bytes">
  ## output\_format\_parquet\_bloom\_filter\_flush\_threshold\_bytes
</div>

<SettingsInfoBlock type="UInt64" default_value="134217728" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "134217728"},{"label": "新增设置。"}]}]} />

用于指定在 Parquet 文件中的何处放置布隆过滤器。布隆过滤器将按大致该大小分组写入。具体来说：

* 如果为 0，则每个行组的布隆过滤器会在该行组之后立即写入，
  * 如果该值大于所有布隆过滤器的总大小，则所有行组的布隆过滤器会先在内存中累积，然后在接近文件末尾处一起写入，
  * 否则，布隆过滤器会先在内存中累积，并在其总大小超过该值时写出。

<div id="output_format_parquet_compression_method">
  ## output\_format\_parquet\_compression\_method
</div>

<SettingsInfoBlock type="ParquetCompression" default_value="zstd" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "zstd"},{"label": "Parquet\/ORC\/Arrow 支持多种压缩方法，包括 lz4 和 zstd。ClickHouse 支持所有这些压缩方法。某些功能较弱的工具（例如 'duckdb'）不支持速度更快的 `lz4` 压缩方法，因此我们默认将其设置为 zstd。"}]}, {"id": "row-2","items": [{"label": "23.3"},{"label": "lz4"},{"label": "默认在 Parquet 输出格式中使用 lz4 压缩"}]}]} />

Parquet 输出格式的压缩方法。支持的编解码器：snappy、lz4、brotli、zstd、gzip、none (未压缩)

<div id="output_format_parquet_data_page_size">
  ## output\_format\_parquet\_data\_page\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="1048576" />

压缩前的目标页大小 (以字节为单位) 。

<div id="output_format_parquet_date_as_uint16">
  ## output\_format\_parquet\_date\_as\_uint16
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "为 24.12 中引入的一项轻微兼容性破坏性变更新增了兼容性设置。"}]}, {"id": "row-2","items": [{"label": "24.12"},{"label": "0"},{"label": "将 Date 写为 Date32，而不是普通的 UInt16（这是两种与 Date 最接近的 Parquet 类型）。"}]}]} />

将 Date 值写为普通的 16 位数字 (读取回来时为 UInt16) ，而不是转换为 32 位的 Parquet DATE 类型 (读取回来时为 Date32) 。

<div id="output_format_parquet_datetime_as_uint32">
  ## output\_format\_parquet\_datetime\_as\_uint32
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "0"},{"label": "将 DateTime 写为 DateTime64(3) 而非 UInt32（这是两种最接近 DateTime 的 Parquet 类型）。"}]}]} />

将 DateTime 值写为原始 Unix timestamp (读取时为 UInt32) ，而不是转换为毫秒 (读取时为 DateTime64(3)) 。

<div id="output_format_parquet_enum_as_byte_array">
  ## output\_format\_parquet\_enum\_as\_byte\_array
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "默认启用将枚举以字节数组形式写入 Parquet"}]}, {"id": "row-2","items": [{"label": "25.7"},{"label": "0"},{"label": "使用 Parquet 物理类型 BYTE_ARRAY 和逻辑类型 ENUM 写入枚举值"}]}]} />

使用 Parquet 物理类型 BYTE\_ARRAY 和逻辑类型 ENUM 写入枚举值

<div id="output_format_parquet_fixed_string_as_fixed_byte_array">
  ## output\_format\_parquet\_fixed\_string\_as\_fixed\_byte\_array
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.2"},{"label": "1"},{"label": "默认情况下，对 FixedString 使用 Parquet FIXED_LENGTH_BYTE_ARRAY 类型"}]}]} />

对于 FixedString 列，使用 Parquet FIXED\_LEN\_BYTE\_ARRAY 类型而不是 Binary 类型。

<div id="output_format_parquet_geometadata">
  ## output\_format\_parquet\_geometadata
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "1"},{"label": "一项新设置，用于在 Parquet 元数据中写入 Geo 列信息，并将列编码为 WKB 格式。"}]}]} />

用于在 Parquet 元数据中写入 Geo 列信息，并将列编码为 WKB 格式。

<div id="output_format_parquet_max_dictionary_size">
  ## output\_format\_parquet\_max\_dictionary\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="1048576" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1048576"},{"label": "新设置"}]}]} />

如果字典大小超过该字节数，则切换为不使用字典的编码。设为 0 可禁用字典编码。

<div id="output_format_parquet_parallel_encoding">
  ## output\_format\_parquet\_parallel\_encoding
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

使用多个线程进行 Parquet 编码。

<div id="output_format_parquet_row_group_size">
  ## output\_format\_parquet\_row\_group\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="1000000" />

目标行组大小 (单位：行) 。

<div id="output_format_parquet_row_group_size_bytes">
  ## output\_format\_parquet\_row\_group\_size\_bytes
</div>

<SettingsInfoBlock type="UInt64" default_value="536870912" />

压缩前的目标行组大小，单位为字节。

<div id="output_format_parquet_string_as_string">
  ## output\_format\_parquet\_string\_as\_string
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "ClickHouse 允许 String 类型包含任意二进制数据，而该类型通常存储的是 UTF-8。Parquet\/ORC\/Arrow 的 String 仅支持 UTF-8。因此，你可以为 ClickHouse 的 String 类型选择使用哪种 Arrow 数据类型：String 或 Binary。虽然 Binary 在语义上更准确、兼容性也更好，但在大多数情况下，默认使用 String 更符合用户预期。"}]}]} />

对 String 列使用 Parquet String 类型，而非 Binary。

<div id="output_format_parquet_write_bloom_filter">
  ## output\_format\_parquet\_write\_bloom\_filter
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "新增对写入 Parquet 布隆过滤器的支持。"}]}]} />

将布隆过滤器写入 Parquet 文件。

<div id="output_format_parquet_write_checksums">
  ## output\_format\_parquet\_write\_checksums
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "新设置。"}]}]} />

在 Parquet 页头中写入 crc32 校验和。

<div id="output_format_parquet_write_page_index">
  ## output\_format\_parquet\_write\_page\_index
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "1"},{"label": "新增了将页面索引写入 Parquet 文件的功能。"}]}]} />

将列索引和偏移索引 (即每个数据页的统计信息，读取时可用于过滤器下推) 写入 Parquet 文件。

<div id="output_format_pretty_color">
  ## output\_format\_pretty\_color
</div>

<SettingsInfoBlock type="UInt64Auto" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "auto"},{"label": "此设置已调整，现也支持 auto 值；如果输出不是 tty，则禁用 ANSI 转义序列"}]}]} />

在 Pretty 格式 中使用 ANSI 转义序列。0 - 禁用，1 - 启用，'auto' - 在输出为终端时启用。

<div id="output_format_pretty_display_footer_column_names">
  ## output\_format\_pretty\_display\_footer\_column\_names
</div>

<SettingsInfoBlock type="UInt64" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "1"},{"label": "新增了一个设置：当表中的行数较多时，在页脚中显示列名。阈值由 output_format_pretty_display_footer_column_names_min_rows 控制。"}]}]} />

当表中的行数较多时，在页脚中显示列名。

可能的值：

* 0 — 不在页脚显示列名。
* 1 — 当行数大于或等于 [output\_format\_pretty\_display\_footer\_column\_names\_min\_rows](/docs/zh/reference/settings/formats/output-format#output_format_pretty_display_footer_column_names_min_rows) 设置的阈值时，在页脚显示列名 (默认为 50) 。

**示例**

查询：

```sql theme={null}
SELECT *, toTypeName(*) FROM (SELECT * FROM system.numbers LIMIT 1000);
```

结果：

```response theme={null}
      ┌─number─┬─toTypeName(number)─┐
   1. │      0 │ UInt64             │
   2. │      1 │ UInt64             │
   3. │      2 │ UInt64             │
   ...
 999. │    998 │ UInt64             │
1000. │    999 │ UInt64             │
      └─number─┴─toTypeName(number)─┘
```

<div id="output_format_pretty_display_footer_column_names_min_rows">
  ## output\_format\_pretty\_display\_footer\_column\_names\_min\_rows
</div>

<SettingsInfoBlock type="UInt64" default_value="50" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "50"},{"label": "新增一个设置，用于控制 output_format_pretty_display_footer_column_names_min_rows 的阈值。默认值为 50。"}]}]} />

在启用 [output\_format\_pretty\_display\_footer\_column\_names](/docs/zh/reference/settings/formats/output-format#output_format_pretty_display_footer_column_names) 时，此设置用于指定显示包含列名的页脚所需的最小行数。

<div id="output_format_pretty_fallback_to_vertical">
  ## output\_format\_pretty\_fallback\_to\_vertical
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "新设置"}]}]} />

如果启用，且表很宽但行数较少，Pretty 格式会按 Vertical 格式的方式输出。
有关此行为的详细调优，请参阅 `output_format_pretty_fallback_to_vertical_max_rows_per_chunk` 和 `output_format_pretty_fallback_to_vertical_min_table_width`。

<div id="output_format_pretty_fallback_to_vertical_max_rows_per_chunk">
  ## output\_format\_pretty\_fallback\_to\_vertical\_max\_rows\_per\_chunk
</div>

<SettingsInfoBlock type="UInt64" default_value="10" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "100"},{"label": "新设置"}]}]} />

仅当一个块中的记录数不超过指定值时，才会启用回退到 Vertical 格式的行为 (参见 `output_format_pretty_fallback_to_vertical`) 。

<div id="output_format_pretty_fallback_to_vertical_min_columns">
  ## output\_format\_pretty\_fallback\_to\_vertical\_min\_columns
</div>

<SettingsInfoBlock type="UInt64" default_value="5" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "5"},{"label": "新增设置"}]}]} />

仅当列数大于指定值时，才会启用回退到 Vertical 格式 (参见 `output_format_pretty_fallback_to_vertical`) 的行为。

<div id="output_format_pretty_fallback_to_vertical_min_table_width">
  ## output\_format\_pretty\_fallback\_to\_vertical\_min\_table\_width
</div>

<SettingsInfoBlock type="UInt64" default_value="250" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "250"},{"label": "新增设置"}]}]} />

仅当表中各列长度之和至少达到指定值，或至少有一个值包含换行符时，才会回退到 Vertical 格式 (参见 `output_format_pretty_fallback_to_vertical`) 。

<div id="output_format_pretty_glue_chunks">
  ## output\_format\_pretty\_glue\_chunks
</div>

<SettingsInfoBlock type="UInt64Auto" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "auto"},{"label": "一项让 Pretty 格式 更美观的新设置。"}]}]} />

如果在 Pretty 格式 中渲染的数据分多个块到达，即使这些块之间存在延迟，但后一个块的列宽与前一个相同，则使用 ANSI 转义序列 返回上一行并覆盖前一个块的页脚，以便接着显示新块中的数据。这样可以让结果看起来更美观。

0 - 禁用，1 - 启用，'auto' - 在终端中启用。

<div id="output_format_pretty_grid_charset">
  ## output\_format\_pretty\_grid\_charset
</div>

<SettingsInfoBlock type="String" default_value="UTF-8" />

用于打印网格边框的字符集。可用字符集：ASCII、UTF-8 (默认) 。

在交互模式下，`clickhouse-client` 会在终端不支持 UTF-8 时自动切换为 `ASCII` (依据 `LC_ALL`、`LC_CTYPE` 和 `LANG` 环境变量判断) ，除非已显式指定此设置。

<div id="output_format_pretty_highlight_digit_groups">
  ## output\_format\_pretty\_highlight\_digit\_groups
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "如果启用且输出到终端，则会以下划线高亮表示千位、百万位等对应的每一位数字。"}]}]} />

如果启用且输出到终端，则会以下划线高亮表示千位、百万位等对应的每一位数字。

<div id="output_format_pretty_highlight_trailing_spaces">
  ## output\_format\_pretty\_highlight\_trailing\_spaces
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "新增设置。"}]}]} />

如果启用且输出到终端，则会以灰色并加下划线的方式高亮尾随空格。

<div id="output_format_pretty_max_column_name_width_cut_to">
  ## output\_format\_pretty\_max\_column\_name\_width\_cut\_to
</div>

<SettingsInfoBlock type="UInt64" default_value="24" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "24"},{"label": "新增设置"}]}]} />

如果列名过长，则将其截断到此长度。
如果列名长度超过 `output_format_pretty_max_column_name_width_cut_to` 与 `output_format_pretty_max_column_name_width_min_chars_to_cut` 之和，就会被截断。

<div id="output_format_pretty_max_column_name_width_min_chars_to_cut">
  ## output\_format\_pretty\_max\_column\_name\_width\_min\_chars\_to\_cut
</div>

<SettingsInfoBlock type="UInt64" default_value="4" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "4"},{"label": "新增设置"}]}]} />

当列名过长时，最少需要截断的字符数。
如果列名长度超过 `output_format_pretty_max_column_name_width_cut_to` 与 `output_format_pretty_max_column_name_width_min_chars_to_cut` 之和，则会被截断。

<div id="output_format_pretty_max_column_pad_width">
  ## output\_format\_pretty\_max\_column\_pad\_width
</div>

<SettingsInfoBlock type="UInt64" default_value="250" />

Pretty 格式中，对列内所有值进行填充时的最大宽度。

<div id="output_format_pretty_max_rows">
  ## output\_format\_pretty\_max\_rows
</div>

<SettingsInfoBlock type="UInt64" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1000"},{"label": "这样可用性更好——需要滚动的内容更少。"}]}]} />

Pretty 格式的行数上限。

<div id="output_format_pretty_max_value_width">
  ## output\_format\_pretty\_max\_value\_width
</div>

<SettingsInfoBlock type="UInt64" default_value="10000" />

Pretty 格式 中显示值的最大宽度。若超过该宽度，则会被截断。
值为 0 表示永不截断。

<div id="output_format_pretty_max_value_width_apply_for_single_value">
  ## output\_format\_pretty\_max\_value\_width\_apply\_for\_single\_value
</div>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "Pretty 格式中的单个值不会被截断。"}]}]} />

仅当某个值不是块内的单个值时，才会截断该值 (参见 `output_format_pretty_max_value_width` 设置) 。否则会完整输出，这对 `SHOW CREATE TABLE` 查询很有帮助。

<div id="output_format_pretty_multiline_fields">
  ## output\_format\_pretty\_multiline\_fields
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "新增设置"}]}]} />

如果启用，Pretty 格式会在表单元中以多行形式渲染多行字段，从而保持表格边框完整。
如果未启用，则会按原样渲染，这可能会导致表格变形 (不过保持关闭的一个好处是，复制粘贴多行值会更方便) 。

<div id="output_format_pretty_named_tuples_as_json">
  ## output\_format\_pretty\_named\_tuples\_as\_json
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1"},{"label": "新增设置，用于控制 Pretty 格式中的命名元组是否以 JSON 对象形式输出"}]}]} />

控制 Pretty 格式中的命名元组是否以格式化的 JSON 对象输出。

<div id="output_format_pretty_row_numbers">
  ## output\_format\_pretty\_row\_numbers
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "可用性更好。"}]}]} />

为 Pretty 输出格式的每一行添加行号

<div id="output_format_pretty_single_large_number_tip_threshold">
  ## output\_format\_pretty\_single\_large\_number\_tip\_threshold
</div>

<SettingsInfoBlock type="UInt64" default_value="1000000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1000000"},{"label": "如果块仅包含一个数字，且该数字超过此值（0 除外），则会在表右侧显示一个易读的数字提示"}]}]} />

如果块仅包含一个数字，且该数字超过此值 (0 除外) ，则会在表右侧显示一个易读的数字提示

<div id="output_format_pretty_squash_consecutive_ms">
  ## output\_format\_pretty\_squash\_consecutive\_ms
</div>

<SettingsInfoBlock type="UInt64" default_value="50" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "50"},{"label": "新增设置"}]}]} />

最多等待下一个块指定的毫秒数，然后在写入前将其与前一个块合并。
这样既可避免过于频繁地输出过小的块，又仍可按流式方式显示数据。

<div id="output_format_pretty_squash_max_wait_ms">
  ## output\_format\_pretty\_squash\_max\_wait\_ms
</div>

<SettingsInfoBlock type="UInt64" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1000"},{"label": "新增设置"}]}]} />

如果自上次输出以来经过的时间超过指定的毫秒数，则在 Pretty 格式 中输出待处理的块。

<div id="output_format_pretty_use_nbsp_for_padding">
  ## output\_format\_pretty\_use\_nbsp\_for\_padding
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "新设置。启用后，`Pretty` 输出中的填充将使用 `U+00A0` 渲染，因此在经过会压缩连续普通空格的工具复制粘贴后也能保留下来。"}]}]} />

启用后，`Pretty` output formats 中的填充将使用 `U+00A0` 而不是 ASCII 空格来渲染。
在等宽字体下，输出的视觉效果保持不变，但填充内容在经过会压缩或裁剪连续普通空格的工具时仍能保留下来。
仅在 `output_format_pretty_grid_charset` 为 `UTF-8` 时生效。

<div id="output_format_protobuf_nullables_with_google_wrappers">
  ## output\_format\_protobuf\_nullables\_with\_google\_wrappers
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

使用 Google wrapper 对 Nullable 列进行序列化时，会将默认值序列化为空 wrapper。若关闭此设置，则默认值和 NULL 值都不会被序列化

<div id="output_format_schema">
  ## output\_format\_schema
</div>

自动生成的 schema 在 [Cap'n Proto](/docs/zh/reference/formats/CapnProto) 或 [Protobuf](/docs/zh/reference/formats/Protobuf/Protobuf) 格式下将保存到的文件路径。

<div id="output_format_sql_insert_include_column_names">
  ## output\_format\_sql\_insert\_include\_column\_names
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

在 INSERT 查询中包含列名

<div id="output_format_sql_insert_max_batch_size">
  ## output\_format\_sql\_insert\_max\_batch\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="65409" />

单条 INSERT 语句中的最大行数。

<div id="output_format_sql_insert_quote_names">
  ## output\_format\_sql\_insert\_quote\_names
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

使用 '\`' 字符为列名加引号

<div id="output_format_sql_insert_table_name">
  ## output\_format\_sql\_insert\_table\_name
</div>

<SettingsInfoBlock type="String" default_value="table" />

输出 INSERT 查询中的表名称

<div id="output_format_sql_insert_use_replace">
  ## output\_format\_sql\_insert\_use\_replace
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

使用 REPLACE 语句而不是 INSERT

<div id="output_format_trim_fixed_string">
  ## output\_format\_trim\_fixed\_string
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "用于在文本输出格式中去除 FixedString 值末尾零字节的新设置"}]}]} />

在文本输出格式中去除 FixedString 值末尾的零字节。例如，`toFixedString('John', 8)` 将显示为 `John`，而不是 `John\0\0\0\0`。

<div id="output_format_tsv_crlf_end_of_line">
  ## output\_format\_tsv\_crlf\_end\_of\_line
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

如果将其设为 true，TSV 格式的行尾将使用 \r\n，而不是 \n。

<div id="output_format_values_escape_quote_with_quote">
  ## output\_format\_values\_escape\_quote\_with\_quote
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "0"},{"label": "如果为 true，则将 ' 转义为 ''；否则使用 \\' 进行转义"}]}]} />

如果为 true，则将 ' 转义为 ''；否则使用 \\' 进行转义

<div id="output_format_write_statistics">
  ## output\_format\_write\_statistics
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

在适用的输出格式中写入有关已读取行数、字节数和耗时的统计信息。

默认启用
