> ## 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.

# input_format_* 格式设置

> ClickHouse 在 input_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="input_format_allow_errors_num">
  ## input\_format\_allow\_errors\_num
</div>

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

设置从文本格式 (CSV、TSV 等) 读取数据时可接受的最大错误数。

默认值为 0。

请始终与 `input_format_allow_errors_ratio` 配合使用。

如果在读取行时发生错误，但错误计数器仍小于 `input_format_allow_errors_num`，ClickHouse 会忽略该行并继续读取下一行。

如果 `input_format_allow_errors_num` 和 `input_format_allow_errors_ratio` 都超过限制，ClickHouse 会抛出异常。

<div id="input_format_allow_errors_ratio">
  ## input\_format\_allow\_errors\_ratio
</div>

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

设置读取文本格式 (CSV、TSV 等) 时允许的最大错误比例。
错误比例设置为介于 0 和 1 之间的浮点数。

默认值为 0。

请始终将其与 `input_format_allow_errors_num` 配合使用。

如果在读取行时发生错误，但错误计数器仍小于 `input_format_allow_errors_ratio`，ClickHouse 会忽略该行并继续处理下一行。

如果 `input_format_allow_errors_num` 和 `input_format_allow_errors_ratio` 都超出限制，ClickHouse 将抛出异常。

<div id="input_format_allow_seeks">
  ## input\_format\_allow\_seeks
</div>

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

在读取 ORC、Parquet 和 Arrow 输入格式时允许寻道 (或范围读取) 。
启用后，如果数据源支持此功能 (例如本地文件、S3，或支持范围请求且大小已知的 HTTP) ，
ClickHouse 便可只读取所需的字节范围，从而减少内存使用。
禁用后，或者当数据源不支持寻道时 (例如文件大小未知，或流不可寻道) ，
某些读取器可能会退回为将整个文件加载到内存中。
默认启用。

<div id="input_format_arrow_allow_missing_columns">
  ## input\_format\_arrow\_allow\_missing\_columns
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.12"},{"label": "1"},{"label": "默认允许 Arrow 文件缺失列"}]}]} />

读取 Arrow 输入格式时允许缺失列

<div id="input_format_arrow_case_insensitive_column_matching">
  ## input\_format\_arrow\_case\_insensitive\_column\_matching
</div>

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

匹配 Arrow 列与 CH 列时忽略大小写。

<div id="input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference">
  ## input\_format\_arrow\_skip\_columns\_with\_unsupported\_types\_in\_schema\_inference
</div>

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

在对 Arrow 格式进行 schema 推断 时，跳过类型不受支持的列

<div id="input_format_arrow_use_native_reader">
  ## input\_format\_arrow\_use\_native\_reader
</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="input_format_avro_allow_missing_fields">
  ## input\_format\_avro\_allow\_missing\_fields
</div>

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

对于 Avro/AvroConfluent format：当在 schema 中找不到 字段 时，使用默认值而不是报错

<div id="input_format_avro_null_as_default">
  ## input\_format\_avro\_null\_as\_default
</div>

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

对于 Avro/AvroConfluent 格式：当值为 NULL 且列为非 Nullable 时，插入默认值

<div id="input_format_binary_decode_types_in_binary_format">
  ## input\_format\_binary\_decode\_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="input_format_binary_max_type_complexity">
  ## input\_format\_binary\_max\_type\_complexity
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1000"},{"label": "新增一个设置，用于控制解码二进制类型时允许的最大类型节点数。可防止恶意输入。"}]}]} />

解码二进制类型时允许的最大类型节点数 (不是深度，而是节点总数) 。`Map(String, UInt32)` = 3 个节点。可防止恶意输入。0 = 不限制。

<div id="input_format_binary_read_json_as_string">
  ## input\_format\_binary\_read\_json\_as\_string
</div>

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

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

在 RowBinary 输入格式中，将 [JSON](/docs/zh/reference/data-types/newjson) 数据类型的值读取为 JSON [String](/docs/zh/reference/data-types/string) 值。

<div id="input_format_bson_skip_fields_with_unsupported_types_in_schema_inference">
  ## input\_format\_bson\_skip\_fields\_with\_unsupported\_types\_in\_schema\_inference
</div>

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

在对 BSON format 进行 schema 推断 时，跳过具有不受支持类型的字段。

<div id="input_format_capn_proto_skip_fields_with_unsupported_types_in_schema_inference">
  ## input\_format\_capn\_proto\_skip\_fields\_with\_unsupported\_types\_in\_schema\_inference
</div>

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

在对 CapnProto 格式进行 schema 推断时，跳过类型不受支持的列

<div id="input_format_column_name_matching_mode">
  ## input\_format\_column\_name\_matching\_mode
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "auto"},{"label": "先按区分大小写的方式匹配输入列名，若失败则回退为不区分大小写的匹配，而不是要求大小写必须完全一致。"}]}, {"id": "row-2","items": [{"label": "26.4"},{"label": "match_case"},{"label": "新设置。"}]}]} />

定义通过各种格式 (包括但不限于 JSONEachRow、CSVWithNames、JSONColumns、BSONEachRow、RowBinaryWithNames) 摄取数据时的列名匹配模式。
支持的模式：

* match\_case：区分大小写匹配
  * ignore\_case：不区分大小写匹配
  * auto：先尝试区分大小写匹配；如果失败，再尝试不区分大小写匹配。

<div id="input_format_connection_handling">
  ## input\_format\_connection\_handling
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "新增设置：允许在连接意外关闭时，对缓冲区中的剩余数据继续进行解析和处理"}]}]} />

启用此选项后，如果连接意外关闭，缓冲区中的剩余数据将被解析和处理，而不会被视为错误

<Note>
  启用此选项会禁用并行解析，并且无法进行去重
</Note>

<div id="input_format_csv_allow_cr_end_of_line">
  ## input\_format\_csv\_allow\_cr\_end\_of\_line
</div>

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

如果设置为 true，则允许在行尾出现后面不跟随任何内容的 \r

<div id="input_format_csv_allow_variable_number_of_columns">
  ## input\_format\_csv\_allow\_variable\_number\_of\_columns
</div>

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

忽略 CSV 输入中的多余列 (如果文件中的列数超过预期) ，并将 CSV 输入中缺失的字段视为默认值

<div id="input_format_csv_allow_whitespace_or_tab_as_delimiter">
  ## input\_format\_csv\_allow\_whitespace\_or\_tab\_as\_delimiter
</div>

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

允许在 CSV 字符串中将空格和制表符(\t)用作字段分隔符

<div id="input_format_csv_arrays_as_nested_csv">
  ## input\_format\_csv\_arrays\_as\_nested\_csv
</div>

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

从 CSV 中读取 Array 时，会假定其元素先按嵌套 CSV 格式序列化，再放入字符串中。示例："\[""Hello"", ""world"", ""42"""" TV""]"。数组外层的方括号可以省略。

<div id="input_format_csv_deserialize_separate_columns_into_tuple">
  ## input\_format\_csv\_deserialize\_separate\_columns\_into\_tuple
</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 列。

<div id="input_format_csv_detect_header">
  ## input\_format\_csv\_detect\_header
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.1"},{"label": "1"},{"label": "默认检测 CSV 格式中的名称和类型请求头"}]}]} />

自动检测 CSV 格式中的名称和类型请求头

<div id="input_format_csv_empty_as_default">
  ## input\_format\_csv\_empty\_as\_default
</div>

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

将 CSV 输入中的空字段按默认值处理。

<div id="input_format_csv_enum_as_number">
  ## input\_format\_csv\_enum\_as\_number
</div>

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

将 CSV 格式中插入的枚举值视为枚举索引

<div id="input_format_csv_missing_nullable_as_empty_string">
  ## input\_format\_csv\_missing\_nullable\_as\_empty\_string
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "0"},{"label": "新增设置：将 CSV 中 `Nullable(String)` 的缺失值读取为空字符串，而不是 NULL。"}]}]} />

控制如何将 CSV 中的缺失值读取为 `Nullable(String)`。缺失值是指逗号之间、之前或之后未被引号包围的空白内容。如果启用此设置，则无论 `input_format_csv_empty_as_default` 的值为何，`Nullable(String)` 的缺失值都会被解释为空 `String`，而不是 NULL。

<div id="input_format_csv_skip_first_lines">
  ## input\_format\_csv\_skip\_first\_lines
</div>

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

跳过 CSV 格式数据开头的指定行数

<div id="input_format_csv_skip_trailing_empty_lines">
  ## input\_format\_csv\_skip\_trailing\_empty\_lines
</div>

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

跳过 CSV 格式末尾的空行

<div id="input_format_csv_trim_whitespaces">
  ## input\_format\_csv\_trim\_whitespaces
</div>

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

去除 CSV 字符串开头和结尾处的空格与制表符 (\t) 字符

<div id="input_format_csv_try_infer_numbers_from_strings">
  ## input\_format\_csv\_try\_infer\_numbers\_from\_strings
</div>

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

如果启用，ClickHouse 会在 schema 推断期间尝试从字符串字段中推断出数值类型。
如果 CSV 数据中包含带引号的 UInt64 数值，此设置会很有用。

默认禁用。

<div id="input_format_csv_try_infer_strings_from_quoted_tuples">
  ## input\_format\_csv\_try\_infer\_strings\_from\_quoted\_tuples
</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 的方式。"}]}]} />

将输入数据中带引号的 Tuple 解释为 String 类型的值。

<div id="input_format_csv_use_best_effort_in_schema_inference">
  ## input\_format\_csv\_use\_best\_effort\_in\_schema\_inference
</div>

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

使用一些调整和启发式方法来推断 CSV format 中的 schema

<div id="input_format_csv_use_default_on_bad_values">
  ## input\_format\_csv\_use\_default\_on\_bad\_values
</div>

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

当 CSV 字段因值错误而反序列化失败时，允许为该列使用默认值

<div id="input_format_custom_allow_variable_number_of_columns">
  ## input\_format\_custom\_allow\_variable\_number\_of\_columns
</div>

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

忽略 CustomSeparated 输入中的额外列 (如果文件中的列数多于预期) ，并将 CustomSeparated 输入中缺失的字段视为默认值

<div id="input_format_custom_detect_header">
  ## input\_format\_custom\_detect\_header
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.1"},{"label": "1"},{"label": "默认检测 CustomSeparated format 中包含名称和类型的请求头"}]}]} />

自动检测 CustomSeparated format 中包含名称和类型的请求头

<div id="input_format_custom_skip_trailing_empty_lines">
  ## input\_format\_custom\_skip\_trailing\_empty\_lines
</div>

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

跳过 CustomSeparated format 末尾的空行

<div id="input_format_defaults_for_omitted_fields">
  ## input\_format\_defaults\_for\_omitted\_fields
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "19.12"},{"label": "1"},{"label": "对某些输入格式，为省略字段启用复杂默认表达式的计算，因为这才是符合预期的行为"}]}]} />

执行 `INSERT` 查询时，将省略的输入列值替换为对应列的默认值。此选项适用于 [JSONEachRow](/docs/zh/reference/formats/JSON/JSONEachRow) (以及其他 JSON 格式) 、[CSV](/docs/zh/reference/formats/CSV/CSV)、[TabSeparated](/docs/zh/reference/formats/TabSeparated/TabSeparated)、[TSKV](/docs/zh/reference/formats/TabSeparated/TSKV)、[Parquet](/docs/zh/reference/formats/Parquet/Parquet)、[Arrow](/docs/zh/reference/formats/Arrow/Arrow)、[Avro](/docs/zh/reference/formats/Avro/Avro)、[ORC](/docs/zh/reference/formats/ORC)、[Native](/docs/zh/reference/formats/Native) 格式，以及带有 `WithNames`/`WithNamesAndTypes` 后缀的格式。

<Note>
  启用此选项后，服务器会将扩展的表元数据发送给客户端。这会额外占用服务器的计算资源，并可能降低性能。
</Note>

可能的值：

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

<div id="input_format_force_null_for_omitted_fields">
  ## input\_format\_force\_null\_for\_omitted\_fields
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.5"},{"label": "0"},{"label": "在需要时禁用被省略字段的类型默认值"}]}]} />

强制将被省略的字段初始化为 NULL 值

<div id="input_format_geojson_unsupported_geometry_handling">
  ## input\_format\_geojson\_unsupported\_geometry\_handling
</div>

<SettingsInfoBlock type="GeoJSONUnsupportedGeometryHandling" default_value="throw" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "throw"},{"label": "新增设置，用于控制对无法用 `Geometry` 类型表示的 GeoJSON geometry types（`GeometryCollection`、`MultiPoint`）的处理方式"}]}]} />

控制在读取 `GeoJSON` 输入时，如果需要将一种无法在 ClickHouse 的 `Geometry` 类型中表示的有效 `GeoJSON` 几何类型 (如 `GeometryCollection` 或 `MultiPoint`) 存储到 `geometry` 列中时，系统的处理方式。

可能的值：

* `'throw'` (默认) — 抛出异常。
* `'null'` — 为 `geometry` 列插入 `NULL` 值并继续解析。

这仅在 `geometry` 列被 materialized 时适用。当它不是请求的输出列时，此类几何对象只会验证其格式是否正确，但不会触发该处理。

<div id="input_format_hive_text_allow_variable_number_of_columns">
  ## input\_format\_hive\_text\_allow\_variable\_number\_of\_columns
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "1"},{"label": "忽略 Hive Text 输入中的多余列（如果文件中的列数超出预期），并将 Hive Text 输入中缺失的字段视为默认值。"}]}]} />

忽略 Hive Text 输入中的多余列 (如果文件中的列数超出预期) ，并将 Hive Text 输入中缺失的字段视为默认值

<div id="input_format_hive_text_collection_items_delimiter">
  ## input\_format\_hive\_text\_collection\_items\_delimiter
</div>

<SettingsInfoBlock type="Char" default_value="" />

Hive Text File 中集合 (array 或 map) 元素之间的分隔符

<div id="input_format_hive_text_fields_delimiter">
  ## input\_format\_hive\_text\_fields\_delimiter
</div>

<SettingsInfoBlock type="Char" default_value="" />

Hive Text File 中字段间的分隔符

<div id="input_format_hive_text_map_keys_delimiter">
  ## input\_format\_hive\_text\_map\_keys\_delimiter
</div>

<SettingsInfoBlock type="Char" default_value="" />

Hive Text File 中 map 键值对之间的分隔符

<div id="input_format_import_nested_json">
  ## input\_format\_import\_nested\_json
</div>

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

启用或禁用插入带有嵌套对象的 JSON 数据。

支持的格式：

* [JSONEachRow](/docs/zh/reference/formats/JSON/JSONEachRow)

可能的值：

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

另请参阅：

* [Nested 结构的用法](/docs/zh/guides/clickhouse/data-formats/json/formats#accessing-nested-json-objects) (使用 `JSONEachRow` 格式) 。

<div id="input_format_ipv4_default_on_conversion_error">
  ## input\_format\_ipv4\_default\_on\_conversion\_error
</div>

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

在 IPv4 反序列化过程中，如果发生转换错误，将使用默认值而不是抛出异常。

默认关闭。

<div id="input_format_ipv6_default_on_conversion_error">
  ## input\_format\_ipv6\_default\_on\_conversion\_error
</div>

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

在发生转换错误时，IPv6 的反序列化将使用默认值，而不是抛出异常。

默认情况下禁用。

<div id="input_format_json_compact_allow_variable_number_of_columns">
  ## input\_format\_json\_compact\_allow\_variable\_number\_of\_columns
</div>

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

允许在 JSONCompact/JSONCompactEachRow 输入格式中，每行包含可变数量的列。
对于列数超过预期的行，会忽略多余的列；对于缺失列，则将其视为默认值。

默认情况下禁用。

<div id="input_format_json_defaults_for_missing_elements_in_named_tuple">
  ## input\_format\_json\_defaults\_for\_missing\_elements\_in\_named\_tuple
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.1"},{"label": "1"},{"label": "默认允许在读取命名元组时，JSON 对象中缺失元素"}]}]} />

在解析命名元组时，会为 JSON 对象中缺失的元素插入默认值。
此设置仅在启用 `input_format_json_named_tuples_as_objects` 时生效。

默认启用。

<div id="input_format_json_empty_as_default">
  ## input\_format\_json\_empty\_as\_default
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "新增设置，允许将 JSON 输入中的空字段按默认值处理。"}]}]} />

启用后，会将 JSON 输入中的空字段替换为默认值。对于复杂的默认表达式，还必须同时启用 `input_format_defaults_for_omitted_fields`。

可能的值：

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

<div id="input_format_json_ignore_unknown_keys_in_named_tuple">
  ## input\_format\_json\_ignore\_unknown\_keys\_in\_named\_tuple
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.3"},{"label": "1"},{"label": "改进将 JSON 对象解析为命名元组"}]}]} />

忽略用于命名元组的 JSON 对象中的未知键。

默认启用。

<div id="input_format_json_ignore_unnecessary_fields">
  ## input\_format\_json\_ignore\_unnecessary\_fields
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "1"},{"label": "忽略不必要的字段，并且不解析它们。启用后，对于格式无效或包含重复字段的 JSON 字符串，可能不会抛出异常"}]}]} />

忽略不必要的字段，并且不解析它们。启用后，对于格式无效或包含重复字段的 JSON 字符串，可能不会抛出异常

<div id="input_format_json_infer_array_of_dynamic_from_array_of_different_types">
  ## input\_format\_json\_infer\_array\_of\_dynamic\_from\_array\_of\_different\_types
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "默认将值类型不同的 JSON 数组推断为 Array(Dynamic)"}]}]} />

如果启用，则在 schema 推断期间，ClickHouse 会对包含不同数据类型值的 JSON 数组使用 Array(Dynamic) 类型。

示例：

```sql theme={null}
SET input_format_json_infer_array_of_dynamic_from_array_of_different_types=1;
DESC format(JSONEachRow, '{"a" : [42, "hello", [1, 2, 3]]}');
```

```response theme={null}
┌─name─┬─type───────────┐
│ a    │ Array(Dynamic) │
└──────┴────────────────┘
```

```sql theme={null}
SET input_format_json_infer_array_of_dynamic_from_array_of_different_types=0;
DESC format(JSONEachRow, '{"a" : [42, "hello", [1, 2, 3]]}');
```

```response theme={null}
┌─name─┬─type─────────────────────────────────────────────────────────────┐
│ a    │ Tuple(Nullable(Int64), Nullable(String), Array(Nullable(Int64))) │
└──────┴──────────────────────────────────────────────────────────────────┘
```

默认启用。

<div id="input_format_json_infer_incomplete_types_as_strings">
  ## input\_format\_json\_infer\_incomplete\_types\_as\_strings
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.9"},{"label": "1"},{"label": "默认允许在 JSON 格式的 schema 推断 期间将不完整类型推断为 String"}]}]} />

在 schema 推断 期间，对于数据样本中仅包含 `Null`/`{}`/`[]` 的 JSON 键，允许使用 String 类型。
在 JSON 格式中，任何值都可以读取为 String；通过将类型未知的键视为 String 类型，我们可以避免在 schema 推断 期间出现类似 `Cannot determine type for column 'column_name' by first 25000 rows of data, most likely this column contains only Nulls or empty Arrays/Maps` 的错误。

示例：

```sql theme={null}
SET input_format_json_infer_incomplete_types_as_strings = 1, input_format_json_try_infer_named_tuples_from_objects = 1;
DESCRIBE format(JSONEachRow, '{"obj" : {"a" : [1,2,3], "b" : "hello", "c" : null, "d" : {}, "e" : []}}');
SELECT * FROM format(JSONEachRow, '{"obj" : {"a" : [1,2,3], "b" : "hello", "c" : null, "d" : {}, "e" : []}}');
```

结果：

```
┌─name─┬─type───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ obj  │ Tuple(a Array(Nullable(Int64)), b Nullable(String), c Nullable(String), d Nullable(String), e Array(Nullable(String))) │              │                    │         │                  │                │
└──────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘

┌─obj────────────────────────────┐
│ ([1,2,3],'hello',NULL,'{}',[]) │
└────────────────────────────────┘
```

默认启用。

<div id="input_format_json_map_as_array_of_tuples">
  ## input\_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 列反序列化为元组的 JSON 数组。

默认禁用。

<div id="input_format_json_max_depth">
  ## input\_format\_json\_max\_depth
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "1000"},{"label": "在之前的版本中，该值不受限制，但这并不安全。"}]}]} />

JSON 中字段的最大深度。这不是严格限制，无需精确执行。

<div id="input_format_json_named_tuples_as_objects">
  ## input\_format\_json\_named\_tuples\_as\_objects
</div>

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

将命名元组列解析为 JSON 对象。

默认启用。

<div id="input_format_json_read_arrays_as_strings">
  ## input\_format\_json\_read\_arrays\_as\_strings
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.9"},{"label": "1"},{"label": "默认允许在 JSON 输入格式中将数组读取为字符串"}]}]} />

允许在 JSON 输入格式中将 JSON 数组解析为字符串。

示例：

```sql theme={null}
SET input_format_json_read_arrays_as_strings = 1;
SELECT arr, toTypeName(arr), JSONExtractArrayRaw(arr)[3] from format(JSONEachRow, 'arr String', '{"arr" : [1, "Hello", [1,2,3]]}');
```

结果：

```
┌─arr───────────────────┬─toTypeName(arr)─┬─arrayElement(JSONExtractArrayRaw(arr), 3)─┐
│ [1, "Hello", [1,2,3]] │ String          │ [1,2,3]                                   │
└───────────────────────┴─────────────────┴───────────────────────────────────────────┘
```

默认启用。

<div id="input_format_json_read_bools_as_numbers">
  ## input\_format\_json\_read\_bools\_as\_numbers
</div>

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

允许在 JSON 输入格式中将布尔值按数值解析。

默认启用。

<div id="input_format_json_read_bools_as_strings">
  ## input\_format\_json\_read\_bools\_as\_strings
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "1"},{"label": "默认允许在 JSON 格式中将布尔值作为字符串读取"}]}]} />

允许在 JSON 输入格式中将布尔值作为字符串解析。

默认启用。

<div id="input_format_json_read_numbers_as_strings">
  ## input\_format\_json\_read\_numbers\_as\_strings
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.9"},{"label": "1"},{"label": "默认允许在 JSON 格式中将数字按字符串读取"}]}]} />

允许在 JSON 输入格式中将数字按字符串解析。

默认启用。

<div id="input_format_json_read_objects_as_strings">
  ## input\_format\_json\_read\_objects\_as\_strings
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.1"},{"label": "1"},{"label": "在 object 类型仍处于 Experimental 阶段时，启用将嵌套 JSON 对象作为 String 读取"}]}]} />

允许在 JSON 输入格式中将 JSON 对象按 String 解析。

示例：

```sql theme={null}
SET input_format_json_read_objects_as_strings = 1;
CREATE TABLE test (id UInt64, obj String, date Date) ENGINE=Memory();
INSERT INTO test FORMAT JSONEachRow {"id" : 1, "obj" : {"a" : 1, "b" : "Hello"}, "date" : "2020-01-01"};
SELECT * FROM test;
```

结果：

```
┌─id─┬─obj──────────────────────┬───────date─┐
│  1 │ {"a" : 1, "b" : "Hello"} │ 2020-01-01 │
└────┴──────────────────────────┴────────────┘
```

默认启用。

<div id="input_format_json_throw_on_bad_escape_sequence">
  ## input\_format\_json\_throw\_on\_bad\_escape\_sequence
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "1"},{"label": "允许保存包含错误转义序列的 JSON 字符串"}]}]} />

如果 JSON 输入格式中的 JSON 字符串包含错误的转义序列，则抛出异常。如果禁用，错误的转义序列将按原样保留在数据中。

默认启用。

<div id="input_format_json_try_infer_named_tuples_from_objects">
  ## input\_format\_json\_try\_infer\_named\_tuples\_from\_objects
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.9"},{"label": "1"},{"label": "默认尝试从 JSON 对象推断命名元组"}]}]} />

如果启用，在进行 schema 推断时，ClickHouse 将尝试从 JSON 对象中推断命名元组。
生成的命名元组将包含样本数据中所有对应 JSON 对象里的全部元素。

示例：

```sql theme={null}
SET input_format_json_try_infer_named_tuples_from_objects = 1;
DESC format(JSONEachRow, '{"obj" : {"a" : 42, "b" : "Hello"}}, {"obj" : {"a" : 43, "c" : [1, 2, 3]}}, {"obj" : {"d" : {"e" : 42}}}')
```

结果：

```
┌─name─┬─type───────────────────────────────────────────────────────────────────────────────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ obj  │ Tuple(a Nullable(Int64), b Nullable(String), c Array(Nullable(Int64)), d Tuple(e Nullable(Int64))) │              │                    │         │                  │                │
└──────┴────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```

默认启用。

<div id="input_format_json_try_infer_numbers_from_strings">
  ## input\_format\_json\_try\_infer\_numbers\_from\_strings
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.9"},{"label": "0"},{"label": "默认情况下，不会在 JSON 格式中从字符串推断数值，以避免可能出现的解析错误"}]}]} />

如果启用，在进行 schema 推断时，ClickHouse 将尝试从字符串字段中推断数值。
如果 JSON 数据中包含带引号的 UInt64 数值，此设置会很有用。

默认禁用。

<div id="input_format_json_use_string_type_for_ambiguous_paths_in_named_tuples_inference_from_objects">
  ## input\_format\_json\_use\_string\_type\_for\_ambiguous\_paths\_in\_named\_tuples\_inference\_from\_objects
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "在从 JSON 对象推断命名元组时，允许对有歧义的路径使用 String 类型"}]}]} />

在从 JSON 对象推断命名元组时，如果路径存在歧义，则使用 String 类型而不是抛出异常

<div id="input_format_json_validate_types_from_metadata">
  ## input\_format\_json\_validate\_types\_from\_metadata
</div>

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

对于 JSON/JSONCompact/JSONColumnsWithMetadata 输入格式，如果此设置为 1，
则会将输入数据元数据中的类型与表中对应列的类型进行比较。

默认启用。

<div id="input_format_max_block_size_bytes">
  ## input\_format\_max\_block\_size\_bytes
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "0"},{"label": "新增设置：限制输入格式创建的块大小（按字节计）"}]}]} />

限制输入格式在数据解析期间形成的块大小 (按字节计) 。用于基于行的输入格式，且块在 ClickHouse 侧生成时生效。
0 表示不限制字节大小。

<div id="input_format_max_block_wait_ms">
  ## input\_format\_max\_block\_wait\_ms
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "新增设置：限制输入格式在发出块前的最长等待时间（毫秒）"}]}]} />

限制基于行的输入格式在解析期间发出块之前的最长等待时间 (以毫秒为单位) 。0 表示不限制。

<Note>
  此选项仅在启用 `input_format_connection_handling` 时生效。设置该值还会禁用并行解析，并使去重无法实现。
</Note>

<Note>
  对于流式插入，你还必须设置 `min_insert_block_size_rows=0` 和 `min_insert_block_size_bytes=0`。否则，已解析的块仍可能在块合并阶段持续累积在内存中，直到达到这些阈值，从而无法及时插入。
</Note>

**示例：将 Wikipedia 的最近更改流式写入 ClickHouse**

```bash theme={null}
clickhouse-client --query 'CREATE TABLE wikipedia_edits (data JSON)'

curl -sS --globoff -H 'Accept: application/json' --no-buffer \
  'https://stream.wikimedia.org/v2/stream/recentchange' \
  | clickhouse-client \
      --query 'INSERT INTO wikipedia_edits FORMAT JSONAsObject' \
      --input_format_max_block_wait_ms 1000 \
      --input_format_connection_handling 1 \
      --min_insert_block_size_rows 0 \
      --min_insert_block_size_bytes 0
```

<div id="input_format_max_bytes_to_read_for_schema_inference">
  ## input\_format\_max\_bytes\_to\_read\_for\_schema\_inference
</div>

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

自动进行 schema 推断时可读取的最大数据量 (以字节为单位) 。

<div id="input_format_max_rows_to_read_for_schema_inference">
  ## input\_format\_max\_rows\_to\_read\_for\_schema\_inference
</div>

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

自动 schema 推断时可读取的最大数据行数。

<div id="input_format_msgpack_number_of_columns">
  ## input\_format\_msgpack\_number\_of\_columns
</div>

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

插入的 MsgPack 数据中的列数。用于根据数据自动进行 schema 推断。

<div id="input_format_mysql_dump_map_column_names">
  ## input\_format\_mysql\_dump\_map\_column\_names
</div>

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

按名称匹配 MySQL 转储中的表列与 ClickHouse 表中的列名

<div id="input_format_mysql_dump_table_name">
  ## input\_format\_mysql\_dump\_table\_name
</div>

用于从 MySQL dump 中读取数据的表名

<div id="input_format_native_allow_types_conversion">
  ## input\_format\_native\_allow\_types\_conversion
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.3"},{"label": "1"},{"label": "允许在 Native 输入格式中进行类型转换"}]}]} />

允许在 Native 输入格式中进行类型转换

<div id="input_format_native_decode_types_in_binary_format">
  ## input\_format\_native\_decode\_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="input_format_null_as_default">
  ## input\_format\_null\_as\_default
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.1"},{"label": "1"},{"label": "默认允许在输入格式中将 NULL 作为默认值插入"}]}]} />

启用或禁用使用[默认值](/docs/zh/reference/statements/create/table#default_values)初始化 [NULL](/docs/zh/reference/syntax#literals) 字段；前提是这些字段的 Data type 不是 [Nullable](/docs/zh/reference/data-types/nullable)。
如果列类型不是 Nullable 且此设置已禁用，那么插入 `NULL` 会引发异常。如果列类型是 Nullable，则无论此设置如何，`NULL` 值都会按原样插入。

此设置适用于大多数输入格式。

对于复杂的默认表达式，还必须启用 `input_format_defaults_for_omitted_fields`。

可能的值：

* 0 — 向非 Nullable 列中插入 `NULL` 会引发异常。
* 1 — `NULL` 字段会使用列的默认值进行初始化。

<div id="input_format_orc_allow_missing_columns">
  ## input\_format\_orc\_allow\_missing\_columns
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.12"},{"label": "1"},{"label": "默认允许 ORC 文件缺失列"}]}]} />

读取 ORC 输入格式时允许缺失列

<div id="input_format_orc_case_insensitive_column_matching">
  ## input\_format\_orc\_case\_insensitive\_column\_matching
</div>

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

匹配 ORC 列与 CH columns 时忽略大小写。

<div id="input_format_orc_dictionary_as_low_cardinality">
  ## input\_format\_orc\_dictionary\_as\_low\_cardinality
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "1"},{"label": "读取 ORC 文件时，将 ORC 字典编码的列按 LowCardinality 列处理"}]}]} />

读取 ORC 文件时，将 ORC 字典编码的列按 LowCardinality 列处理。

<div id="input_format_orc_filter_push_down">
  ## input\_format\_orc\_filter\_push\_down
</div>

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

读取 ORC 文件时，可根据 ORC 元数据中的 WHERE/PREWHERE 表达式、最小/最大统计信息或布隆过滤器，跳过整个 stripe 或行组。

<div id="input_format_orc_reader_time_zone_name">
  ## input\_format\_orc\_reader\_time\_zone\_name
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "GMT"},{"label": "ORC 行读取器使用的时区名称，默认时区为 GMT。"}]}]} />

ORC 行读取器使用的时区名称，默认时区为 GMT。

<div id="input_format_orc_row_batch_size">
  ## input\_format\_orc\_row\_batch\_size
</div>

<SettingsInfoBlock type="Int64" default_value="100000" />

读取 ORC 条带时的批次大小。

<div id="input_format_orc_skip_columns_with_unsupported_types_in_schema_inference">
  ## input\_format\_orc\_skip\_columns\_with\_unsupported\_types\_in\_schema\_inference
</div>

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

在对 ORC 格式进行 schema 推断时，跳过类型不受支持的列

<div id="input_format_orc_use_fast_decoder">
  ## input\_format\_orc\_use\_fast\_decoder
</div>

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

使用更快的 ORC 解码器实现版本。

<div id="input_format_parallel_parsing">
  ## input\_format\_parallel\_parsing
</div>

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

启用或禁用在保持顺序不变的情况下对数据格式进行并行解析。仅支持 [TabSeparated (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="input_format_parquet_allow_geoparquet_parser">
  ## input\_format\_parquet\_allow\_geoparquet\_parser
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1"},{"label": "用于在 Parquet 文件中启用 geo 列的新设置"}]}]} />

使用 geo 列解析器将 Array(UInt8) 转换为 Point/Linestring/Polygon/MultiLineString/MultiPolygon 类型

<div id="input_format_parquet_allow_missing_columns">
  ## input\_format\_parquet\_allow\_missing\_columns
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.12"},{"label": "1"},{"label": "默认允许 Parquet 文件中缺失的列"}]}]} />

读取 Parquet 输入格式时允许缺失的列

<div id="input_format_parquet_bloom_filter_push_down">
  ## input\_format\_parquet\_bloom\_filter\_push\_down
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1"},{"label": "读取 Parquet 文件时，可根据 Parquet 元数据中的 WHERE\/PREWHERE 表达式和布隆过滤器跳过整个行组。"}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "0"},{"label": "读取 Parquet 文件时，可根据 Parquet 元数据中的 WHERE\/PREWHERE 表达式和布隆过滤器跳过整个行组。"}]}]} />

读取 Parquet 文件时，可根据 Parquet 元数据中的 WHERE 表达式和布隆过滤器跳过整个行组。

<div id="input_format_parquet_case_insensitive_column_matching">
  ## input\_format\_parquet\_case\_insensitive\_column\_matching
</div>

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

匹配 Parquet 列和 CH columns 时忽略大小写。

<div id="input_format_parquet_enable_json_parsing">
  ## input\_format\_parquet\_enable\_json\_parsing
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "1"},{"label": "读取 Parquet 文件时，将 JSON 列解析为 ClickHouse JSON 列。"}]}]} />

读取 Parquet 文件时，将 JSON 列解析为 ClickHouse JSON 列。

<div id="input_format_parquet_enable_row_group_prefetch">
  ## input\_format\_parquet\_enable\_row\_group\_prefetch
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "1"},{"label": "在解析 Parquet 时启用行组预取。当前仅单线程解析支持预取。"}]}]} />

在解析 Parquet 时启用行组预取。当前仅单线程解析支持预取。

<div id="input_format_parquet_filter_push_down">
  ## input\_format\_parquet\_filter\_push\_down
</div>

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

读取 Parquet 文件时，会根据 WHERE/PREWHERE 表达式以及 Parquet 元数据中的最小值/最大值统计信息，跳过整个行组。

<div id="input_format_parquet_local_file_min_bytes_for_seek">
  ## input\_format\_parquet\_local\_file\_min\_bytes\_for\_seek
</div>

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

在 Parquet 输入格式中，本地读取 (文件) 执行寻道而不是通过跳过读取时所需的最小字节数

<div id="input_format_parquet_local_time_as_utc">
  ## input\_format\_parquet\_local\_time\_as\_utc
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "对 parquet 的“无时区本地时间”类型使用更合适的 DateTime64(..., 'UTC') 类型。"}]}]} />

确定当 `isAdjustedToUTC=false` 时，schema inference 为 Parquet 时间戳推断使用的数据类型。若为 true：DateTime64(..., 'UTC')；若为 false：DateTime64(...)。这两种行为都不完全正确，因为 ClickHouse 没有表示本地挂钟时间的数据类型。虽然有些反直觉，但 `true` 可能反而是相对没那么错误的选项，因为将 `UTC` 时间戳格式化为 String 时，会得到正确的本地时间表示。

<div id="input_format_parquet_max_block_size">
  ## input\_format\_parquet\_max\_block\_size
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "65409"},{"label": "增大 Parquet 读取器的块大小。"}]}]} />

Parquet 读取器的最大块大小。

<div id="input_format_parquet_memory_high_watermark">
  ## input\_format\_parquet\_memory\_high\_watermark
</div>

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

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

Parquet 读取器 v3 的近似内存上限。用于限制可并行读取的行组或列数。在一次查询中读取多个文件时，该限制针对这些文件的总内存使用量。

<div id="input_format_parquet_memory_low_watermark">
  ## input\_format\_parquet\_memory\_low\_watermark
</div>

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

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

如果内存使用低于该阈值，则会更积极地调度预取操作。例如，当需要通过网络读取大量小型布隆过滤器时，这一设置可能会很有用。

<div id="input_format_parquet_page_filter_push_down">
  ## input\_format\_parquet\_page\_filter\_push\_down
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "新增设置（当 input_format_parquet_use_native_reader_v3 被禁用时不生效）"}]}]} />

使用列索引中的最小值/最大值跳过数据页。

<div id="input_format_parquet_prefer_block_bytes">
  ## input\_format\_parquet\_prefer\_block\_bytes
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "16744704"},{"label": "Parquet 读取器 输出的平均块字节数。"}]}]} />

Parquet 读取器 输出的平均块字节数

<div id="input_format_parquet_preserve_order">
  ## input\_format\_parquet\_preserve\_order
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.5"},{"label": "0"},{"label": "允许 Parquet 读取器 为获得更好的并行度而重排行。"}]}]} />

从 Parquet 文件 读取时避免重排行。不建议这样做，因为通常无法保证行顺序，而且查询管道的其他部分也可能打乱该顺序。请改用 `ORDER BY _row_number`。

<div id="input_format_parquet_skip_columns_with_unsupported_types_in_schema_inference">
  ## input\_format\_parquet\_skip\_columns\_with\_unsupported\_types\_in\_schema\_inference
</div>

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

在对 Parquet 进行 schema 推断 时，跳过具有 unsupported types 的列

<div id="input_format_parquet_use_offset_index">
  ## input\_format\_parquet\_use\_offset\_index
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "新增设置（当 input_format_parquet_use_native_reader_v3 被禁用时无效）"}]}]} />

在未使用页面过滤时，微调了从 Parquet 文件读取页面的方式。

<div id="input_format_parquet_verify_checksums">
  ## input\_format\_parquet\_verify\_checksums
</div>

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

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

读取 Parquet 文件时验证页校验和。

<div id="input_format_protobuf_flatten_google_wrappers">
  ## input\_format\_protobuf\_flatten\_google\_wrappers
</div>

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

为常规的非 Nested 列启用 Google wrapper，例如，String 列 `str` 可使用 `google.protobuf.StringValue 'str'`。对于 Nullable 列，空 wrapper 会被识别为默认值，缺失的则会被识别为 null 值

<div id="input_format_protobuf_oneof_presence">
  ## input\_format\_protobuf\_oneof\_presence
</div>

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

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

通过在特殊列中设置枚举值，指示找到的是 protobuf oneof 中的哪个字段

<div id="input_format_protobuf_skip_fields_with_unsupported_types_in_schema_inference">
  ## input\_format\_protobuf\_skip\_fields\_with\_unsupported\_types\_in\_schema\_inference
</div>

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

在对 Protobuf 格式进行 schema 推断 时，跳过类型不受支持的字段

<div id="input_format_record_errors_file_path">
  ## input\_format\_record\_errors\_file\_path
</div>

读取文本格式 (CSV、TSV) 时，用于记录错误的文件路径。

<div id="input_format_skip_unknown_fields">
  ## input\_format\_skip\_unknown\_fields
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.6"},{"label": "1"},{"label": "优化某些输入格式对列子集的读取"}]}]} />

启用或禁用跳过插入额外数据。

写入数据时，如果输入数据包含目标表中不存在的列，ClickHouse 会抛出异常。如果启用了跳过，ClickHouse 不会插入这些额外数据，也不会抛出异常。

支持的格式：

* [JSONEachRow](/docs/zh/reference/formats/JSON/JSONEachRow) (以及其他 JSON 格式)
* [BSONEachRow](/docs/zh/reference/formats/BSONEachRow) (以及其他 JSON 格式)
* [TSKV](/docs/zh/reference/formats/TabSeparated/TSKV)
* 所有带有 WithNames/WithNamesAndTypes 后缀的格式
* [MySQLDump](/docs/zh/reference/formats/MySQLDump)
* [Native](/docs/zh/reference/formats/Native)

可能的值：

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

<div id="input_format_try_infer_dates">
  ## input\_format\_try\_infer\_dates
</div>

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

如果启用，ClickHouse 会在文本格式的 schema inference 过程中尝试从字符串字段中推断 `Date` 类型。如果输入数据中某一列的所有字段都成功解析为日期，则结果类型为 `Date`；如果至少有一个字段未能解析为日期，则结果类型为 `String`。

默认已启用。

<div id="input_format_try_infer_datetimes">
  ## input\_format\_try\_infer\_datetimes
</div>

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

如果启用，ClickHouse 会在文本格式的 schema inference 中尝试从字符串字段推断 `DateTime64` 类型。如果输入数据中某一列的所有字段都成功解析为日期时间，结果类型将为 `DateTime64`；如果其中至少有一个字段未能解析为日期时间，结果类型则为 `String`。

默认已启用。

<div id="input_format_try_infer_datetimes_only_datetime64">
  ## input\_format\_try\_infer\_datetimes\_only\_datetime64
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "0"},{"label": "允许在数据格式中推断为 DateTime 而非 DateTime64"}]}]} />

启用 input\_format\_try\_infer\_datetimes 时，只推断 DateTime64，不推断 DateTime 类型

<div id="input_format_try_infer_exponent_floats">
  ## input\_format\_try\_infer\_exponent\_floats
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "0"},{"label": "默认不推断采用指数表示法的浮点数"}]}]} />

在文本格式中进行 schema 推断时，尝试推断采用指数表示法的浮点数 (JSON 除外，其中采用指数表示法的数值始终会被推断)

<div id="input_format_try_infer_integers">
  ## input\_format\_try\_infer\_integers
</div>

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

如果启用，ClickHouse 会在文本格式的 schema 推断中尝试将整数而非浮点数推断为结果类型。如果输入数据中某一列的所有数字都是整数，则结果类型为 `Int64`；如果至少有一个数字是浮点数，则结果类型为 `Float64`。

默认启用。

<div id="input_format_try_infer_variants">
  ## input\_format\_try\_infer\_variants
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "当列/数组元素存在多种可能类型时，在文本格式的 schema 推断中尝试推断 Variant 类型"}]}]} />

如果启用，ClickHouse 会在文本格式的 schema 推断中，当列/数组元素存在多种可能类型时，尝试推断 [`Variant`](/docs/zh/reference/data-types/variant) 类型。

可选值：

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

<div id="input_format_tsv_allow_variable_number_of_columns">
  ## input\_format\_tsv\_allow\_variable\_number\_of\_columns
</div>

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

忽略 TSV 输入中的多余列 (如果文件中的列数超出预期) ，并将 TSV 输入中缺失的字段视为默认值

<div id="input_format_tsv_crlf_end_of_line">
  ## input\_format\_tsv\_crlf\_end\_of\_line
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.5"},{"label": "0"},{"label": "启用读取采用 CRLF 行尾的 TSV 格式"}]}]} />

如果将其设置为 true，file 函数将读取使用 \r\n 而非 \n 的 TSV 格式。

<div id="input_format_tsv_detect_header">
  ## input\_format\_tsv\_detect\_header
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.1"},{"label": "1"},{"label": "默认检测 TSV 格式中包含名称和类型的请求头"}]}]} />

自动检测 TSV 格式中包含名称和类型的请求头

<div id="input_format_tsv_empty_as_default">
  ## input\_format\_tsv\_empty\_as\_default
</div>

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

将 TSV 输入中的空字段按默认值处理。

<div id="input_format_tsv_enum_as_number">
  ## input\_format\_tsv\_enum\_as\_number
</div>

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

将 TSV 格式中插入的枚举值按枚举索引处理。

<div id="input_format_tsv_skip_first_lines">
  ## input\_format\_tsv\_skip\_first\_lines
</div>

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

跳过 TSV 格式数据开头的指定行数

<div id="input_format_tsv_skip_trailing_empty_lines">
  ## input\_format\_tsv\_skip\_trailing\_empty\_lines
</div>

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

跳过 TSV 格式末尾的空行

<div id="input_format_tsv_use_best_effort_in_schema_inference">
  ## input\_format\_tsv\_use\_best\_effort\_in\_schema\_inference
</div>

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

使用一些优化和启发式方法来推断 TSV 格式中的 schema

<div id="input_format_values_accurate_types_of_literals">
  ## input\_format\_values\_accurate\_types\_of\_literals
</div>

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

对于 Values format：在使用 template 解析和解释表达式时，会检查字面量的实际类型，以避免可能出现的溢出和精度问题。

<div id="input_format_values_deduce_templates_of_expressions">
  ## input\_format\_values\_deduce\_templates\_of\_expressions
</div>

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

对于 Values format：如果字段无法通过流式解析器解析，则会运行 SQL 解析器，推导出 SQL 表达式的模板，尝试使用该模板解析所有行，然后对所有行中的该表达式求值。

<div id="input_format_values_interpret_expressions">
  ## input\_format\_values\_interpret\_expressions
</div>

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

对于 Values format，如果字段无法通过流式解析器解析，则运行 SQL 解析器，并尝试将其作为 SQL 表达式进行解释。

<div id="input_format_with_names_use_header">
  ## input\_format\_with\_names\_use\_header
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "20.5"},{"label": "1"},{"label": "对带有 WithNames/WithNamesAndTypes 后缀的格式启用名称请求头"}]}]} />

启用或禁用在插入数据时检查列顺序。

为提高插入性能，如果你可以确定输入数据的列顺序与目标表一致，建议禁用此检查。

支持的格式：

* [CSVWithNames](/docs/zh/reference/formats/CSV/CSVWithNames)
* [CSVWithNamesAndTypes](/docs/zh/reference/formats/CSV/CSVWithNamesAndTypes)
* [TabSeparatedWithNames](/docs/zh/reference/formats/TabSeparated/TabSeparatedWithNames)
* [TabSeparatedWithNamesAndTypes](/docs/zh/reference/formats/TabSeparated/TabSeparatedWithNamesAndTypes)
* [JSONCompactEachRowWithNames](/docs/zh/reference/formats/JSON/JSONCompactEachRowWithNames)
* [JSONCompactEachRowWithNamesAndTypes](/docs/zh/reference/formats/JSON/JSONCompactEachRowWithNamesAndTypes)
* [JSONCompactStringsEachRowWithNames](/docs/zh/reference/formats/JSON/JSONCompactStringsEachRowWithNames)
* [JSONCompactStringsEachRowWithNamesAndTypes](/docs/zh/reference/formats/JSON/JSONCompactStringsEachRowWithNamesAndTypes)
* [RowBinaryWithNames](/docs/zh/reference/formats/RowBinary/RowBinaryWithNames)
* [RowBinaryWithNamesAndTypes](/docs/zh/reference/formats/RowBinary/RowBinaryWithNamesAndTypes)
* [CustomSeparatedWithNames](/docs/zh/reference/formats/CustomSeparated/CustomSeparatedWithNames)
* [CustomSeparatedWithNamesAndTypes](/docs/zh/reference/formats/CustomSeparated/CustomSeparatedWithNamesAndTypes)

可能的值：

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

<div id="input_format_with_types_use_header">
  ## input\_format\_with\_types\_use\_header
</div>

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

控制格式解析器是否应检查输入数据中的数据类型是否与目标表中的数据类型匹配。

支持的格式：

* [CSVWithNamesAndTypes](/docs/zh/reference/formats/CSV/CSVWithNamesAndTypes)
* [TabSeparatedWithNamesAndTypes](/docs/zh/reference/formats/TabSeparated/TabSeparatedWithNamesAndTypes)
* [JSONCompactEachRowWithNamesAndTypes](/docs/zh/reference/formats/JSON/JSONCompactEachRowWithNamesAndTypes)
* [JSONCompactStringsEachRowWithNamesAndTypes](/docs/zh/reference/formats/JSON/JSONCompactStringsEachRowWithNamesAndTypes)
* [RowBinaryWithNamesAndTypes](/docs/zh/reference/formats/RowBinary/RowBinaryWithNamesAndTypes)
* [CustomSeparatedWithNamesAndTypes](/docs/zh/reference/formats/CustomSeparated/CustomSeparatedWithNamesAndTypes)

可能的值：

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