跳转到主要内容
这些设置是根据源文件自动生成的。

allow_special_bool_values_inside_variant

允许将 Variant 类型中的 Bool 值解析自 “on”、“off”、“enable”、“disable” 等特殊的布尔文本值。

bool_false_representation

在 TSV/CSV/Vertical/Pretty 格式中用于表示 Bool 值 false 的文本。

bool_true_representation

在 TSV/CSV/Vertical/Pretty 格式中表示 Bool 值 true 的文本。

check_conversion_from_numbers_to_enum

如果值在 Enum 中不存在,则在将 Numbers 转换为 Enum 时抛出异常。 可能的值:
  • 0 — 已禁用。
  • 1 — 已启用。
示例
CREATE TABLE tab (
  val Enum('first' = 1, 'second' = 2, 'third' = 3)
) ENGINE = Memory;

INSERT INTO tab SETTINGS check_conversion_from_numbers_to_enum = 1 VALUES (4); -- 返回一个错误

column_names_for_schema_inference

用于对不包含列名的格式进行 schema inference 时所使用的列名列表。格式为:‘column1,column2,column3,…‘

date_time_64_output_format_cut_trailing_zeros_align_to_groups_of_thousands

动态去除 datetime64 值中末尾的零,将输出标度调整为 [0, 3, 6], 分别对应“秒”“毫秒”和“微秒”

date_time_input_format

允许选择日期和时间文本表示的解析器。 此设置不适用于日期和时间函数 可能的值:
  • 'best_effort' — 启用扩展解析。 ClickHouse 可以解析基础的 YYYY-MM-DD HH:MM:SS 格式以及所有 ISO 8601 日期和时间格式。例如,'2018-06-08T01:02:03.000Z'
  • 'best_effort_us' — 与 best_effort 类似 (差异请参见 parseDateTimeBestEffortUS
  • 'basic' — 使用基础解析器。 ClickHouse 只能解析基础的 YYYY-MM-DD HH:MM:SSYYYY-MM-DD 格式。例如,2019-08-20 10:18:562019-08-20
另请参见:

date_time_output_format

允许为日期和时间的文本表示选择不同的输出格式。 可能的值:
  • simple - 简单输出格式。 ClickHouse 以 YYYY-MM-DD hh:mm:ss 格式输出日期和时间。例如,2019-08-20 10:18:56。计算根据数据类型的时区 (如果存在) 或服务器时区进行。
  • iso - ISO 输出格式。 ClickHouse 以 ISO 8601 YYYY-MM-DDThh:mm:ssZ 格式输出日期和时间。例如,2019-08-20T10:18:56Z。请注意,输出为 UTC (Z 表示 UTC) 。
  • unix_timestamp - Unix 时间戳输出格式。 ClickHouse 以 Unix timestamp 格式输出日期和时间。例如,1566285536
另请参阅:

date_time_overflow_behavior

定义将 DateDate32DateTimeDateTime64 或整数转换为 Date、Date32、DateTime 或 DateTime64 时,如果该值无法用结果类型表示,系统应采取的行为。 Possible values:
  • ignore — 静默忽略溢出。结果未定义。
  • throw — 发生溢出时抛出异常。
  • saturate — 对结果执行饱和处理。如果该值小于目标类型可表示的最小值,则结果取最小可表示值;如果该值大于目标类型可表示的最大值,则结果取最大可表示值。
默认值:ignore

errors_output_format

用于将错误写入文本输出的方式。

format_avro_schema_registry_connection_timeout

对于 AvroConfluent 格式:Confluent Schema Registry HTTP 客户端的连接超时时间 (秒) 。同时用于 schema 拉取和 schema 注册。必须大于 0 且小于 600 (10 分钟) 。

format_avro_schema_registry_receive_timeout

对于 AvroConfluent 格式:Confluent Schema Registry HTTP 客户端的接收超时时间 (单位:秒) 。同时用于 schema 拉取和 schema 注册。该值必须大于 0 且小于 600 (10 分钟) 。

format_avro_schema_registry_send_timeout

对于 AvroConfluent 格式:Confluent Schema Registry HTTP 客户端的发送超时,单位为秒。该设置同时用于 schema 拉取和 schema 注册。必须大于 0 且小于 600 (10 分钟) 。

format_avro_schema_registry_url

对于 AvroConfluent 格式:Confluent Schema Registry 的 URL。

format_binary_max_array_size

RowBinary 格式 中 Array 的最大允许大小。它可防止在数据损坏时分配大量内存。0 表示不受限制

format_binary_max_object_size

JSON 类型的 RowBinary 格式中,单个对象允许的最大路径数量。这可防止在数据损坏时分配大量内存。0 表示不受限制

format_binary_max_string_size

RowBinary 格式 中 String 的最大允许大小。该设置可在数据损坏时防止分配大量内存。0 表示不受限制

format_capn_proto_enum_comparising_mode

ClickHouse 枚举与 CapnProto 枚举的映射方式

format_capn_proto_max_message_size

单个 CapnProto 消息的最大大小 (以字节为单位) 。这可防止格式错误或损坏的数据导致过量内存分配。默认值为 1 GiB。

format_capn_proto_use_autogenerated_schema

未设置 format_schema 时,使用自动生成的 CapnProto schema

format_csv_allow_double_quotes

如果设置为 true,则允许使用双引号括起字符串。

format_csv_allow_single_quotes

如果设置为 true,则允许使用单引号包裹字符串。

format_csv_delimiter

在 CSV 数据中用作分隔符的字符。如果将此设置设为字符串,则该字符串的长度必须为 1。

format_csv_null_representation

CSV 格式中的自定义 NULL 表示形式

format_custom_escaping_rule

字段转义规则 (适用于 CustomSeparated 格式)

format_custom_field_delimiter

字段之间的分隔符 (用于 CustomSeparated 格式)

format_custom_result_after_delimiter

结果集后的后缀 (适用于 CustomSeparated 格式)

format_custom_result_before_delimiter

结果集前缀 (用于 CustomSeparated 格式)

format_custom_row_after_delimiter

最后一列字段后的分隔符 (用于 CustomSeparated 格式)

format_custom_row_before_delimiter

CustomSeparated 格式中第一列字段前的分隔符

format_custom_row_between_delimiter

行间分隔符 (用于 CustomSeparated 格式)

format_display_secrets_in_show_and_select

启用或禁用在针对表、数据库、表函数和字典的 SHOWSELECT 查询中显示 secrets。 希望查看 secrets 的用户,还必须启用 display_secrets_in_show_and_select server setting 并拥有 displaySecretsInShowAndSelect 权限。 Possible values:
  • 0 — 已禁用。
  • 1 — 已启用。

format_json_object_each_row_column_for_object_name

JSONObjectEachRow 格式中,用于存储/写入对象名称的列名。 列类型应为 String。如果值为空,则对象名称将使用默认名称 row_{i}

format_protobuf_use_autogenerated_schema

未设置 format_schema 时,使用自动生成的 Protobuf

format_regexp

正则表达式 (用于 Regexp 格式)

format_regexp_escaping_rule

字段转义规则 (Regexp 格式)

format_regexp_skip_unmatched

跳过不匹配正则表达式的行 (适用于 Regexp 格式)

format_schema

当你使用需要 schema 定义的格式 (例如 Cap’n ProtoProtobuf) 时,这个参数会很有用。其值取决于所用的格式。

format_schema_message_name

指定 format_schema 中定义的 schema 里所需消息的名称。 为保持与旧版 format_schema 格式 (file_name:message_name) 的兼容性:
  • 如果未指定 format_schema_message_name,则会从旧版 format_schema 值中的 message_name 部分推断消息名称。
  • 如果在使用旧版格式时指定了 format_schema_message_name,则会报错。

format_schema_source

定义 format_schema 的来源。 可能的值:
  • ‘file’ (默认) :format_schema 是位于 format_schemas 目录中的 schema 文件名。
  • ‘string’:format_schema 是 schema 的字面内容。
  • ‘query’:format_schema 是用于获取 schema 的查询。 当 format_schema_source 设置为 ‘query’ 时,需满足以下条件:
  • 查询必须恰好返回一个值:即单行单个 String 列。
  • 查询结果会被视为 schema 内容。
  • 该结果会缓存在本地的 format_schemas 目录中。
  • 可以使用以下命令清除本地缓存:SYSTEM DROP FORMAT SCHEMA CACHE FOR Files
  • 一旦被缓存,相同的查询不会再次执行来获取 schema,直到缓存被显式清除。
  • 除了本地缓存文件外,Protobuf 消息也会缓存在内存中。即使清除了本地缓存文件,也必须使用 SYSTEM DROP FORMAT SCHEMA CACHE [FOR Protobuf] 清除内存缓存,才能完全刷新 schema。
  • 运行查询 SYSTEM DROP FORMAT SCHEMA CACHE 可一次性清除缓存文件和 Protobuf 消息 schema 的缓存。

format_template_resultset

包含结果集格式字符串的文件路径 (用于 Template 格式)

format_template_resultset_format

结果集的 格式字符串 (用于 Template 格式)

format_template_row

包含行格式字符串的文件路径 (用于 Template 格式)

format_template_row_format

行的格式字符串 (用于 Template 格式)

format_template_rows_between_delimiter

行与行之间的分隔符 (用于 Template 格式)

format_tsv_null_representation

TSV 格式的自定义 NULL 表示形式

input_format_allow_errors_num

设置从文本格式 (CSV、TSV 等) 读取数据时可接受的最大错误数。 默认值为 0。 请始终与 input_format_allow_errors_ratio 配合使用。 如果在读取行时发生错误,但错误计数仍小于 input_format_allow_errors_num,ClickHouse 会忽略该行并继续读取下一行。 如果 input_format_allow_errors_numinput_format_allow_errors_ratio 都超出限制,ClickHouse 会抛出异常。

input_format_allow_errors_ratio

设置从文本格式 (CSV、TSV 等) 读取时允许的最大错误比例。 错误比例以 0 到 1 之间的浮点数表示。 默认值为 0。 务必与 input_format_allow_errors_num 搭配使用。 如果在读取行时发生错误,但错误计数器仍小于 input_format_allow_errors_ratio,ClickHouse 会忽略该行并继续读取下一行。 如果 input_format_allow_errors_numinput_format_allow_errors_ratio 都超出限制,ClickHouse 会抛出异常。

input_format_allow_seeks

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

input_format_arrow_allow_missing_columns

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

input_format_arrow_case_insensitive_column_matching

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

input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference

在对 Arrow 格式进行 schema inference 时,跳过类型不受支持的列

input_format_avro_allow_missing_fields

对于 Avro/AvroConfluent 格式:如果在 schema 中找不到字段,则使用默认值而不是报错

input_format_avro_null_as_default

对于 Avro/AvroConfluent 格式:当值为 NULL 且列不是 Nullable 时,插入默认值

input_format_binary_decode_types_in_binary_format

在 RowBinaryWithNamesAndTypes 输入格式中,以二进制格式读取数据类型,而不是读取类型名称

input_format_binary_max_type_complexity

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

input_format_binary_read_json_as_string

在 RowBinary 输入格式中,将 JSON 数据类型的值读取为 JSON String 值。

input_format_bson_skip_fields_with_unsupported_types_in_schema_inference

在对 BSON 格式进行 schema inference 时,跳过类型不受支持的字段。

input_format_capn_proto_skip_fields_with_unsupported_types_in_schema_inference

对 CapnProto format 进行 schema inference 时,跳过类型不受支持的列

input_format_column_name_matching_mode

定义通过各种格式 (包括但不限于 JSONEachRow、CSVWithNames、JSONColumns、BSONEachRow、RowBinaryWithNames) 摄取数据时列名的匹配模式。 支持的模式:
  • match_case:区分大小写匹配
    • ignore_case:不区分大小写匹配
    • auto:先尝试区分大小写匹配;如果失败,则尝试不区分大小写匹配。

input_format_connection_handling

启用此选项后,如果连接意外关闭,缓冲区中的剩余数据将继续被解析和处理,而不会被视为错误
启用此选项会禁用并行解析,并且无法进行去重

input_format_csv_allow_cr_end_of_line

如果设置为 true,则允许行尾使用 \r,且后面不跟

input_format_csv_allow_variable_number_of_columns

忽略 CSV 输入中的额外列 (如果文件中的列数超出预期) ,并将 CSV 输入中缺失的字段视为默认值

input_format_csv_allow_whitespace_or_tab_as_delimiter

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

input_format_csv_arrays_as_nested_csv

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

input_format_csv_deserialize_separate_columns_into_tuple

如果将其设置为 true,则以 CSV 格式写入的多个独立列可以反序列化为 Tuple 列。

input_format_csv_detect_header

自动检测 CSV 格式中包含名称和类型的表头

input_format_csv_empty_as_default

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

input_format_csv_enum_as_number

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

input_format_csv_skip_first_lines

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

input_format_csv_skip_trailing_empty_lines

跳过 CSV 格式末尾的空行

input_format_csv_trim_whitespaces

去除 CSV 字符串开头和末尾的空格及制表符 (\t) 字符

input_format_csv_try_infer_numbers_from_strings

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

input_format_csv_try_infer_strings_from_quoted_tuples

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

input_format_csv_use_best_effort_in_schema_inference

使用一些调整和启发式方法,在 CSV format 中尽力推断 schema

input_format_csv_use_default_on_bad_values

允许在 CSV 字段因错误值反序列化失败时,将该列设为默认值

input_format_custom_allow_variable_number_of_columns

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

input_format_custom_detect_header

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

input_format_custom_skip_trailing_empty_lines

跳过 CustomSeparated 格式末尾的空行

input_format_defaults_for_omitted_fields

执行 INSERT 查询时,会用相应列的默认值替换被省略的输入列值。此选项适用于 JSONEachRow (以及其他 JSON 格式) 、CSVTabSeparatedTSKVParquetArrowAvroORCNative 格式,以及带有 WithNames/WithNamesAndTypes 后缀的格式。
启用此选项后,扩展的表元数据会从服务端发送到客户端。这会额外消耗服务端的计算资源,并可能降低性能。
可能的值:
  • 0 — 已禁用。
  • 1 — 已启用。

input_format_force_null_for_omitted_fields

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

input_format_hive_text_allow_variable_number_of_columns

忽略 Hive Text 输入中的额外列 (如果文件中的列数超出预期) ,并将 Hive Text 输入中缺失的字段按默认值处理

input_format_hive_text_collection_items_delimiter

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

input_format_hive_text_fields_delimiter

Hive Text File 的字段分隔符

input_format_hive_text_map_keys_delimiter

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

input_format_import_nested_json

启用或禁用插入包含嵌套对象的 JSON 数据。 支持的格式: 可能的值:
  • 0 — 禁用。
  • 1 — 启用。
另请参见:

input_format_ipv4_default_on_conversion_error

IPv4 反序列化时,如果发生转换错误,将使用默认值而不是抛出异常。 默认情况下禁用。

input_format_ipv6_default_on_conversion_error

在 IPV6 反序列化过程中,如果转换出错,将使用默认值而不是抛出异常。 默认禁用。

input_format_json_compact_allow_variable_number_of_columns

允许 JSONCompact/JSONCompactEachRow 输入格式中的行包含数量可变的列。 对于列数超过预期的行,忽略多余的列;对于缺失列的行,则将其视为默认值。 默认情况下禁用。

input_format_json_defaults_for_missing_elements_in_named_tuple

在解析命名元组时,如果 JSON 对象中缺少元素,则插入默认值。 此设置仅在启用 input_format_json_named_tuples_as_objects 时生效。 默认启用。

input_format_json_empty_as_default

启用后,会将 JSON 输入中的空字段替换为默认值。对于复杂的默认表达式,还必须同时启用 input_format_defaults_for_omitted_fields 可能的值:
  • 0 — 禁用。
  • 1 — 启用。

input_format_json_ignore_unknown_keys_in_named_tuple

在将 JSON 对象解析为命名元组时,忽略未知键。 默认启用。

input_format_json_ignore_unnecessary_fields

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

input_format_json_infer_array_of_dynamic_from_array_of_different_types

如果启用,则在进行 schema 推断 时,ClickHouse 会对值的数据类型不同的 JSON 数组使用 Array(Dynamic) 类型。 示例:
SET input_format_json_infer_array_of_dynamic_from_array_of_different_types=1;
DESC format(JSONEachRow, '{"a" : [42, "hello", [1, 2, 3]]}');
┌─name─┬─type───────────┐
│ a    │ Array(Dynamic) │
└──────┴────────────────┘
SET input_format_json_infer_array_of_dynamic_from_array_of_different_types=0;
DESC format(JSONEachRow, '{"a" : [42, "hello", [1, 2, 3]]}');
┌─name─┬─type─────────────────────────────────────────────────────────────┐
│ a    │ Tuple(Nullable(Int64), Nullable(String), Array(Nullable(Int64))) │
└──────┴──────────────────────────────────────────────────────────────────┘
默认启用。

input_format_json_infer_incomplete_types_as_strings

在进行 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 之类的错误。 示例:
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,'{}',[]) │
└────────────────────────────────┘
默认启用。

input_format_json_map_as_array_of_tuples

将 Map 列反序列化为由 Tuple 构成的 JSON 数组。 默认禁用。

input_format_json_max_depth

JSON 中字段的最大嵌套深度。这不是硬性限制,不要求严格精确地应用。

input_format_json_named_tuples_as_objects

将命名元组列按 JSON 对象进行解析。 默认启用。

input_format_json_read_arrays_as_strings

允许在 JSON 输入格式中将 JSON 数组解析为字符串。 示例:
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]                                   │
└───────────────────────┴─────────────────┴───────────────────────────────────────────┘
默认启用。

input_format_json_read_bools_as_numbers

允许在 JSON 输入格式中将布尔值按数字解析。 默认启用。

input_format_json_read_bools_as_strings

允许在 JSON 输入格式中将布尔值按字符串解析。 默认启用。

input_format_json_read_numbers_as_strings

允许在 JSON 输入格式中将数字解析为字符串。 默认启用。

input_format_json_read_objects_as_strings

允许在 JSON 输入格式中将 JSON 对象作为字符串解析。 示例:
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 │
└────┴──────────────────────────┴────────────┘
默认启用。

input_format_json_throw_on_bad_escape_sequence

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

input_format_json_try_infer_named_tuples_from_objects

如果启用,ClickHouse 会在进行 schema 推断时尝试从 JSON 对象中推断命名 Tuple。 生成的命名 Tuple 将包含样本数据中所有对应 JSON 对象里的全部元素。 示例:
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))) │              │                    │         │                  │                │
└──────┴────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
默认启用。

input_format_json_try_infer_numbers_from_strings

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

input_format_json_use_string_type_for_ambiguous_paths_in_named_tuples_inference_from_objects

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

input_format_json_validate_types_from_metadata

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

input_format_max_block_size_bytes

限制输入格式在数据解析过程中形成的块大小 (以字节为单位) 。用于基于行的输入格式,且仅在块由 ClickHouse 端生成时生效。 0 表示不限制字节大小。

input_format_max_block_wait_ms

限制在基于行的输入 format 中,解析期间发出块前的最长等待时间 (以毫秒为单位) 。0 表示不限制。
该选项仅在启用 input_format_connection_handling 时生效。设置该值还会禁用并行解析,并导致无法去重。
对于流式 insert,你还必须设置 min_insert_block_size_rows=0min_insert_block_size_bytes=0。否则,已解析的块仍可能在块 squashing 阶段累积在内存中,直到达到这些阈值,从而无法及时插入。
Example:将 Wikipedia 的最近更改流式写入 ClickHouse
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

input_format_max_bytes_to_read_for_schema_inference

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

input_format_max_rows_to_read_for_schema_inference

自动进行 schema 推断时,最多读取的数据行数。

input_format_msgpack_number_of_columns

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

input_format_mysql_dump_map_column_names

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

input_format_mysql_dump_table_name

从中读取数据的 MySQL 转储中的表名

input_format_native_allow_types_conversion

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

input_format_native_decode_types_in_binary_format

在 Native 输入格式 中以二进制格式读取数据类型,而不是读取类型名称

input_format_null_as_default

启用或禁用以下行为:当这些字段的数据类型不是 Nullable 时,使用默认值初始化 NULL 字段。 如果列类型不是 Nullable 且此设置被禁用,则插入 NULL 会导致异常。如果列类型是 Nullable,则无论此设置如何,NULL 值都会按原样插入。 此设置适用于大多数输入格式。 对于复杂的默认表达式,还必须启用 input_format_defaults_for_omitted_fields 可能的值:
  • 0 — 将 NULL 插入非 Nullable 列会导致异常。
  • 1 — NULL 字段将使用列的默认值进行初始化。

input_format_orc_allow_missing_columns

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

input_format_orc_case_insensitive_column_matching

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

input_format_orc_dictionary_as_low_cardinality

读取 ORC 文件时,将采用 ORC 字典编码的列视为 LowCardinality 列。

input_format_orc_filter_push_down

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

input_format_orc_reader_time_zone_name

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

input_format_orc_row_batch_size

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

input_format_orc_skip_columns_with_unsupported_types_in_schema_inference

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

input_format_orc_use_fast_decoder

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

input_format_parallel_parsing

启用或禁用在并行解析数据格式时保持顺序。仅支持 TabSeparated (TSV)TSKVCSVJSONEachRow 格式。 可能的值:
  • 1 — 启用。
  • 0 — 禁用。

input_format_parquet_allow_geoparquet_parser

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

input_format_parquet_allow_missing_columns

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

input_format_parquet_bloom_filter_push_down

读取 Parquet 文件时,会根据 WHERE 表达式以及 Parquet 元数据中的 bloom filter 跳过整个行组。

input_format_parquet_case_insensitive_column_matching

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

input_format_parquet_enable_json_parsing

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

input_format_parquet_enable_row_group_prefetch

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

input_format_parquet_filter_push_down

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

input_format_parquet_local_file_min_bytes_for_seek

在 Parquet 输入格式中,本地读取 (文件) 执行寻道而非忽略读取所需的最小字节数

input_format_parquet_local_time_as_utc

确定在对 isAdjustedToUTC=false 的 Parquet 时间戳进行 schema inference 时使用的数据类型。如果为 true:DateTime64(…, ‘UTC’);如果为 false:DateTime64(…)。这两种行为都不完全正确,因为 ClickHouse 没有表示本地挂钟时间的数据类型。虽然这有些违反直觉,但 true 可能是相对没那么错误的选项,因为将 'UTC' 时间戳格式化为 String 时,会得到正确的本地时间表示。

input_format_parquet_max_block_size

Parquet 读取器的最大块大小。

input_format_parquet_memory_high_watermark

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

input_format_parquet_memory_low_watermark

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

input_format_parquet_page_filter_push_down

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

input_format_parquet_prefer_block_bytes

Parquet reader 输出的平均块大小 (字节)

input_format_parquet_preserve_order

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

input_format_parquet_skip_columns_with_unsupported_types_in_schema_inference

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

input_format_parquet_use_offset_index

在未使用页面过滤器时,对 Parquet file 中页面的读取方式做了小幅调整。

input_format_parquet_verify_checksums

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

input_format_protobuf_flatten_google_wrappers

为普通的非嵌套列启用 Google 包装器类型,例如,对 String 列 str 使用 google.protobuf.StringValue str。对于 Nullable 列,空包装器会被视为默认值,缺失的则会被视为 NULL

input_format_protobuf_oneof_presence

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

input_format_protobuf_skip_fields_with_unsupported_types_in_schema_inference

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

input_format_record_errors_file_path

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

input_format_skip_unknown_fields

启用或禁用在插入时跳过额外数据。 写入数据时,如果输入数据包含目标表中不存在的列,ClickHouse 会抛出异常。如果启用跳过,ClickHouse 将不会插入这些额外数据,也不会抛出异常。 支持的格式: 可能的值:
  • 0 — 禁用。
  • 1 — 启用。

input_format_try_infer_dates

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

input_format_try_infer_datetimes

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

input_format_try_infer_datetimes_only_datetime64

启用 input_format_try_infer_datetimes 时,仅推断 DateTime64,不推断 DateTime 类型

input_format_try_infer_exponent_floats

在文本格式中进行 schema 推断时,尝试推断以科学计数法表示的浮点数 (JSON 除外,其中这类数字始终会被推断)

input_format_try_infer_integers

启用后,ClickHouse 会在文本格式的 schema 推断 中尽量将整数推断为整数类型,而不是浮点类型。如果输入数据中该列的所有数值都是整数,则结果类型为 Int64;如果至少有一个数值是浮点数,则结果类型为 Float64 默认启用。

input_format_try_infer_variants

如果启用,ClickHouse 会在文本格式的 schema 推断 中,当列/Array 元素存在多种可能类型时,尝试推断 Variant 类型。 可能的值:
  • 0 — 已禁用。
  • 1 — 已启用。

input_format_tsv_allow_variable_number_of_columns

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

input_format_tsv_crlf_end_of_line

如果将其设为 true,file 函数将按 \r\n 而不是 \n 读取 TSV 格式。

input_format_tsv_detect_header

自动检测 TSV 格式中包含列名和类型的表头

input_format_tsv_empty_as_default

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

input_format_tsv_enum_as_number

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

input_format_tsv_skip_first_lines

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

input_format_tsv_skip_trailing_empty_lines

跳过 TSV 格式末尾的空行

input_format_tsv_use_best_effort_in_schema_inference

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

input_format_values_accurate_types_of_literals

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

input_format_values_deduce_templates_of_expressions

对于 Values 格式:如果字段无法通过流式解析器解析,则运行 SQL 解析器,推导出 SQL 表达式的模板,尝试使用该模板解析所有行,然后对所有行解释该表达式。

input_format_values_interpret_expressions

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

input_format_with_names_use_header

启用或禁用在插入数据时检查列顺序。 为提高 insert 性能,如果你确定输入数据的列顺序与目标表一致,建议禁用此检查。 支持的格式: 可能的值:
  • 0 — 禁用。
  • 1 — 启用。

input_format_with_types_use_header

控制格式解析器是否检查输入数据中的数据类型是否与目标表中的数据类型一致。 支持的格式: 可能的值:
  • 0 — 已禁用。
  • 1 — 已启用。

insert_distributed_one_random_shard

在没有分布式键时,启用或禁用向 Distributed 表随机插入某个分片。 默认情况下,向包含多个分片的 Distributed 表插入数据时,如果没有分布式键,ClickHouse 服务器会拒绝任何插入请求。当 insert_distributed_one_random_shard = 1 时,则允许插入,数据会被随机转发到所有分片中的某一个。 可能的值:
  • 0 — 如果存在多个分片且未提供分布式键,则拒绝插入。
  • 1 — 如果未提供分布式键,则在所有可用分片中随机选择一个执行插入。

interval_output_format

允许为时间间隔类型的文本表示选择不同的输出格式。 可能的值:
  • kusto - KQL 风格输出格式。 ClickHouse 以 KQL 格式输出时间间隔。例如,toIntervalDay(2) 会格式化为 2.00:00:00。请注意,对于长度可变的时间间隔类型 (即 IntervalMonthIntervalYear) ,会按每个时间间隔的平均秒数进行换算。
  • numeric - 数值输出格式。 ClickHouse 将时间间隔输出为其底层数值表示。例如,toIntervalDay(2) 会格式化为 2
另请参阅:

into_outfile_create_parent_directories

使用 INTO OUTFILE 时,如果父目录不存在,则自动创建父目录。

json_type_escape_dots_in_keys

启用后,在解析 JSON 时会转义键中的点号。

max_dynamic_subcolumns_in_json_type_parsing

在解析 JSON 列时,每个列中可创建的动态子列的最大数量。 它可在解析期间控制动态子列的数量,而不受数据类型中指定的动态参数限制。

output_format_arrow_compression_method

Arrow 输出格式的压缩方法。支持的编解码器:lz4_frame、zstd、none (未压缩) 。

output_format_arrow_date_as_uint16

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

output_format_arrow_fixed_string_as_fixed_byte_array

对 FixedString 列,使用 Arrow FIXED_SIZE_BINARY 类型而不是 Binary。

output_format_arrow_low_cardinality_as_dictionary

启用将 LowCardinality 类型以 Arrow 的 Dictionary 类型输出

output_format_arrow_string_as_string

对 String 列使用 Arrow String 类型,而不是 Binary

output_format_arrow_unsupported_types_as_binary

将无法转换的输出类型以原始二进制数据形式输出。如果为 false,则此类类型会抛出 UNKNOWN_TYPE 异常。

output_format_arrow_use_64_bit_indexes_for_dictionary

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

output_format_arrow_use_signed_indexes_for_dictionary

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

output_format_avro_codec

用于输出的压缩编解码器。可能的值:‘null’、‘deflate’、‘snappy’、‘zstd’。

output_format_avro_confluent_subject

对于 AvroConfluent 输出格式:schema 在 Confluent Schema Registry 中注册时使用的 subject 名称。写入 AvroConfluent 输出时必需。

output_format_avro_rows_in_file

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

output_format_avro_string_column_pattern

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

output_format_avro_sync_interval

同步间隔 (以字节为单位) 。

output_format_binary_encode_types_in_binary_format

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

output_format_binary_write_json_as_string

在 RowBinary 输出格式中,将 JSON Data type 的值写为 JSON String 值。

output_format_bson_string_as_string

对于 String 列,使用 BSON String 类型而非 Binary。

output_format_compression_level

当查询输出启用压缩时,使用的默认压缩级别。该设置会在 SELECT 查询包含 INTO OUTFILE,或写入表函数 fileurlhdfss3azureBlobStorage 时生效。 可能的值:122

output_format_compression_zstd_window_log

可在输出压缩方法为 zstd 时使用。如果该值大于 0,此设置会显式指定压缩窗口大小 (2 的幂) ,并为 zstd 压缩启用长距离模式。这有助于获得更高的压缩率。 可能的值:非负数。请注意,如果该值过小或过大,zstdlib 会抛出异常。典型值范围为 20 (窗口大小 = 1MB) 到 30 (窗口大小 = 1GB) 。

output_format_csv_crlf_end_of_line

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

output_format_csv_serialize_tuple_into_separate_columns

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

output_format_decimal_trailing_zeros

打印 Decimal 值时输出末尾的零。例如,输出 1.230000 而不是 1.23。 默认禁用。

output_format_json_array_of_rows

启用后,可在 JSONEachRow 格式中将所有行输出为一个 JSON 数组。 可能的值:
  • 1 — ClickHouse 将所有行作为一个数组输出,其中每一行都采用 JSONEachRow 格式。
  • 0 — ClickHouse 将每一行分别以 JSONEachRow 格式输出。
启用该设置的查询示例 查询:
SET output_format_json_array_of_rows = 1;
SELECT number FROM numbers(3) FORMAT JSONEachRow;
结果:
[
{"number":"0"},
{"number":"1"},
{"number":"2"}
]
禁用该设置后的查询示例 查询:
SET output_format_json_array_of_rows = 0;
SELECT number FROM numbers(3) FORMAT JSONEachRow;
结果:
{"number":"0"}
{"number":"1"}
{"number":"2"}

output_format_json_escape_forward_slashes

控制在 JSON 输出格式中,是否对字符串输出中的正斜杠进行转义。这是出于与 JavaScript 兼容的考虑。不要将其与始终会被转义的反斜杠混淆。 默认启用。

output_format_json_map_as_array_of_tuples

将 Map 列序列化为由 Tuple 构成的 JSON 数组。 默认禁用。

output_format_json_named_tuples_as_objects

将命名元组列序列化为 JSON 对象。 默认启用。

output_format_json_pretty_print

此设置决定了在使用 JSON 输出格式时,Tuple、Map 和 Array 等嵌套结构在 data 数组中的显示方式。 例如,不会输出成:
"data":
[
  {
    "tuple": {"a":1,"b":2,"c":3},
    "array": [1,2,3],
    "map": {"a":1,"b":2,"c":3}
  }
],
输出格式如下:
"data":
[
    {
        "tuple": {
            "a": 1,
            "b": 2,
            "c": 3
        },
        "array": [
            1,
            2,
            3
        ],
        "map": {
            "a": 1,
            "b": 2,
            "c": 3
        }
    }
],
默认启用。

output_format_json_quote_64bit_floats

控制在 JSON* 格式中输出 64 位 floats 时,是否为其加上引号。 默认禁用。

output_format_json_quote_64bit_integers

控制在 JSON 格式中输出 64 位或更大的整数 (如 UInt64Int128) 时是否加引号。 默认情况下,这类整数会用引号括起来。这种行为与大多数 JavaScript 实现兼容。 可能的值:
  • 0 — 整数输出时不加引号。
  • 1 — 整数会用引号括起来。

output_format_json_quote_decimals

控制在 JSON 输出格式中是否为 Decimal 值添加引号。 默认处于禁用状态。

output_format_json_quote_denormals

JSON 输出格式中,允许输出 +nan-nan+inf-inf 可能的值:
  • 0 — 禁用。
  • 1 — 启用。
示例 考虑以下表 account_orders
┌─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 值:
SELECT area/period FROM account_orders FORMAT JSON;
{
        "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 时,查询结果为:
{
        "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
        }
}

output_format_json_skip_null_value_in_named_tuples

将命名元组列序列化为 JSON 对象时,跳过值为 null 的键值对。仅当 output_format_json_named_tuples_as_objects 为 true 时,此设置才生效。

output_format_json_validate_utf8

控制是否在 JSON 输出格式中校验 UTF-8 序列;不影响 JSON/JSONCompact/JSONColumnsWithMetadata 格式,因为它们始终会校验 UTF-8。 默认禁用。

output_format_markdown_escape_special_characters

启用后,会对 Markdown 中的特殊字符进行转义。 Common Mark 定义了以下可通过 : 进行转义的特殊字符:
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
可选值:
  • 0 — 禁用。
  • 1 — 启用。

output_format_msgpack_uuid_representation

用于指定以 MsgPack 格式输出 UUID 的方式。

output_format_native_encode_types_in_binary_format

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

output_format_native_use_flattened_dynamic_and_json_serialization

以扁平化格式写入 JSONDynamic 列的数据 (将所有类型/路径作为单独的子列) 。

output_format_native_write_json_as_string

JSON 列写为包含 JSON 字符串的 String 列,而不是使用默认的原生 JSON 序列化格式。

output_format_orc_compression_block_size

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

output_format_orc_compression_method

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

output_format_orc_dictionary_key_size_threshold

对于 ORC 输出格式中的字符串列,如果不同值的数量大于非 NULL 行总数的这一比例,则关闭字典编码。否则启用字典编码

output_format_orc_row_index_stride

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

output_format_orc_string_as_string

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

output_format_orc_writer_time_zone_name

ORC 写入器使用的时区名称,默认时区为 GMT。

output_format_parallel_formatting

启用或禁用数据的并行格式化。仅支持 TSVTSKVCSVJSONEachRow 格式。 可能的值:
  • 1 — 启用。
  • 0 — 禁用。

output_format_parquet_batch_size

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

output_format_parquet_bloom_filter_bits_per_value

Parquet 布隆过滤器中每个不同值使用的近似位数。估计的误报率如下:
  • 6 位 - 10%
  • 10.5 位 - 1%
  • 16.9 位 - 0.1%
  • 26.4 位 - 0.01%
  • 41 位 - 0.001%

output_format_parquet_bloom_filter_flush_threshold_bytes

控制在 Parquet 文件中的何处写入布隆过滤器。布隆过滤器将按大致为该大小的分组写入。具体来说:
  • 如果为 0,则每个行组的布隆过滤器都会在该行组之后立即写入,
    • 如果大于所有布隆过滤器的总大小,则所有行组的布隆过滤器会先在内存中累积,然后在接近文件末尾处一起写入,
    • 否则,布隆过滤器会先在内存中累积,并在其总大小超过该值时写出。

output_format_parquet_compression_method

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

output_format_parquet_data_page_size

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

output_format_parquet_date_as_uint16

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

output_format_parquet_datetime_as_uint32

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

output_format_parquet_enum_as_byte_array

使用 Parquet 物理类型 BYTE_ARRAY 和逻辑类型 ENUM 写入枚举

output_format_parquet_fixed_string_as_fixed_byte_array

对于 FixedString 列,使用 Parquet FIXED_LEN_BYTE_ARRAY 类型,而不是 Binary。

output_format_parquet_geometadata

允许将 Geo 列信息写入 Parquet 元数据,并将列编码为 WKB 格式。

output_format_parquet_max_dictionary_size

如果字典大小超过此字节数,将切换为不使用字典的编码。设置为 0 可禁用字典编码。

output_format_parquet_parallel_encoding

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

output_format_parquet_row_group_size

目标行组大小 (按行数计) 。

output_format_parquet_row_group_size_bytes

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

output_format_parquet_string_as_string

对 String 列使用 Parquet String 类型,而不是 Binary。

output_format_parquet_write_bloom_filter

在 Parquet 文件中写入布隆过滤器。

output_format_parquet_write_checksums

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

output_format_parquet_write_page_index

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

output_format_pretty_color

在 Pretty 格式中使用 ANSI 转义序列。0 - 禁用,1 - 启用,‘auto’ - 如果输出到终端则启用。 当表中的行数较多时,在页脚显示列名。 可能的值: 示例 查询:
SELECT *, toTypeName(*) FROM (SELECT * FROM system.numbers LIMIT 1000);
结果:
      ┌─number─┬─toTypeName(number)─┐
   1. │      0 │ UInt64             │
   2. │      1 │ UInt64             │
   3. │      2 │ UInt64             │
   ...
 999. │    998 │ UInt64             │
1000. │    999 │ UInt64             │
      └─number─┴─toTypeName(number)─┘
如果启用了 output_format_pretty_display_footer_column_names,则此设置用于指定显示带列名页脚所需的最小行数。

output_format_pretty_fallback_to_vertical

如果启用,且表很宽但行数较少,Pretty 格式将按 Vertical 格式的方式输出。 有关此行为的详细调优,请参见 output_format_pretty_fallback_to_vertical_max_rows_per_chunkoutput_format_pretty_fallback_to_vertical_min_table_width

output_format_pretty_fallback_to_vertical_max_rows_per_chunk

仅当一个 chunk 中的记录数不超过指定值时,回退到 Vertical 格式 (参见 output_format_pretty_fallback_to_vertical) 才会生效。

output_format_pretty_fallback_to_vertical_min_columns

只有当列数大于指定值时,才会启用回退到 Vertical 格式 (参见 output_format_pretty_fallback_to_vertical) 。

output_format_pretty_fallback_to_vertical_min_table_width

只有在表中各列长度总和至少达到指定值,或至少有一个值包含换行符时,才会启用回退到 Vertical 格式 (参见 output_format_pretty_fallback_to_vertical) 。

output_format_pretty_glue_chunks

如果以 Pretty 格式渲染的数据分多个块到达,即使块之间存在延迟,只要下一个块的列宽与前一个块相同,就会使用 ANSI 转义序列回到上一行并覆盖前一个块的页脚,将新块的数据接续显示上去。这样可以让结果在视觉上更美观。 0 - 已禁用,1 - 已启用,‘auto’ - 在终端中时启用。

output_format_pretty_grid_charset

用于输出网格边框的字符集。可用字符集:ASCII、UTF-8 (默认) 。

output_format_pretty_highlight_digit_groups

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

output_format_pretty_highlight_trailing_spaces

如果已启用,且输出到终端时,则会以灰色并加下划线的方式高亮显示行尾空格。

output_format_pretty_max_column_name_width_cut_to

如果列名过长,则将其截断到此长度。 如果列名长度超过 output_format_pretty_max_column_name_width_cut_tooutput_format_pretty_max_column_name_width_min_chars_to_cut 之和,则会被截断。

output_format_pretty_max_column_name_width_min_chars_to_cut

列名过长时,最少截断的字符数。 如果列名长度超过 output_format_pretty_max_column_name_width_cut_tooutput_format_pretty_max_column_name_width_min_chars_to_cut 之和,则会被截断。

output_format_pretty_max_column_pad_width

Pretty 格式 中单列内所有值的最大填充宽度。

output_format_pretty_max_rows

Pretty 格式 的最大行数限制。

output_format_pretty_max_value_width

在 Pretty 格式中显示的值的最大宽度。如果超过该宽度,将被截断。 值为 0 表示永不截断。

output_format_pretty_max_value_width_apply_for_single_value

仅当某个值不是块中的单个值时,才会将其截断 (参见 output_format_pretty_max_value_width 设置) 。否则将完整输出,这对 SHOW CREATE TABLE 查询很有用。

output_format_pretty_multiline_fields

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

output_format_pretty_named_tuples_as_json

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

output_format_pretty_row_numbers

在 Pretty 输出格式中,为每一行添加行号

output_format_pretty_single_large_number_tip_threshold

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

output_format_pretty_squash_consecutive_ms

写入前,最多等待指定毫秒数以接收下一个块,并在写入前将其合并到前一个块中。 这样既可避免过于频繁地输出过小的块,又仍能以流式方式显示数据。

output_format_pretty_squash_max_wait_ms

如果距离上一次输出已经超过指定的毫秒数,则将待处理的块以 Pretty 格式输出。

output_format_protobuf_nullables_with_google_wrappers

使用 Google wrappers 序列化 Nullable 列时,会将默认值序列化为空的 wrappers。关闭后,默认值和 NULL 值都不会被序列化

output_format_schema

用于保存自动生成 schema 的文件路径,格式为 Cap’n ProtoProtobuf

output_format_sql_insert_include_column_names

在 INSERT 查询中包含列名

output_format_sql_insert_max_batch_size

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

output_format_sql_insert_quote_names

使用 ’`’ 字符为列名加引号

output_format_sql_insert_table_name

输出 INSERT 查询中表的名称

output_format_sql_insert_use_replace

使用 REPLACE 语句,而非 INSERT

output_format_trim_fixed_string

在文本输出格式中,裁剪 FixedString 值末尾的零字节。例如,toFixedString('John', 8) 会输出为 John,而不是 John\0\0\0\0

output_format_tsv_crlf_end_of_line

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

output_format_values_escape_quote_with_quote

如果为 true,则将 ’ 转义为 ”;否则使用 &#39; 进行引用

output_format_write_statistics

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

precise_float_parsing

优先采用更精确 (但速度更慢) 的浮点数解析算法

schema_inference_hints

在无 schema 的格式中,用作 schema 推断提示的列名和类型列表。 示例: 查询:
desc format(JSONEachRow, '{"x" : 1, "y" : "String", "z" : "0.0.0.0" }') settings schema_inference_hints='x UInt8, z IPv4';
结果:
x   UInt8
y   Nullable(String)
z   IPv4
如果 schema_inference_hints 的格式不正确,或者存在拼写错误、数据类型错误等问题……整个 schema_inference_hints 都会被忽略。

schema_inference_make_columns_nullable

控制在 schema 推断 中是否将推断出的类型设为 Nullable。 Possible values:
  • 0 - 推断出的类型绝不会为 Nullable (这种情况下如何处理 null 值,可使用 input_format_null_as_default 控制) ,
  • 1 - 所有推断出的类型都会是 Nullable
  • 2 or auto - 仅当某列在 schema 推断 期间解析的样本中包含 NULL,或文件元数据中包含该列可空性的信息时,推断出的类型才会是 Nullable
  • 3 - 如果该 format 提供文件元数据中的可空性信息 (例如 Parquet) ,则推断出的类型可空性将与之保持一致;否则始终为 Nullable (例如 CSV) 。

schema_inference_make_json_columns_nullable

控制在 schema 推断 中将推断出的 JSON type 设为 Nullable。 如果此设置与 schema_inference_make_columns_nullable 同时启用,则推断出的 JSON type 将为 Nullable

schema_inference_mode

schema 推断 模式。‘default’ - 假定所有文件都具有相同的 schema,且可从任意文件推断出 schema;‘union’ - 文件可以具有不同的 schema,最终得到的 schema 应为所有文件 schema 的并集

show_create_query_identifier_quoting_rule

设置 SHOW CREATE 查询中标识符的引号使用规则

show_create_query_identifier_quoting_style

设置 SHOW CREATE 查询中标识符的引号样式

type_json_allow_duplicated_key_with_literal_and_nested_object

启用后,允许解析如下 JSON:某个键重复出现,但其中一个值为嵌套对象,例如 {"a" : 42, "a" : {"b" : 42}}

type_json_skip_duplicated_paths

启用后,在将 JSON object 解析为 JSON type 时,重复的 paths 会被忽略,只会插入第一个,而不会抛出异常

type_json_skip_invalid_typed_paths

启用后,对于带有类型化路径的 JSON type 列,如果某个字段的值无法转换为其声明的类型,则会跳过该字段,而不是抛出错误。被跳过的字段会视为缺失,并根据类型化路径的定义使用默认值/NULL 值。 此设置仅适用于 JSON type 列 (例如 JSON(a Int64, b String)) ,即某些特定路径已声明类型的情况。它不适用于常规的 JSON input formats,例如将数据插入普通类型化列时使用的 JSONEachRow Possible values:
  • 0 — 禁用 (类型不匹配时抛出错误) 。
  • 1 — 启用 (类型不匹配时跳过字段) 。

type_json_use_partial_match_to_skip_paths_by_regexp

启用后,在将 JSON object 解析为 JSON type 时,使用 SKIP REGEXP 指定的 regular expression 只要部分匹配即可跳过某个 path。禁用后,则必须完全匹配。

validate_experimental_and_suspicious_types_inside_nested_types

验证是否在 Array/Map/Tuple 等嵌套类型内部使用 Experimental 和可疑类型
最后修改于 2026年6月10日