> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 2021 年更新日志

> 2021 年更新日志

<div id="clickhouse-release-v2112-2021-12-15">
  ### ClickHouse 发布 v21.12 (2021-12-15) 。[演示文稿](https://presentations.clickhouse.com/2021-release-21.12/)、[视频](https://www.youtube.com/watch?v=6qi_S9CEqa4)
</div>

<Frame>
  <iframe src="https://www.youtube.com/embed/6qi_S9CEqa4" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
</Frame>

<div id="backward-incompatible-change">
  #### 向后不兼容变更
</div>

* *修复此前存在非预期行为的一项功能。* 不再允许对 Kafka/RabbitMQ/FileLog 进行直接 select。可通过设置 `stream_like_engine_allow_direct_select` 启用该功能。但如果存在已附加的 materialized view，即使启用了该设置，也仍不允许直接 select。对于 Kafka 和 RabbitMQ，即使允许直接 select，默认也不会提交消息。若要在直接 select 时启用提交，用户必须使用存储级设置 `kafka{rabbitmq}_commit_on_select=1` (默认值为 `0`) 。[#31053](https://github.com/ClickHouse/ClickHouse/pull/31053) ([Kseniia Sumarokova](https://github.com/kssenii)).
* *一个新函数的行为略有变化。* JSON\_VALUE 现在返回不带引号的字符串。关闭 [#27965](https://github.com/ClickHouse/ClickHouse/issues/27965)。[#31008](https://github.com/ClickHouse/ClickHouse/pull/31008) ([Kseniia Sumarokova](https://github.com/kssenii)).
* *设置重命名。* 为 TSV/CSV input format 添加自定义 NULL 表示支持。修复了 TSV/CSV/JSONCompactStringsEachRow/JSONStringsEachRow input format 中 Nullable(String) 的反序列化问题。相应地，将 `output_format_csv_null_representation` 和 `output_format_tsv_null_representation` 重命名为 `format_csv_null_representation` 和 `format_tsv_null_representation`。[#30497](https://github.com/ClickHouse/ClickHouse/pull/30497) ([Kruglov Pavel](https://github.com/Avogar)).
* *进一步弃用已经不再使用的代码。* 这仅与使用低于 20.6 的 ClickHouse 版本的用户有关。`ReplicatedMergeTree` 中的“leader 选举”机制已被移除，因为从 20.6 起已支持多个 leader。如果你正从更早版本升级，而某个旧版本副本恰好是 leader，那么 server 在升级后将无法启动。请先停止旧版本副本，使新版本能够启动。此后将无法再降级到低于 20.6 的版本。[#32140](https://github.com/ClickHouse/ClickHouse/pull/32140) ([tavplubix](https://github.com/tavplubix)).

<div id="new-feature">
  #### 新功能
</div>

* 在 clickhouse-keeper 中实现了更多 ZooKeeper Four Letter Words 命令：[https://zookeeper.apache.org/doc/r3.4.8/zookeeperAdmin.html#sc\&#95;zkCommands。\[#28981](https://zookeeper.apache.org/doc/r3.4.8/zookeeperAdmin.html#sc\&#95;zkCommands。\[#28981)]\([https://github.com/ClickHouse/ClickHouse/pull/28981](https://github.com/ClickHouse/ClickHouse/pull/28981)) ([JackyWoo](https://github.com/JackyWoo)) 。现在，`clickhouse-keeper` 的功能已完整。
* 新增对 `Bool` 数据类型的支持。[#31072](https://github.com/ClickHouse/ClickHouse/pull/31072) ([kevin wan](https://github.com/MaxWk)) 。
* 为 File、URL、HDFS 存储以及 `INSERT INTO` 表函数增加了对 `PARTITION BY` 的支持。关闭了 [#30273](https://github.com/ClickHouse/ClickHouse/issues/30273)。[#30690](https://github.com/ClickHouse/ClickHouse/pull/30690) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 新增 `CONSTRAINT ... ASSUME ...` (在 `INSERT` 时不进行检查) 。新增将查询转换为 CNF 的功能 ([https://github.com/ClickHouse/ClickHouse/issues/11749](https://github.com/ClickHouse/ClickHouse/issues/11749)) ，以便更方便地进行优化。新增基于约束的简单查询重写功能 (目前仅支持简单匹配，后续将改进为支持 \<,=,>...) 。新增了在可能的情况下以轻量列替换重量列的能力。[#18787](https://github.com/ClickHouse/ClickHouse/pull/18787) ([Nikita Vasilev](https://github.com/nikvas0)) 。
* 为 http/url 函数增加了 Basic 访问身份验证支持。[#31648](https://github.com/ClickHouse/ClickHouse/pull/31648) ([michael1589](https://github.com/michael1589)) 。
* 支持在 `WITH FILL` 修饰符的 `STEP` 子句中使用 `INTERVAL` 类型。[#30927](https://github.com/ClickHouse/ClickHouse/pull/30927) ([Anton Popov](https://github.com/CurtizJ)) 。
* 支持从多个文件并行读取，并在 `FROM INFILE` 子句中支持通配符。[#30135](https://github.com/ClickHouse/ClickHouse/pull/30135) ([Filatenkov Artur](https://github.com/FArthur-cmd)) 。
* 新增对 `Identifier` 表和数据库查询参数的支持。关闭 [#27226](https://github.com/ClickHouse/ClickHouse/issues/27226)。[#28668](https://github.com/ClickHouse/ClickHouse/pull/28668) ([Nikolay Degterinsky](https://github.com/evillique)) 。
* *TLDR：文本格式的完整性和一致性有了显著提升。* 重构了 `TSV`、`TSVRaw`、`CSV`、`JSONCompactEachRow` 和 `JSONCompactStringsEachRow` 格式，消除了重复代码，并为带有 `-WithNames` 和 `-WithNamesAndTypes` 后缀的格式添加了基础接口。新增格式 `CSVWithNamesAndTypes`、`TSVRawWithNames`、`TSVRawWithNamesAndTypes`、`JSONCompactEachRowWIthNames`、`JSONCompactStringsEachRowWIthNames`、`RowBinaryWithNames`。为 `TSVWithNamesAndTypes`、`TSVRaw(WithNames/WIthNamesAndTypes)`、`CSVWithNamesAndTypes`、`JSONCompactEachRow(WithNames/WIthNamesAndTypes)`、`JSONCompactStringsEachRow(WithNames/WIthNamesAndTypes)` 格式支持并行解析。为 `RowBinaryWithNamesAndTypes` 格式支持列映射和类型检查。新增设置 `input_format_with_types_use_header`，用于指定是否检查以 `<format_name>WIthNamesAndTypes` 格式写入的类型是否与表结构匹配。新增设置 `input_format_csv_empty_as_default`，并在 CSV format 中使用它来替代 `input_format_defaults_for_omitted_fields` (因为该设置不应控制 `csv_empty_as_default`) 。修复了设置 `input_format_defaults_for_omitted_fields` 的用法 (此前它仅被用作 `csv_empty_as_default`，但它实际上应控制对省略字段默认表达式的计算) 。修复了 `TSVRaw` format 中 `Nullable` 的输入/输出问题，使该格式与向 TSV 插入数据完全兼容。修复了在启用 `input_format_null_as_default` 时向 `LowCardinality(Nullable)` 插入 NULL 的问题 (此前插入的是默认值，而不是真正的 NULL) 。修复了 `JSONStringsEachRow`/`JSONCompactStringsEachRow` 格式中的字符串反序列化问题 (此前字符串只会解析到第一个 '\n' 或 '\t' 为止) 。新增了在 Template input format 中使用 `Raw` 转义规则的能力。为 `JSONCompactEachRow(WithNames/WIthNamesAndTypes)` input format 添加了诊断信息。修复了 `-WithNames` 格式在设置 `min_chunk_bytes_for_parallel_parsing` 小于单行字节数时的并行解析 bug。[#30178](https://github.com/ClickHouse/ClickHouse/pull/30178) ([Kruglov Pavel](https://github.com/Avogar))。现在允许在 `CustomSeparated` 输入/输出格式中输出/解析列名和类型。新增 `CustomSeparatedWithNames/WithNamesAndTypes` 格式，类似于 `TSVWithNames/WithNamesAndTypes`。[#31434](https://github.com/ClickHouse/ClickHouse/pull/31434) ([Kruglov Pavel](https://github.com/Avogar)).
* 支持阿里云 OSS 存储。[#31286](https://github.com/ClickHouse/ClickHouse/pull/31286) ([cfcz48](https://github.com/cfcz48)) 。
* 在配置文件中提供了全局线程池的所有设置。[#31285](https://github.com/ClickHouse/ClickHouse/pull/31285) ([Tomáš Hromada](https://github.com/gyfis)) 。
* 引入了窗口函数 `exponentialTimeDecayedSum`、`exponentialTimeDecayedMax`、`exponentialTimeDecayedCount` 和 `exponentialTimeDecayedAvg`，在较大的窗口上，它们比 `exponentialMovingAverage` 更高效。同时还支持了更多使用场景。[#29799](https://github.com/ClickHouse/ClickHouse/pull/29799) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 新增一个选项，可在将日志写入文件前使用 LZ4 进行压缩。关闭 [#23860](https://github.com/ClickHouse/ClickHouse/issues/23860)。[#29219](https://github.com/ClickHouse/ClickHouse/pull/29219) ([Nikolay Degterinsky](https://github.com/evillique)) 。
* 支持具有 CROSS JOIN 语义的 `JOIN ON 1 = 1`。此更改关闭了 [#25578](https://github.com/ClickHouse/ClickHouse/issues/25578)。[#25894](https://github.com/ClickHouse/ClickHouse/pull/25894) ([Vladimir C](https://github.com/vdimir)) 。
* 为 `Map` 类型添加 Map 组合器。- 将用于映射数组的原有 `sum-、min-、max- Map` 重命名为 `sum-、min-、max- MappedArrays`。[#24539](https://github.com/ClickHouse/ClickHouse/pull/24539) ([Ildus Kurbangaliev](https://github.com/ildus)).
* 使 HTTP 读取支持重试。关闭 [#29696](https://github.com/ClickHouse/ClickHouse/issues/29696)。[#29894](https://github.com/ClickHouse/ClickHouse/pull/29894) ([Kseniia Sumarokova](https://github.com/kssenii)) 。

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 支持在 ClickHouse 中使用 `WINDOW VIEW` 进行流处理。 [#8331](https://github.com/ClickHouse/ClickHouse/pull/8331) ([vxider](https://github.com/Vxider)).
* 不再支持在 `MaterializedMySQL` 中使用 Ordinary 数据库。 [#31292](https://github.com/ClickHouse/ClickHouse/pull/31292) ([Stig Bakken](https://github.com/stigsb)).
* 为 Log 家族实现 BACKUP 和 RESTORE 命令。该功能仍在开发中。 [#30688](https://github.com/ClickHouse/ClickHouse/pull/30688) ([Vitaly Baranov](https://github.com/vitlibar)).

<div id="performance-improvement">
  #### 性能改进
</div>

* 在使用 `s3` / `url` / `hdfs` 读取 `Parquet`、`ORC`、`Arrow` 格式时降低内存占用 (由设置 `input_format_allow_seeks` 控制，默认启用) 。同时新增设置 `remote_read_min_bytes_for_seek` 用于控制寻道。关闭 [#10461](https://github.com/ClickHouse/ClickHouse/issues/10461)。关闭 [#16857](https://github.com/ClickHouse/ClickHouse/issues/16857)。[#30936](https://github.com/ClickHouse/ClickHouse/pull/30936) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 为 JOIN ON 中的常量条件增加优化，参见 [#26928](https://github.com/ClickHouse/ClickHouse/issues/26928)。[#27021](https://github.com/ClickHouse/ClickHouse/pull/27021) ([Vladimir C](https://github.com/vdimir)).
* 支持除 `JSONEachRowWithProgress` 和 `PrettyCompactMonoBlock` 之外所有文本格式的并行格式化。[#31489](https://github.com/ClickHouse/ClickHouse/pull/31489) ([Kruglov Pavel](https://github.com/Avogar)).
* 加快对 Nullable 列执行 count 的速度。[#31806](https://github.com/ClickHouse/ClickHouse/pull/31806) ([Raúl Marín](https://github.com/Algunenano)).
* 加快 `avg` 和 `sumCount` 聚合函数的执行速度。[#31694](https://github.com/ClickHouse/ClickHouse/pull/31694) ([Raúl Marín](https://github.com/Algunenano)).
* 提升 JSON 和 XML 输出格式的性能。[#31673](https://github.com/ClickHouse/ClickHouse/pull/31673) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 提升将数据同步到块设备时的性能。此更改关闭了 [#31181](https://github.com/ClickHouse/ClickHouse/issues/31181)。[#31229](https://github.com/ClickHouse/ClickHouse/pull/31229) ([zhanglistar](https://github.com/zhanglistar)).
* 修复 `LiveView` 表中的查询性能问题。修复 [#30831](https://github.com/ClickHouse/ClickHouse/issues/30831)。[#31006](https://github.com/ClickHouse/ClickHouse/pull/31006) ([vzakaznikov](https://github.com/vzakaznikov)).
* 加快查询解析速度。[#31949](https://github.com/ClickHouse/ClickHouse/pull/31949) ([Raúl Marín](https://github.com/Algunenano)).
* 允许为普通/带标签的指标分别拆分 `GraphiteMergeTree` rollup 规则 (可选 `rule_type` 字段) 。[#25122](https://github.com/ClickHouse/ClickHouse/pull/25122) ([Michail Safronov](https://github.com/msaf1980)).
* 移除 `remote()` 的多余 `DESC TABLE` 请求 (在 `remote('127.1', system.one)` 这种情况下，即将标识符作为 db.table 而不是字符串时，之前会产生多余的 `DESC TABLE` 请求) 。[#32019](https://github.com/ClickHouse/ClickHouse/pull/32019) ([Azat Khuzhin](https://github.com/azat)).
* 在启用设置 `optimize_functions_to_subcolumns` 时，将函数 `tupleElement` 优化为读取子列。[#31261](https://github.com/ClickHouse/ClickHouse/pull/31261) ([Anton Popov](https://github.com/CurtizJ)).
* 在启用设置 `optimize_functions_to_subcolumns` 时，将函数 `mapContains` 优化为读取子列 `key`。[#31218](https://github.com/ClickHouse/ClickHouse/pull/31218) ([Anton Popov](https://github.com/CurtizJ)).
* 新增设置 `merge_tree_min_rows_for_concurrent_read_for_remote_filesystem` 和 `merge_tree_min_bytes_for_concurrent_read_for_remote_filesystem`。[#30970](https://github.com/ClickHouse/ClickHouse/pull/30970) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 在 `StorageMergeTree` 中跳过不同分区的变更。[#21326](https://github.com/ClickHouse/ClickHouse/pull/21326) ([Vladimir Chebotarev](https://github.com/excitoon)).

<div id="improvement">
  #### 改进
</div>

* 如果某个表或字典被其他表或字典依赖，则不允许删除该表或字典。[#30977](https://github.com/ClickHouse/ClickHouse/pull/30977) ([tavplubix](https://github.com/tavplubix)).
* 允许对聚合函数状态进行版本管理。现在我们可以对聚合函数状态的序列化格式进行向后兼容的修改。关闭 [#12552](https://github.com/ClickHouse/ClickHouse/issues/12552)。[#24820](https://github.com/ClickHouse/ClickHouse/pull/24820) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 支持 PostgreSQL 风格的 `ALTER MODIFY COLUMN` 语法。[#32003](https://github.com/ClickHouse/ClickHouse/pull/32003) ([SuperDJY](https://github.com/cmsxbc)) 。
* 为 `RangeHashedDictionary` 和 `ComplexKeyRangeHashedDictionary` 新增了对 `update_field` 的支持。[#32185](https://github.com/ClickHouse/ClickHouse/pull/32185) ([Maksim Kita](https://github.com/kitaisreal)) 。
* `murmurHash3_128` 和 `sipHash128` 函数现在支持接受任意数量的参数。此更改修复了 [#28774](https://github.com/ClickHouse/ClickHouse/issues/28774)。[#28965](https://github.com/ClickHouse/ClickHouse/pull/28965) ([小路](https://github.com/nicelulu)) 。
* 支持为 `HDFS` 存储设置默认表达式，并在源为列式存储时优化拉取。 [#32256](https://github.com/ClickHouse/ClickHouse/pull/32256) ([李扬](https://github.com/taiyang-li)).
* 改进 OpenTelemetry span 的操作名称。[#32234](https://github.com/ClickHouse/ClickHouse/pull/32234) ([Frank Chen](https://github.com/FrankChen021)) 。
* 对于输出格式 `JSONEachRow`，请使用 `Content-Type: application/x-ndjson` ([http://ndjson.org/)。\[#32223](http://ndjson.org/\)。\[#32223)]\([https://github.com/ClickHouse/ClickHouse/pull/32223](https://github.com/ClickHouse/ClickHouse/pull/32223)) ([Dmitriy Dorofeev](https://github.com/deem0n)) 。
* 改进了在 Template/CustomSeparated 格式中使用带引号转义规则时跳过未知字段的功能。此前只能跳过带引号的字符串，现在可以跳过任意类型的值。[#32204](https://github.com/ClickHouse/ClickHouse/pull/32204) ([Kruglov Pavel](https://github.com/Avogar)).
* 现在，`clickhouse-keeper` 在包含重复的 ID 或端点时，将拒绝启动或应用配置更改。修复了 [#31339](https://github.com/ClickHouse/ClickHouse/issues/31339)。[#32121](https://github.com/ClickHouse/ClickHouse/pull/32121) ([alesapin](https://github.com/alesapin)).
* 为 URL 引擎发出的 HTTP 请求设置 Content-Type。[#32113](https://github.com/ClickHouse/ClickHouse/pull/32113) ([Frank Chen](https://github.com/FrankChen021)) 。
* 如果启用了 `output_format_json_array_of_rows`，则 `JSONEachRow` format 的 Content-Type 将返回为 'application/json'。 [#32112](https://github.com/ClickHouse/ClickHouse/pull/32112) ([Frank Chen](https://github.com/FrankChen021)).
* 允许在解析 `Float32`/`Float64` 值时，接受前置的 `+` 号。[#32079](https://github.com/ClickHouse/ClickHouse/pull/32079) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 允许用户为 `DiskHDFS` 和 `StorageHDFS` 配置 `hdfs_replication` 参数。关闭 [#32039](https://github.com/ClickHouse/ClickHouse/issues/32039)。[#32049](https://github.com/ClickHouse/ClickHouse/pull/32049) ([leosunli](https://github.com/leosunli)) 。
* 在 OpenTelemetry span 日志中新增了 ClickHouse `exception` 和 `exception_code` 字段。[#32040](https://github.com/ClickHouse/ClickHouse/pull/32040) ([Frank Chen](https://github.com/FrankChen021)) 。
* 改进 OpenTelemetry span 日志耗时问题——如果查询发生异常，其在查询级别的耗时会显示为零。[#32038](https://github.com/ClickHouse/ClickHouse/pull/32038) ([Frank Chen](https://github.com/FrankChen021)) 。
* 修复了无法创建 `LowCardinality(Int256)` 的问题。[#31832](https://github.com/ClickHouse/ClickHouse/pull/31832) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在 engine/partition\_by 不一致时，重新创建 `system.*_log` 表。[#31824](https://github.com/ClickHouse/ClickHouse/pull/31824) ([Azat Khuzhin](https://github.com/azat)) 。
* `MaterializedMySQL`：修复了表名为 'table' 的表导致的问题。[#31781](https://github.com/ClickHouse/ClickHouse/pull/31781) ([Håvard Kvålen](https://github.com/havardk)) 。
* ClickHouse 字典源：支持预定义连接。已关闭 [#31705](https://github.com/ClickHouse/ClickHouse/issues/31705)。[#31749](https://github.com/ClickHouse/ClickHouse/pull/31749) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 允许在 Kafka 和 RabbitMQ 引擎中使用预定义的连接配置 (方式与其他集成表引擎相同) 。[#31691](https://github.com/ClickHouse/ClickHouse/pull/31691) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 在 clickhouse-client 中浏览历史记录时始终重新显示提示符。这样在处理屏幕上显示不下的超长查询时会更方便。[#31675](https://github.com/ClickHouse/ClickHouse/pull/31675) ([alexey-milovidov](https://github.com/alexey-milovidov)) (作者：Amos Bird) 。
* 添加用于在历史记录中导航的按键绑定 (而不是按行/历史记录导航) 。[#31641](https://github.com/ClickHouse/ClickHouse/pull/31641) ([Azat Khuzhin](https://github.com/azat)) 。
* 改进了 `max_execution_time` 检查。修复了某些情况下未进行 timeout 检查、导致查询可能运行时间过长的问题。[#31636](https://github.com/ClickHouse/ClickHouse/pull/31636) ([Raúl Marín](https://github.com/Algunenano)) 。
* 当因密码哈希错误而无法加载 `users.xml` 时，会显示更清晰的异常信息。此更改修复了 [#24126](https://github.com/ClickHouse/ClickHouse/issues/24126)。[#31557](https://github.com/ClickHouse/ClickHouse/pull/31557) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 如果这些宏未在配置中定义，则在展开 `ReplicatedMergeTree` 参数中的宏时，使用 `Replicated` 数据库参数中的分片名称和副本名称。关闭了 [#31471](https://github.com/ClickHouse/ClickHouse/issues/31471)。[#31488](https://github.com/ClickHouse/ClickHouse/pull/31488) ([tavplubix](https://github.com/tavplubix)) 。
* 改进了对 `min/max/count` 投影的分析。现在，启用 `allow_experimental_projection_optimization` 后，虚拟 `min/max/count` 投影可与分区键中的列一起使用。[#31474](https://github.com/ClickHouse/ClickHouse/pull/31474) ([Amos Bird](https://github.com/amosbird)) 。
* 为 `clickhouse-local` 增加 `--pager` 支持。[#31457](https://github.com/ClickHouse/ClickHouse/pull/31457) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了交互式查询编辑期间等待编辑器的问题 (`waitpid()` 在收到 `SIGWINCH` 时会返回 -1，且 `EDITOR` 与 `clickhouse-local`/`clickhouse-client` 可以并发运行) 。[#31456](https://github.com/ClickHouse/ClickHouse/pull/31456) ([Azat Khuzhin](https://github.com/azat)) 。
* 如果在 `JSONCompactStrings(EachRow)` format 中某个 field 后面存在垃圾数据，则抛出异常。[#31455](https://github.com/ClickHouse/ClickHouse/pull/31455) ([Kruglov Pavel](https://github.com/Avogar)) 。
* `http_send_timeout` 和 `http_receive_timeout` 设置的默认值已由 1800 (30 分钟) 调整为 180 (3 分钟) 。[#31450](https://github.com/ClickHouse/ClickHouse/pull/31450) ([tavplubix](https://github.com/tavplubix)) 。
* `MaterializedMySQL` 现已支持处理 `CREATE TABLE ... LIKE ...` DDL 查询。[#31410](https://github.com/ClickHouse/ClickHouse/pull/31410) ([Stig Bakken](https://github.com/stigsb)) 。
* 对系统表执行 `show create table` 时，返回人工构造的建表语句。[#31391](https://github.com/ClickHouse/ClickHouse/pull/31391) ([SuperDJY](https://github.com/cmsxbc)).
* 此前只有 `numbers` 表函数会显示进度。现在 `numbers_mt` 也会显示进度。[#31318](https://github.com/ClickHouse/ClickHouse/pull/31318) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 现在会使用用户的初始 roles 来查找行策略，参见 [#31080](https://github.com/ClickHouse/ClickHouse/issues/31080)。[#31262](https://github.com/ClickHouse/ClickHouse/pull/31262) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 如果修改了某个已废弃的设置，则在 `system.warnings` 中显示警告。 [#31252](https://github.com/ClickHouse/ClickHouse/pull/31252) ([tavplubix](https://github.com/tavplubix)).
* 改进了 `MergeTree` 中后台清理任务的退避机制。设置 `merge_tree_clear_old_temporary_directories_interval_seconds` 和 `merge_tree_clear_old_parts_interval_seconds` 已从用户级设置移至 MergeTree 设置。[#31180](https://github.com/ClickHouse/ClickHouse/pull/31180) ([tavplubix](https://github.com/tavplubix)).
* 现在每个副本只会向客户端发送 profile events 计数器的增量信息。[#31155](https://github.com/ClickHouse/ClickHouse/pull/31155) ([Dmitry Novik](https://github.com/novikd)) 。这让 `clickhouse-client` 中的 `--hardware_utilization` 选项终于可以正常使用。
* 默认在 clickhouse-client 中启用多行编辑功能。此更改修复了 [#31121](https://github.com/ClickHouse/ClickHouse/issues/31121)。[#31123](https://github.com/ClickHouse/ClickHouse/pull/31123) ([Amos Bird](https://github.com/amosbird)) 。
* 针对 `ALTER` 查询的函数名称规范化。这有助于避免在创建带有索引/投影的表，以及通过 `ALTER` 命令添加索引/投影时出现元数据不一致。这是 [https://github.com/ClickHouse/ClickHouse/pull/20174](https://github.com/ClickHouse/ClickHouse/pull/20174) 的后续 PR。由于没有相关的 bug 报告，而且这种场景比较少见，因此将其归类为改进。[#31095](https://github.com/ClickHouse/ClickHouse/pull/31095) ([Amos Bird](https://github.com/amosbird)) 。
* 支持在 `RENAME DATABASE`/`TABLE`/`DICTIONARY` 查询中使用 `IF EXISTS` 修饰符。如果使用该修饰符，当要重命名的 DATABASE/TABLE/DICTIONARY 不存在时，不会报错。[#31081](https://github.com/ClickHouse/ClickHouse/pull/31081) ([victorgao](https://github.com/kafka1991)).
* 当分区被删除时，取消垂直合并。这是对 [https://github.com/ClickHouse/ClickHouse/pull/25684](https://github.com/ClickHouse/ClickHouse/pull/25684) 和 [https://github.com/ClickHouse/ClickHouse/pull/30996](https://github.com/ClickHouse/ClickHouse/pull/30996) 的后续跟进。[#31057](https://github.com/ClickHouse/ClickHouse/pull/31057) ([Amos Bird](https://github.com/amosbird)) 。
* ClickHouse 字典源中的本地会话将不再把事件发送到会话日志。这修复了关闭时可能出现的死锁 (tsan 警报) 。此外，此 PR 还修复了偶发不稳定的 `test_dictionaries_dependency_xml/`。[#31013](https://github.com/ClickHouse/ClickHouse/pull/31013) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 减少了 ALTER 命令中的锁定。[#31010](https://github.com/ClickHouse/ClickHouse/pull/31010) ([Amos Bird](https://github.com/amosbird)) 。
* 修复 clickhouse-local 交互模式下的 `--verbose` 选项，并支持将日志写入文件。[#30881](https://github.com/ClickHouse/ClickHouse/pull/30881) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 在 `clickhouse-client` 中新增了 `\l`、`\d`、`\c` 命令，类似于 MySQL 和 PostgreSQL 的对应命令。[#30876](https://github.com/ClickHouse/ClickHouse/pull/30876) ([Pavel Medvedev](https://github.com/pmed)) 。
* 对于 clickhouse-local 或 clickhouse-client：如果使用了 `--interactive` 选项，同时又指定了 `--query` 或 `--queries-file`，则会先像在非交互模式下一样执行这些内容，然后再启动交互模式。[#30851](https://github.com/ClickHouse/ClickHouse/pull/30851) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复可能出现的 "X 的本地 parts 集合与 ZooKeeper 中的 parts 集合看起来不一致" 错误 (如果在从 ZooKeeper 中删除 znode 时 DROP 失败) 。[#30826](https://github.com/ClickHouse/ClickHouse/pull/30826) ([Azat Khuzhin](https://github.com/azat)) 。
* Avro 格式现已支持 Kafka。新增设置 `output_format_avro_rows_in_file`。[#30351](https://github.com/ClickHouse/ClickHouse/pull/30351) ([Ilya Golshtein](https://github.com/ilejn)) 。
* 允许为一个 `MaterializedPostgreSQL` 数据库指定一个或多个 PostgreSQL schema。关闭了 [#28901](https://github.com/ClickHouse/ClickHouse/issues/28901)。关闭了 [#29324](https://github.com/ClickHouse/ClickHouse/issues/29324)。[#28933](https://github.com/ClickHouse/ClickHouse/pull/28933) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 将 clickhouse-keeper 内部通信的默认端口由 44444 改为 9234。修复了 [#30879](https://github.com/ClickHouse/ClickHouse/issues/30879)。[#31799](https://github.com/ClickHouse/ClickHouse/pull/31799) ([alesapin](https://github.com/alesapin)) 。
* 实现了支持 Decimal 参数的 `transform` 函数。[#31839](https://github.com/ClickHouse/ClickHouse/pull/31839) ([李帅](https://github.com/loneylee)) 。
* 通过额外检查 hdfs url 结构，修复了 hdfs url 错误时调试版 server 的中止问题，以及发布版 server 中的 `DB::Exception: std::out_of_range: basic_string` 错误。[#31042](https://github.com/ClickHouse/ClickHouse/pull/31042) ([Kruglov Pavel](https://github.com/Avogar)).
* 修复 `hdfs` 表函数/引擎中可能触发的断言，并添加测试。[#31036](https://github.com/ClickHouse/ClickHouse/pull/31036) ([Kruglov Pavel](https://github.com/Avogar)) 。

<div id="bug-fixes">
  #### 问题修复
</div>

* 修复了在启用位置参数时，GROUP BY / ORDER BY / LIMIT BY 别名相关的问题。关闭 [#31173](https://github.com/ClickHouse/ClickHouse/issues/31173)。[#31741](https://github.com/ClickHouse/ClickHouse/pull/31741) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复 `Buffer` 表引擎与 `Map` 类型配合使用时的问题。修复了 [#30546](https://github.com/ClickHouse/ClickHouse/issues/30546)。[#31742](https://github.com/ClickHouse/ClickHouse/pull/31742) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了在启用 `use_uncompressed_cache` 时读取 `MergeTree` 表出现的问题。[#31826](https://github.com/ClickHouse/ClickHouse/pull/31826) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了在启用设置 `empty_result_for_aggregation_by_empty_set` 时，无需执行任何操作的变更卡住的问题。[#32358](https://github.com/ClickHouse/ClickHouse/pull/32358) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复写入 protobuf 时跳过列的问题。此 PR 修复了 [#31160](https://github.com/ClickHouse/ClickHouse/issues/31160)，另请参见评论 [#31160](https://github.com/ClickHouse/ClickHouse/issues/31160)#issuecomment-980595318。[#31988](https://github.com/ClickHouse/ClickHouse/pull/31988) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了在移除子查询中不必要的列时出现的问题。如果查询中存在不带 group by 的聚合函数，即使该函数看起来不需要，也不要将其移除。[#32289](https://github.com/ClickHouse/ClickHouse/pull/32289) ([dongyifeng](https://github.com/dyf6372)).
* Quota 限额尚未达到，却仍被判定为超限。此 PR 修复了 [#31174](https://github.com/ClickHouse/ClickHouse/issues/31174)。[#31337](https://github.com/ClickHouse/ClickHouse/pull/31337) ([sunny](https://github.com/sunny19930321)) 。
* 修复了使用部分撤销授权时 SHOW GRANTS 的问题。此 PR 修复了 [#31138](https://github.com/ClickHouse/ClickHouse/issues/31138)。[#31249](https://github.com/ClickHouse/ClickHouse/pull/31249) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 当 ClickHouse 在带有 cgroup 限制的容器中运行时，内存容量估算有误。[#31157](https://github.com/ClickHouse/ClickHouse/pull/31157) ([Pavel Medvedev](https://github.com/pmed)) 。
* 修复了这样一种情况下的 `ALTER ... MATERIALIZE COLUMN ...` 查询问题：默认表达式的数据类型与列的数据类型不一致。[#32348](https://github.com/ClickHouse/ClickHouse/pull/32348) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了聚合函数 `avgWeighted` 在使用 `Decimal` 参数时因 SIGFPE 导致的崩溃问题。修复 [#32053](https://github.com/ClickHouse/ClickHouse/issues/32053)。[#32303](https://github.com/ClickHouse/ClickHouse/pull/32303) ([tavplubix](https://github.com/tavplubix)).
* 如果 `Dictionary` 表引用了同名的 XML 字典，服务器启动时可能会因 `Cannot attach 1 tables due to cyclic dependencies` 错误而启动失败；此问题已修复。修复了 [#31315](https://github.com/ClickHouse/ClickHouse/issues/31315)。[#32288](https://github.com/ClickHouse/ClickHouse/pull/32288) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了在 `Quoted` 转义规则下，对 `Nullable(Float)` 进行 NaN 反序列化时出现的解析错误。[#32190](https://github.com/ClickHouse/ClickHouse/pull/32190) ([Kruglov Pavel](https://github.com/Avogar)).
* XML 字典：建表查询中使用的标识符，在升级到较新版本时可限定为 `default_database`。关闭了 [#31963](https://github.com/ClickHouse/ClickHouse/issues/31963)。[#32187](https://github.com/ClickHouse/ClickHouse/pull/32187) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 如果某些副本禁用了设置 `replicated_can_become_leader`，那么在使用 quorum 进行插入时，活跃副本数量的判断可能会不正确。现已修复。[#32157](https://github.com/ClickHouse/ClickHouse/pull/32157) ([tavplubix](https://github.com/tavplubix)).
* 字典：修复了在自定义数据库查询中 `{condition}` 不生效的情况。[#32117](https://github.com/ClickHouse/ClickHouse/pull/32117) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了启用 `cast_keep_nullable` 时对 `Nullable` 执行 `CAST` 的问题 (此前会报 `PARAMETER_OUT_OF_BOUND` 错误，例如 `toUInt32OrDefault(toNullable(toUInt32(1)))`) 。[#32080](https://github.com/ClickHouse/ClickHouse/pull/32080) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了某些少见情况下 Join Storage 的 CREATE TABLE 问题。关闭 [#31680](https://github.com/ClickHouse/ClickHouse/issues/31680)。[#32066](https://github.com/ClickHouse/ClickHouse/pull/32066) ([SuperDJY](https://github.com/cmsxbc)) 。
* 修复了分离分片时出现的 `Directory ... already exists and is not empty` 错误。[#32063](https://github.com/ClickHouse/ClickHouse/pull/32063) ([tavplubix](https://github.com/tavplubix)).
* `MaterializedMySQL` (实验性功能) ：修复了对来自 MySQL 的 `DECIMAL` 数据的错误解析。[#31990](https://github.com/ClickHouse/ClickHouse/pull/31990) ([Håvard Kvålen](https://github.com/havardk)) 。
* `FileLog` (Experimental 功能) 引擎在创建表失败时仍会创建不必要的元数据目录。修复 [#31962](https://github.com/ClickHouse/ClickHouse/issues/31962)。[#31967](https://github.com/ClickHouse/ClickHouse/pull/31967) ([flynn](https://github.com/ucasfl)).
* 如果某个 part 在所有副本上都已丢失，并且同一分区中也没有其他 parts，某些 `GET_PART` 条目可能会一直卡在复制队列中。该问题已在分区键仅包含整数类型的列或 `Date[Time]` 的情况下修复。修复 [#31485](https://github.com/ClickHouse/ClickHouse/issues/31485)。[#31887](https://github.com/ClickHouse/ClickHouse/pull/31887) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了函数 `empty` 和 `notEmpty` 在参数为 `UUID` 类型时的问题。修复 [#31819](https://github.com/ClickHouse/ClickHouse/issues/31819)。[#31883](https://github.com/ClickHouse/ClickHouse/pull/31883) ([Anton Popov](https://github.com/CurtizJ)).
* 在构造 `KeeperTCPHandler` 时，将配置路径从 `keeper_server.session_timeout_ms` 更改为 `keeper_server.coordination_settings.session_timeout_ms`。`operation_timeout` 也同样如此。[#31859](https://github.com/ClickHouse/ClickHouse/pull/31859) ([JackyWoo](https://github.com/JackyWoo)).
* 修复了在使用 Nullable 主键时，对 Nullable 类型进行无效类型转换的问题。 (Nullable 主键是一项不推荐使用的功能——请不要使用。) 此修复对应 [#31075](https://github.com/ClickHouse/ClickHouse/issues/31075)。[#31823](https://github.com/ClickHouse/ClickHouse/pull/31823) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了 SQL 中递归 UDF 引发的崩溃问题。关闭 [#30856](https://github.com/ClickHouse/ClickHouse/issues/30856)。[#31820](https://github.com/ClickHouse/ClickHouse/pull/31820) ([Maksim Kita](https://github.com/kitaisreal)).
* 修复了在字典属性类型为 `Nullable` 时，带类型的 `dictGet` 函数导致崩溃的问题。修复 [#30980](https://github.com/ClickHouse/ClickHouse/issues/30980)。[#31800](https://github.com/ClickHouse/ClickHouse/pull/31800) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了在某些 ODBC 驱动程序中，ODBC 查询结果为空时发生崩溃的问题。关闭 [#31465](https://github.com/ClickHouse/ClickHouse/issues/31465)。[#31766](https://github.com/ClickHouse/ClickHouse/pull/31766) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了禁用查询分析器的问题 (在 `query_profiler_real_time_period_ns>0`/`query_profiler_cpu_time_period_ns>0` 的情况下，即使查询已结束，查询分析器仍可能保持启用状态) 。[#31740](https://github.com/ClickHouse/ClickHouse/pull/31740) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了并发执行 `ATTACH PARTITION` 查询时极少数情况下发生的段错误。[#31738](https://github.com/ClickHouse/ClickHouse/pull/31738) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了 JSONEachRowWithProgress 输出格式中的竞争条件问题：当输出中混合了数据和带进度信息的行时会出现该问题。 [#31736](https://github.com/ClickHouse/ClickHouse/pull/31736) ([Kruglov Pavel](https://github.com/Avogar)).
* 修复了这样一个问题：执行 `ON CLUSTER` 查询时，如果指定的集群名称与 `Replicated` 数据库名称相同，会报 `there are no such cluster here` 错误。[#31723](https://github.com/ClickHouse/ClickHouse/pull/31723) ([tavplubix](https://github.com/tavplubix)).
* 修复了在某些情况下将 `decrypt` 函数应用于 Nullable 列时出现的异常。此修复关闭了 [#31662](https://github.com/ClickHouse/ClickHouse/issues/31662)。此修复关闭了 [#31426](https://github.com/ClickHouse/ClickHouse/issues/31426)。[#31707](https://github.com/ClickHouse/ClickHouse/pull/31707) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了字符串包含 UTF-8 字符时 `ngrams` 函数的问题。[#31706](https://github.com/ClickHouse/ClickHouse/pull/31706) ([yandd](https://github.com/yandd)).
* Settings `input_format_allow_errors_num` 和 `input_format_allow_errors_ratio` 在解析 domain 类型 (如 `IPv4`) 时未生效，现已修复。修复 [#31686](https://github.com/ClickHouse/ClickHouse/issues/31686)。[#31697](https://github.com/ClickHouse/ClickHouse/pull/31697) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了 `MATERIALIZE COLUMN` 中的空指针异常。[#31679](https://github.com/ClickHouse/ClickHouse/pull/31679) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* `RENAME TABLE` 查询在尝试重命名 `Ordinary` 数据库中的 DDL 字典时存在问题，现已修复。[#31638](https://github.com/ClickHouse/ClickHouse/pull/31638) ([tavplubix](https://github.com/tavplubix)) 。
* 按预期方式实现 `sparkbar` 聚合函数，参见：[#26175](https://github.com/ClickHouse/ClickHouse/issues/26175)#issuecomment-960353867、[评论](https://github.com/ClickHouse/ClickHouse/issues/26175#issuecomment-961155065)。[#31624](https://github.com/ClickHouse/ClickHouse/pull/31624) ([小路](https://github.com/nicelulu))。
* 修复了这样一个问题：当只有列名包含无效的 UTF-8 序列时，生成的 JSON 会无效。[#31534](https://github.com/ClickHouse/ClickHouse/pull/31534) ([Kevin Michel](https://github.com/kmichel-aiven)) 。
* 在此优化中的该缺陷修复之前，请禁用 `partial_merge_join_left_table_buffer_bytes`。参见 [#31009](https://github.com/ClickHouse/ClickHouse/issues/31009))。移除冗余选项 `partial_merge_join_optimizations`。[#31528](https://github.com/ClickHouse/ClickHouse/pull/31528) ([Vladimir C](https://github.com/vdimir))。
* 修复短 `INSERT SELECT` 查询的进度显示问题。[#31510](https://github.com/ClickHouse/ClickHouse/pull/31510) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了 `group by` 与位置参数相关的错误行为。关闭 [#31280](https://github.com/ClickHouse/ClickHouse/issues/31280)#issuecomment-968696186。 [#31420](https://github.com/ClickHouse/ClickHouse/pull/31420) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 修复 S3 的 STS 凭证提供程序中的 `nullptr` 问题。[#31409](https://github.com/ClickHouse/ClickHouse/pull/31409) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 从索引分析中移除 `notLike` 函数，因为它有误。[#31169](https://github.com/ClickHouse/ClickHouse/pull/31169) ([sundyli](https://github.com/sundy-li)).
* 修复了 Keeper 中的一个 bug：当部分协调日志丢失，且快照比最新日志更新时，可能导致无法启动。[#31150](https://github.com/ClickHouse/ClickHouse/pull/31150) ([alesapin](https://github.com/alesapin)).
* 在本地 join 中重写右侧的分布式表。修复了 [#25809](https://github.com/ClickHouse/ClickHouse/issues/25809)。[#31105](https://github.com/ClickHouse/ClickHouse/pull/31105) ([abel-cheng](https://github.com/abel-cheng)).
* 修复了带别名和 where 条件的 `Merge` 表此前完全无法工作的问题。关闭 [#28802](https://github.com/ClickHouse/ClickHouse/issues/28802)。[#31044](https://github.com/ClickHouse/ClickHouse/pull/31044) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 修复了带引号标识符的 JSON\_VALUE/JSON\_QUERY。这样一来，json path 中就可以包含空格。关闭了 [#30971](https://github.com/ClickHouse/ClickHouse/issues/30971)。[#31003](https://github.com/ClickHouse/ClickHouse/pull/31003) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 在非面向行的格式中使用 `formatRow` 函数会导致段错误。现已禁止将此函数用于此类格式 (因为这样做没有意义) 。[#31001](https://github.com/ClickHouse/ClickHouse/pull/31001) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 修复了一个 bug：删除 materialized view 后，如果再执行 select 查询，查询会失败。见 [#30691](https://github.com/ClickHouse/ClickHouse/issues/30691)。[#30997](https://github.com/ClickHouse/ClickHouse/pull/30997) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 执行 ATTACH PARTITION ... FROM 和 MOVE PARTITION ... 时，跳过 `max_partition_size_to_drop` 检查。[#30995](https://github.com/ClickHouse/ClickHouse/pull/30995) ([Amr Alaa](https://github.com/amralaa-MSFT)) 。
* 修复了 `INTERSECT` 和 `EXCEPT` 运算符的一些边界情况。解决了 [#30803](https://github.com/ClickHouse/ClickHouse/issues/30803)。[#30965](https://github.com/ClickHouse/ClickHouse/pull/30965) ([Kseniia Sumarokova](https://github.com/kssenii)) 。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 修复非 x86 构建中的错误过滤结果。此更改关闭了 [#31417](https://github.com/ClickHouse/ClickHouse/issues/31417)。此更改关闭了 [#31524](https://github.com/ClickHouse/ClickHouse/issues/31524)。[#31574](https://github.com/ClickHouse/ClickHouse/pull/31574) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 使 ClickHouse 构建完全可复现 (在不同机器上生成的二进制文件字节级一致) 。此更改关闭了 [#22113](https://github.com/ClickHouse/ClickHouse/issues/22113)。[#31899](https://github.com/ClickHouse/ClickHouse/pull/31899) ([alexey-milovidov](https://github.com/alexey-milovidov)). 为实现可复现构建，从二进制文件中移除构建目录的 filesystem 路径。这是 [#22113](https://github.com/ClickHouse/ClickHouse/issues/22113) 所必需的。[#31838](https://github.com/ClickHouse/ClickHouse/pull/31838) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 对 `zlib-ng`、`cassandra`、`mariadb-connector-c` 以及 `xz`、`re2`、`sentry`、`gsasl`、`arrow`、`protobuf` 使用我们自己的 CMakeLists。这是 [#20151](https://github.com/ClickHouse/ClickHouse/issues/20151) 所必需的。也是 [#9226](https://github.com/ClickHouse/ClickHouse/issues/9226) 的一部分。这是朝着清理构建系统中恼人杂项迈出的一小步。[#30599](https://github.com/ClickHouse/ClickHouse/pull/30599) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* Hermetic 构建：使用固定版本的 libc，并确保构建期间不会使用宿主操作系统中的任何源文件或二进制文件。此更改关闭了 [#27133](https://github.com/ClickHouse/ClickHouse/issues/27133)。此更改关闭了 [#21435](https://github.com/ClickHouse/ClickHouse/issues/21435)。此更改关闭了 [#30462](https://github.com/ClickHouse/ClickHouse/issues/30462)。[#30011](https://github.com/ClickHouse/ClickHouse/pull/30011) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 添加函数 `getFuzzerData()`，以便更方便地对特定函数进行模糊测试。此更改关闭了 [#23227](https://github.com/ClickHouse/ClickHouse/issues/23227)。[#27526](https://github.com/ClickHouse/ClickHouse/pull/27526) ([Alexey Boykov](https://github.com/mathalex)).
* 更合理地配置 Docker 内的能力。[#31802](https://github.com/ClickHouse/ClickHouse/pull/31802) ([Constantine Peresypkin](https://github.com/pkit)).
* 启用 clang `-fstrict-vtable-pointers`、`-fwhole-program-vtables` 编译选项。[#20151](https://github.com/ClickHouse/ClickHouse/pull/20151) ([Maksim Kita](https://github.com/kitaisreal)).
* 避免在为 FreeBSD 进行交叉编译时下载工具链 tarball。[#31672](https://github.com/ClickHouse/ClickHouse/pull/31672) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 初步支持 risc-v。有关注意事项和已验证的构建命令，请参见 development/build-cross-riscv。[#31309](https://github.com/ClickHouse/ClickHouse/pull/31309) ([Vladimir Smirnov](https://github.com/Civil)).
* 支持在 arm 机器上使用参数 "-DENABLE\_TESTS=OFF" 进行编译。[#31007](https://github.com/ClickHouse/ClickHouse/pull/31007) ([zhanghuajie](https://github.com/zhanghuajieHIT)).

<div id="clickhouse-release-v2111-2021-11-09">
  ### ClickHouse 发布 v21.11，2021-11-09。 [演示文稿](https://presentations.clickhouse.com/2021-release-21.11/)，[视频](https://www.youtube.com/watch?v=xb64zoPYvqQ)
</div>

<Frame>
  <iframe src="https://www.youtube.com/embed/xb64zoPYvqQ" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
</Frame>

<div id="backward-incompatible-change">
  #### 向后不兼容变更
</div>

* 调整了 SQL/JSON 函数中 `json_path` 和 `json` 参数的顺序 (以与标准保持一致) 。关闭 [#30449](https://github.com/ClickHouse/ClickHouse/issues/30449)。[#30474](https://github.com/ClickHouse/ClickHouse/pull/30474) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 移除了 `MergeTree` 表设置 `write_final_mark``。`该设置将始终为 `true`。[#30455](https://github.com/ClickHouse/ClickHouse/pull/30455) ([Kseniia Sumarokova](https://github.com/kssenii)). 无需执行任何操作，所有表都与新版本兼容。
* 函数 `bayesAB` 已移除。如需恢复该函数，欢迎提交更新后的实现。关闭 [#26233](https://github.com/ClickHouse/ClickHouse/issues/26233)。[#29934](https://github.com/ClickHouse/ClickHouse/pull/29934) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 仅当你已经开始使用 Experimental `clickhouse-keeper` 支持时，此项才相关。现在，ClickHouse Keeper 的 snapshots 默认使用 `ZSTD` codec 压缩，而不再使用自定义的 ClickHouse LZ4 块压缩。可通过 `compress_snapshots_with_zstd_format` 协调设置关闭此行为 (所有 quorum 副本上的值必须一致) 。这种不兼容情况非常少见，且仅可能在新节点向旧节点发送 snapshot 时发生 (例如在恢复场景中) ，因为旧节点无法读取 ZSTD 格式的 snapshots。[#29417](https://github.com/ClickHouse/ClickHouse/pull/29417) ([alesapin](https://github.com/alesapin)).

<div id="new-feature">
  #### 新功能
</div>

* 新的异步 `INSERT` 模式支持将插入的数据累积起来，并在后台以单个批次写入存储。在客户端，对于数据内联在查询中或放在单独缓冲区中的 `INSERT` 查询 (例如通过 HTTP protocol 发送的 `INSERT` 查询) ，可通过设置 `async_insert` 启用该模式。如果 `wait_for_async_insert` 为 true (默认值) ，客户端会等待直到数据刷新到表中。在服务端，该功能由 `async_insert_threads`、`async_insert_max_data_size` 和 `async_insert_busy_timeout_ms` 这些设置控制。实现见 [#18282](https://github.com/ClickHouse/ClickHouse/issues/18282)。[#27537](https://github.com/ClickHouse/ClickHouse/pull/27537) ([Anton Popov](https://github.com/CurtizJ))。[#20557](https://github.com/ClickHouse/ClickHouse/pull/20557) ([Ivan](https://github.com/abyss7))。性能说明：使用异步插入时，每秒最多可执行约 10 000 条独立的 `INSERT` 查询；因此，如果你希望达到每秒插入数百万行的性能，仍建议按批次插入。
* 为 `clickhouse-local` 添加交互式模式。这样，你只需运行 `clickhouse-local`，即可获得一个无需连接到服务器的 ClickHouse 命令行界面，并处理来自文件和外部数据源的数据。同时，将 `clickhouse-client` 和 `clickhouse-local` 的代码合并。关闭了 [#7203](https://github.com/ClickHouse/ClickHouse/issues/7203)。关闭了 [#25516](https://github.com/ClickHouse/ClickHouse/issues/25516)。关闭了 [#22401](https://github.com/ClickHouse/ClickHouse/issues/22401)。[#26231](https://github.com/ClickHouse/ClickHouse/pull/26231) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 新增了对可执行 (可脚本化) 用户自定义函数的支持。这类 UDFs 可以用任何编程语言编写。[#28803](https://github.com/ClickHouse/ClickHouse/pull/28803) ([Maksim Kita](https://github.com/kitaisreal)).
* 允许为外部数据源使用预定义连接。这样在使用外部数据源时，就无需再指定凭据或地址，而是可以直接通过名称引用它们。关闭 [#28367](https://github.com/ClickHouse/ClickHouse/issues/28367)。[#28577](https://github.com/ClickHouse/ClickHouse/pull/28577) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 新增了 `INFORMATION_SCHEMA` 数据库，其中包含 `SCHEMATA`、`TABLES`、`VIEWS` 和 `COLUMNS` 视图，并映射到 `system` 数据库中的相应表。关闭 [#9770](https://github.com/ClickHouse/ClickHouse/issues/9770)。[#28691](https://github.com/ClickHouse/ClickHouse/pull/28691) ([tavplubix](https://github.com/tavplubix)).
* 支持 `EXISTS (subquery)`。解决了 [#6852](https://github.com/ClickHouse/ClickHouse/issues/6852)。[#29731](https://github.com/ClickHouse/ClickHouse/pull/29731) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 用于审计的会话日志。将所有成功和失败的登录与登出事件记录到新的 `system.session_log` 表中。[#22415](https://github.com/ClickHouse/ClickHouse/pull/22415) ([Vasily Nemkov](https://github.com/Enmk)) ([Vitaly Baranov](https://github.com/vitlibar)).
* 支持多维余弦距离和欧几里得距离函数，以及 L1、L2、Lp、Linf 距离和范数；还支持 Tuple 上的标量积和各种算术运算符。这不仅完全解决了 [#4509](https://github.com/ClickHouse/ClickHouse/issues/4509)，还带来了更多改进。[#27933](https://github.com/ClickHouse/ClickHouse/pull/27933) ([Alexey Boykov](https://github.com/mathalex)) 。
* 为 `INTO OUTFILE` 和 `FROM INFILE` 新增了压缩和解压缩支持 (可自动检测，或通过额外的可选参数指定) 。[#27135](https://github.com/ClickHouse/ClickHouse/pull/27135) ([Filatenkov Artur](https://github.com/FArthur-cmd)) 。
* 通过 HTTP `OPTIONS` 请求增加了对 CORS (跨源资源共享) 的支持。这意味着 Grafana 现在无需任何变通方案即可与无服务器请求配合使用。关闭 [#18693](https://github.com/ClickHouse/ClickHouse/issues/18693)。[#29155](https://github.com/ClickHouse/ClickHouse/pull/29155) ([Filatenkov Artur](https://github.com/FArthur-cmd)) 。
* 使用 JOIN ON 的查询现已支持析取 (OR) 条件。[#21320](https://github.com/ClickHouse/ClickHouse/pull/21320) ([Ilya Golshtein](https://github.com/ilejn)) 。
* 新增函数 `tokens`。该函数可使用非字母数字 ASCII 字符作为分隔符，将字符串拆分为标记。[#29981](https://github.com/ClickHouse/ClickHouse/pull/29981) ([Maksim Kita](https://github.com/kitaisreal)) 。新增函数 `ngrams`，用于从文本中提取 ngrams。关闭 [#29699](https://github.com/ClickHouse/ClickHouse/issues/29699)。[#29738](https://github.com/ClickHouse/ClickHouse/pull/29738) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增用于 Unicode 规范化的函数：`normalizeUTF8NFC`、`normalizeUTF8NFD`、`normalizeUTF8NFKC`、`normalizeUTF8NFKD`。 [#28633](https://github.com/ClickHouse/ClickHouse/pull/28633) ([darkkeks](https://github.com/darkkeks)).
* 在 ClickHouse 中使用 `FileLog` 表引擎以流式方式消费应用日志文件。它类似于 `Kafka` 或 `RabbitMQ` 引擎，但适用于本地文件系统中只追加写入和轮转的日志。关闭 [#6953](https://github.com/ClickHouse/ClickHouse/issues/6953)。[#25969](https://github.com/ClickHouse/ClickHouse/pull/25969) ([flynn](https://github.com/ucasfl)) ([Kseniia Sumarokova](https://github.com/kssenii))。
* 新增 `CapnProto` 输出格式，并重构 `CapnProto` 输入格式。[#29291](https://github.com/ClickHouse/ClickHouse/pull/29291) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 允许在查询中将数值写成二进制字面量。示例 `SELECT 0b001;`。 [#29304](https://github.com/ClickHouse/ClickHouse/pull/29304) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增了 `hashed_array` 字典类型。在字典包含多个属性时，可节省内存。关闭 [#30236](https://github.com/ClickHouse/ClickHouse/issues/30236)。[#30242](https://github.com/ClickHouse/ClickHouse/pull/30242) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增了 `JSONExtractKeys` 函数。[#30056](https://github.com/ClickHouse/ClickHouse/pull/30056) ([Vitaly](https://github.com/orloffv)) 。
* 新增函数 `getOSKernelVersion`，返回包含操作系统内核版本的字符串。[#29755](https://github.com/ClickHouse/ClickHouse/pull/29755) ([Memo](https://github.com/Joeywzr)) 。
* 新增了 `MD4` 和 `SHA384` 函数。MD4 是一种已废弃且不安全的哈希函数，只有在极少数情况下才会使用：例如某些遗留系统已经在使用 MD4，而你又需要得到完全相同的结果。[#29602](https://github.com/ClickHouse/ClickHouse/pull/29602) ([Nikita Tikhomirov](https://github.com/NSTikhomirov)) 。
* 可通过在配置文件中将 `hsts_max_age` 设为正数，为 ClickHouse HTTP 服务器启用 HSTS。[#29516](https://github.com/ClickHouse/ClickHouse/pull/29516) ([凌涛](https://github.com/lingtaolf)) 。
* 支持 Huawei OBS Storage。已关闭 [#24294](https://github.com/ClickHouse/ClickHouse/issues/24294)。[#29511](https://github.com/ClickHouse/ClickHouse/pull/29511) ([kevin wan](https://github.com/MaxWk)) 。
* 新增函数 `mapContainsKeyLike`，用于获取键匹配简单正则表达式的 Map。 [#29471](https://github.com/ClickHouse/ClickHouse/pull/29471) ([凌涛](https://github.com/lingtaolf))。新增函数 `mapExtractKeyLike`，用于获取仅保留键匹配指定模式的元素的 Map。 [#30793](https://github.com/ClickHouse/ClickHouse/pull/30793) ([凌涛](https://github.com/lingtaolf))。
* 支持 `ALTER TABLE x MODIFY COMMENT`。[#29264](https://github.com/ClickHouse/ClickHouse/pull/29264) ([Vasily Nemkov](https://github.com/Enmk)) 。
* 新增了 ClickHouse 中缺失、但可通过 H3 API 使用的 H3 检查函数：[https://h3geo.org/docs/api/inspection。](https://h3geo.org/docs/api/inspection。) [#29209](https://github.com/ClickHouse/ClickHouse/pull/29209) ([Bharat Nallan](https://github.com/bharatnc)) 。
* 允许在 Replicated 数据库中对非复制表执行 ALTER TABLE FETCH 和 ATTACH 操作。[#29202](https://github.com/ClickHouse/ClickHouse/pull/29202) ([Kevin Michel](https://github.com/kmichel-aiven)) 。
* 新增了一个设置 `output_format_csv_null_representation`：与 `output_format_tsv_null_representation` 相同，但用于 CSV 输出。[#29123](https://github.com/ClickHouse/ClickHouse/pull/29123) ([PHO](https://github.com/depressed-pho)) 。
* 新增函数 `zookeeperSessionUptime()`，以秒为单位返回当前 ZooKeeper 会话的运行时间。[#28983](https://github.com/ClickHouse/ClickHouse/pull/28983) ([tavplubix](https://github.com/tavplubix)).
* 新增了 `h3ToGeoBoundary` 函数。[#28952](https://github.com/ClickHouse/ClickHouse/pull/28952) ([Ivan Veselov](https://github.com/fuzzERot)) 。
* 新增可用作窗口函数的聚合函数 `exponentialMovingAverage`。此项更改关闭了 [#27511](https://github.com/ClickHouse/ClickHouse/issues/27511)。[#28914](https://github.com/ClickHouse/ClickHouse/pull/28914) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 允许在 `DESCRIBE` 查询结果中包含表列的子列 (可通过设置 `describe_include_subcolumns` 启用) 。[#28905](https://github.com/ClickHouse/ClickHouse/pull/28905) ([Anton Popov](https://github.com/CurtizJ)) 。
* `Executable`、`ExecutablePool` 新增了选项 `send_chunk_header`。如果此选项为 true，则会在发送数据块之前先向客户端发送带换行符的数据块行数 `rows&#95;count`。[#28833](https://github.com/ClickHouse/ClickHouse/pull/28833) ([Maksim Kita](https://github.com/kitaisreal)) 。
* `tokenbf_v1` 和 `ngram` 支持键为 String 或 FixedSring 类型的 Map。这可以增强带有 Map 键过滤器的查询中的数据跳过能力。`sql CREATE TABLE map_tokenbf ( row_id UInt32, map Map(String, String), INDEX map_tokenbf map TYPE ngrambf_v1(4,256,2,0) GRANULARITY 1 ) Engine=MergeTree() Order by id ` 使用上述表时，查询 `select * from map_tokebf where map['K']='V'` 会跳过不包含键 `A` 的粒度块。当然，具体能跳过多少行取决于你设置的 `granularity` 和 `index_granularity`。[#28511](https://github.com/ClickHouse/ClickHouse/pull/28511) ([凌涛](https://github.com/lingtaolf)) 。
* 将 profile events 从 server 发送到客户端。新增了 `ProfileEvents` 数据包类型。已关闭 [#26177](https://github.com/ClickHouse/ClickHouse/issues/26177)。[#28364](https://github.com/ClickHouse/ClickHouse/pull/28364) ([Dmitry Novik](https://github.com/novikd)) 。
* `FixedString` 和 `String` 数据类型的位移运算。此项修复关闭了 [#27763](https://github.com/ClickHouse/ClickHouse/issues/27763)。[#28325](https://github.com/ClickHouse/ClickHouse/pull/28325) ([小路](https://github.com/nicelulu)).
* 支持在数据库引擎 MaterializedPostgreSQL 中动态添加或删除 PostgreSQL 复制中的表。支持修改数据库设置。关闭了 [#27573](https://github.com/ClickHouse/ClickHouse/issues/27573)。[#28301](https://github.com/ClickHouse/ClickHouse/pull/28301) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 新增函数 accurateCastOrDefault(x, T)。关闭 [#21330](https://github.com/ClickHouse/ClickHouse/issues/21330)。作者：@taiyang-li。[#23028](https://github.com/ClickHouse/ClickHouse/pull/23028) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增函数 `toUUIDOrDefault`、`toUInt8/16/32/64/256OrDefault` 和 `toInt8/16/32/64/128/256OrDefault`，在字符串解析失败时，允许用户自定义默认值 (非 NULL) 。[#21330](https://github.com/ClickHouse/ClickHouse/pull/21330) ([taiyang-li](https://github.com/taiyang-li)) 。

<div id="performance-improvement">
  #### 性能改进
</div>

* 后台 merges 现在可以相互抢占，并按适当的优先级进行调度。这样一来，长时间运行的 merge 将不再阻塞短 merge 的继续执行。这有助于更好地调度和控制 merge 的执行，并降低出现“parts 过多”错误的概率。[#22381](https://github.com/ClickHouse/ClickHouse/issues/22381)。[#25165](https://github.com/ClickHouse/ClickHouse/pull/25165) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。新增了一项能力：可执行的 merges 和变更数量可以超过 background pool 中的线程数。merges 和变更将根据其大小分步执行 (越小优先级越高) 。任务数与执行线程数的比例由设置 `background_merges_mutations_concurrency_ratio` 控制，默认值为 2。[#29140](https://github.com/ClickHouse/ClickHouse/pull/29140) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 允许对远程文件系统执行异步读取。减少从远程文件系统读取时的寻道次数。这将大幅提升性能，并使 Experimental 的 `web` 和 `s3` 磁盘在某些条件下比 EBS 更快。[#29205](https://github.com/ClickHouse/ClickHouse/pull/29205) ([Kseniia Sumarokova](https://github.com/kssenii))。与此同时，`web` 磁盘类型 (托管在 Web 服务器上的静态数据集) 也已从实验性阶段升级为可用于生产环境。
* 在 `clickhouse-client` 中，带有 `INTO OUTFILE` 的查询将使用多线程。修复了使用 `INTO OUTFILE` 时进度条闪烁的问题。此更改关闭了 [#30873](https://github.com/ClickHouse/ClickHouse/issues/30873)。此更改关闭了 [#30872](https://github.com/ClickHouse/ClickHouse/issues/30872)。[#30886](https://github.com/ClickHouse/ClickHouse/pull/30886) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 减少某些类型的 `SELECT` 查询从磁盘读取冗余压缩数据的量 (仅适用于 `MergeTree` 引擎家族) 。[#30111](https://github.com/ClickHouse/ClickHouse/pull/30111) ([alesapin](https://github.com/alesapin)) 。
* 在 MergeTree 表引擎家族中读取压缩块时，减少了一些冗余的 `seek` 调用。[#29766](https://github.com/ClickHouse/ClickHouse/pull/29766) ([alesapin](https://github.com/alesapin)).
* 使 `url` 表函数能够并行处理多个 URL。此更改关闭了 [#29670](https://github.com/ClickHouse/ClickHouse/issues/29670) 和 [#29671](https://github.com/ClickHouse/ClickHouse/issues/29671)。[#29673](https://github.com/ClickHouse/ClickHouse/pull/29673) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在启用设置 `optimize_aggregation_in_order` 时，提升按主键顺序聚合的性能。[#30266](https://github.com/ClickHouse/ClickHouse/pull/30266) ([Anton Popov](https://github.com/CurtizJ)) 。
* 现在，ClickHouse 在与外部 S3 通信时会使用 DNS 缓存。[#29999](https://github.com/ClickHouse/ClickHouse/pull/29999) ([alesapin](https://github.com/alesapin)) 。
* 新增对将 `IS NULL`/`IS NOT NULL` 下推到外部数据库 (如 MySQL) 的支持。[#29463](https://github.com/ClickHouse/ClickHouse/pull/29463) ([Azat Khuzhin](https://github.com/azat)) 。将 `isNull`/`isNotNull` 转换为 `IS NULL`/`IS NOT NULL` (用于外部数据库，如 MySQL) 。[#29446](https://github.com/ClickHouse/ClickHouse/pull/29446) ([Azat Khuzhin](https://github.com/azat)) 。
* 对字典表执行的 SELECT 查询将使用多个线程。[#30500](https://github.com/ClickHouse/ClickHouse/pull/30500) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 提升对 `Decimal` 列进行过滤 (WHERE 操作) 时的性能。[#30431](https://github.com/ClickHouse/ClickHouse/pull/30431) ([Jun Jin](https://github.com/vesslanjin)) 。
* 采用性能更优的 popcnt/ctz 实现，移除了过滤器操作中的分支代码。[#29881](https://github.com/ClickHouse/ClickHouse/pull/29881) ([Jun Jin](https://github.com/vesslanjin)) 。
* 将过滤器字节掩码生成器 (用于 WHERE 运算符) 整合并改进为一个支持 SSE/AVX2/AVX512 指令的函数。请注意，默认情况下 ClickHouse 仅使用 SSE，因此这项改进只对自定义构建有意义。[#30014](https://github.com/ClickHouse/ClickHouse/pull/30014) ([jasperzhu](https://github.com/jinjunzh)). [#30670](https://github.com/ClickHouse/ClickHouse/pull/30670) ([jasperzhu](https://github.com/jinjunzh)).
* 提升对 Nullable 浮点数执行 SUM 聚合函数时的性能。[#28906](https://github.com/ClickHouse/ClickHouse/pull/28906) ([Raúl Marín](https://github.com/Algunenano)) 。
* 在使用多个磁盘时加快分片加载过程。其思路与 [https://github.com/ClickHouse/ClickHouse/pull/16423](https://github.com/ClickHouse/ClickHouse/pull/16423) 类似。生产环境表明性能有所提升：24 分钟 -> 16 分钟。[#28363](https://github.com/ClickHouse/ClickHouse/pull/28363) ([Amos Bird](https://github.com/amosbird)).
* 减小 S3 分段上传分片大小的默认值，以降低内存使用量。[#28679](https://github.com/ClickHouse/ClickHouse/pull/28679) ([ianton-ru](https://github.com/ianton-ru)) 。
* 优化 `bitmapAnd` 函数的性能。[#28332](https://github.com/ClickHouse/ClickHouse/pull/28332) ([dddounaiking](https://github.com/OodounaikingoO)) 。
* 移除了 `StorageMergeTree` 中在合并仍在进行时发出的不必要的变更通知。[#27552](https://github.com/ClickHouse/ClickHouse/pull/27552) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 尝试改进字符串比较性能。[#28767](https://github.com/ClickHouse/ClickHouse/pull/28767) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 主键索引和分区过滤器现可用于元组。 [#29281](https://github.com/ClickHouse/ClickHouse/pull/29281) ([凌涛](https://github.com/lingtaolf)).
* 如果查询中包含多个参数相同但 level 参数不同的 quantile 聚合函数，并且启用了 `optimize_syntax_fuse_functions` 设置，则它们会合并执行，只需一次遍历即可完成。[#26657](https://github.com/ClickHouse/ClickHouse/pull/26657) ([hexiaoting](https://github.com/hexiaoting)).
* 现在，可通过投影优化对主键第一个表达式的最小值-最大值聚合。这对应于 [#329](https://github.com/ClickHouse/ClickHouse/issues/329)。[#29918](https://github.com/ClickHouse/ClickHouse/pull/29918) ([Amos Bird](https://github.com/amosbird)) 。

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 新增了为 ClickHouse Keeper 修改节点配置 (在 `.xml` 文件中) 的能力。[#30372](https://github.com/ClickHouse/ClickHouse/pull/30372) ([alesapin](https://github.com/alesapin)).
* 新增 `sparkbar` aggregate function。此变更关闭了 [#26175](https://github.com/ClickHouse/ClickHouse/issues/26175)。[#27481](https://github.com/ClickHouse/ClickHouse/pull/27481) ([小路](https://github.com/nicelulu)). 注意：该函数存在一个缺陷，其行为将在后续版本中发生变化。

<div id="improvement">
  #### 改进
</div>

* 允许用户在无需重启的情况下更改日志级别。[#29586](https://github.com/ClickHouse/ClickHouse/pull/29586) ([Nikolay Degterinsky](https://github.com/evillique)) 。
* SQL UDF 的多项改进。用于操作 SQL 用户自定义函数的 queries 现已支持 ON CLUSTER clause。Example `CREATE FUNCTION test_function ON CLUSTER 'cluster' AS x -> x + 1;`。关闭 [#30666](https://github.com/ClickHouse/ClickHouse/issues/30666)。[#30734](https://github.com/ClickHouse/ClickHouse/pull/30734) ([Maksim Kita](https://github.com/kitaisreal)) 。支持 `CREATE OR REPLACE` 和 `CREATE IF NOT EXISTS` 语法。[#30454](https://github.com/ClickHouse/ClickHouse/pull/30454) ([Maksim Kita](https://github.com/kitaisreal)) 。新增对 `DROP IF EXISTS` 的支持。Example `DROP FUNCTION IF EXISTS test_function`。[#30437](https://github.com/ClickHouse/ClickHouse/pull/30437) ([Maksim Kita](https://github.com/kitaisreal)) 。支持 lambda。Example `CREATE FUNCTION lambda_function AS x -> arrayMap(element -> element * 2, x);`。[#30435](https://github.com/ClickHouse/ClickHouse/pull/30435) ([Maksim Kita](https://github.com/kitaisreal)) 。`clickhouse-local` 现已支持 SQL 用户自定义函数。[#30179](https://github.com/ClickHouse/ClickHouse/pull/30179) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 全局启用针对每个查询的内存分析器 (将 `memory_profiler_step` 设为 4MiB) 。[#29455](https://github.com/ClickHouse/ClickHouse/pull/29455) ([Azat Khuzhin](https://github.com/azat)) 。
* 在 `system.data_skipping_indices` 中新增了列 `data_compressed_bytes`、`data_uncompressed_bytes`、`marks_bytes`。在 `system.parts` 中新增了列 `secondary_indices_compressed_bytes`、`secondary_indices_uncompressed_bytes`、`secondary_indices_marks_bytes`。修复了 [#29697](https://github.com/ClickHouse/ClickHouse/issues/29697)。[#29896](https://github.com/ClickHouse/ClickHouse/pull/29896) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 system.tables 添加 `table` 别名，并为 system.databases 添加 `database` 别名 [#29677](https://github.com/ClickHouse/ClickHouse/issues/29677)。[#29882](https://github.com/ClickHouse/ClickHouse/pull/29882) ([kevin wan](https://github.com/MaxWk)) 。
* 在 server 启动时，正确处理表之间的相互依赖关系。关闭了 [#8004](https://github.com/ClickHouse/ClickHouse/issues/8004) 和 [#15170](https://github.com/ClickHouse/ClickHouse/issues/15170)。[#28373](https://github.com/ClickHouse/ClickHouse/pull/28373) ([tavplubix](https://github.com/tavplubix)) 。
* 当分母为 Nullable 时，避免在函数 `divide`、`intDiv` 和 `modulo` 中出现 "Division by zero" 错误。解决了 [#22621](https://github.com/ClickHouse/ClickHouse/issues/22621)。[#28352](https://github.com/ClickHouse/ClickHouse/pull/28352) ([Kruglov Pavel](https://github.com/Avogar)).
* 允许在文本格式中将 `Date` 数据类型的值解析为 `YYYYMMDD` 格式，除了 `YYYY-MM-DD` 之外也支持该格式。这修复了 [#30870](https://github.com/ClickHouse/ClickHouse/issues/30870)。[#30871](https://github.com/ClickHouse/ClickHouse/pull/30871) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* Web UI：在表格单元格中显示条形图。[#29792](https://github.com/ClickHouse/ClickHouse/pull/29792) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 用户现在可以创建带注释的字典：`CREATE DICTIONARY ... COMMENT 'vaue'` ... [#29899](https://github.com/ClickHouse/ClickHouse/pull/29899) ([Vasily Nemkov](https://github.com/Enmk))。现在，用户还可以在 `CREATE DATABASE` 语句中为 database 设置注释 ... [#29429](https://github.com/ClickHouse/ClickHouse/pull/29429) ([Vasily Nemkov](https://github.com/Enmk))。
* 引入 `compiled_expression_cache_elements_size` 设置。如果你将来需要用到这个设置，那你自然已经知道它是做什么的。[#30667](https://github.com/ClickHouse/ClickHouse/pull/30667) ([Maksim Kita](https://github.com/kitaisreal)) 。
* clickhouse-format 现已支持 `--query` 选项。在之前的版本中，必须通过 stdin 传入查询。[#29325](https://github.com/ClickHouse/ClickHouse/pull/29325) ([凌涛](https://github.com/lingtaolf)) 。
* 支持对 `Memory` 数据库中的表执行 `ALTER TABLE`。`clickhouse-local` 会使用 `Memory` 数据库。[#30866](https://github.com/ClickHouse/ClickHouse/pull/30866) ([tavplubix](https://github.com/tavplubix)).
* 现在，`arrayStringConcat` 已支持所有可序列化类型的 Arrays。[#30840](https://github.com/ClickHouse/ClickHouse/pull/30840) ([Nickita Taranov](https://github.com/nickitat)) 。
* ClickHouse 现在会将 docker/cgroups 的限制纳入考量，以获取系统内存总量。参见 [#25662](https://github.com/ClickHouse/ClickHouse/issues/25662)。[#30574](https://github.com/ClickHouse/ClickHouse/pull/30574) ([Pavel Medvedev](https://github.com/pmed)) 。
* 现在，拉取 PostgreSQL 数据库表结构时更加可靠了。[#30477](https://github.com/ClickHouse/ClickHouse/pull/30477) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 全面支持 GROUP BY 和 ORDER BY 中的位置参数。[#30433](https://github.com/ClickHouse/ClickHouse/pull/30433) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 允许使用 JSONExtractString 将非字符串元素提取为字符串。此更改是为了解决 [pull/25452#issuecomment-927123287](https://github.com/ClickHouse/ClickHouse/pull/25452#issuecomment-927123287) 中提到的问题。[#30426](https://github.com/ClickHouse/ClickHouse/pull/30426) ([Amos Bird](https://github.com/amosbird)) 。
* 新增了在针对 `GraphiteMergeTree` 的 SELECT 查询中使用 FINAL 子句的功能。[#30360](https://github.com/ClickHouse/ClickHouse/pull/30360) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 对副本克隆以及为损坏的 parts 将拉取任务入队进行了小幅改进，这应能避免复制队列中的 `GET_PART` 条目极少数情况下发生卡住。 [#30346](https://github.com/ClickHouse/ClickHouse/pull/30346) ([tavplubix](https://github.com/tavplubix)).
* 允许 file 表函数使用 `user_files` 目录中指向文件的符号链接。[#30309](https://github.com/ClickHouse/ClickHouse/pull/30309) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了 `Date32` 与 `Date`、`DateTime`、`DateTime64` 及 `String` 的比较问题。[#30219](https://github.com/ClickHouse/ClickHouse/pull/30219) ([liang.huang](https://github.com/lhuang09287750)) 。
* 允许从 `MergeTree` 表中删除 `SAMPLE BY` 表达式 (`ALTER TABLE <table> REMOVE SAMPLE BY`) 。[#30180](https://github.com/ClickHouse/ClickHouse/pull/30180) ([Anton Popov](https://github.com/CurtizJ)) 。
* 现在，如果 `Keeper` (作为 `clickhouse-server` 的一部分) 能够连接到其他节点，就会异步启动。[#30170](https://github.com/ClickHouse/ClickHouse/pull/30170) ([alesapin](https://github.com/alesapin)) 。
* 现在，`clickhouse-client` 已支持原生的多行编辑。[#30143](https://github.com/ClickHouse/ClickHouse/pull/30143) ([Amos Bird](https://github.com/amosbird)) 。
* `polygon` 字典 (反向地理编码) ：新增支持在设置 `store_polygon_key_column` = true 时，使用 SELECT 查询方式读取字典内容。解决了 [#30090](https://github.com/ClickHouse/ClickHouse/issues/30090)。[#30142](https://github.com/ClickHouse/ClickHouse/pull/30142) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 Play UI 添加 ClickHouse 徽标。[#29674](https://github.com/ClickHouse/ClickHouse/pull/29674) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 从 `Arrow`、`ArrowStream`、`Parquet` 和 `ORC` 等 Arrow 支持的格式中读取列时，异常消息有所改进。此更改关闭了 [#29926](https://github.com/ClickHouse/ClickHouse/issues/29926)。[#29927](https://github.com/ClickHouse/ClickHouse/pull/29927) ([alexey-milovidov](https://github.com/alexey-milovidov))。
* 修复了 `Buffer` 表中 flush 与启动过程之间的数据竞争问题。这种情况可能会在测试中出现。[#29930](https://github.com/ClickHouse/ClickHouse/pull/29930) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了 `DatabaseMemory` 和 `LiveView` 在执行 `DROP TABLE` 时的 `lock-order-inversion` 问题。Live View 是一项 Experimental 功能。Memory 数据库用于 clickhouse-local。[#29929](https://github.com/ClickHouse/ClickHouse/pull/29929) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了周期性字典重载与配置重载之间的锁顺序反转问题。[#29928](https://github.com/ClickHouse/ClickHouse/pull/29928) ([Azat Khuzhin](https://github.com/azat)) 。
* 将 zoneinfo 文件更新至 2021c。[#29925](https://github.com/ClickHouse/ClickHouse/pull/29925) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 为 `clickhouse-copier` 新增了重试及重试间隔延迟的配置功能。[#29921](https://github.com/ClickHouse/ClickHouse/pull/29921) ([Azat Khuzhin](https://github.com/azat)) 。
* 添加 `shutdown_wait_unfinished_queries` 服务器设置，以允许等待正在运行的查询，等待时间最长可达 `shutdown_wait_unfinished`。这是为了解决 [#24451](https://github.com/ClickHouse/ClickHouse/issues/24451)。[#29914](https://github.com/ClickHouse/ClickHouse/pull/29914) ([Amos Bird](https://github.com/amosbird)) 。
* 新增了追踪峰值内存占用的功能 (在 `system.trace_log` 中新增 `trace&#95;type`：`MemoryPeak`) 。[#29858](https://github.com/ClickHouse/ClickHouse/pull/29858) ([Azat Khuzhin](https://github.com/azat)).
* PostgreSQL 外部表：在用于拉取副本标识索引的查询中，为分区表添加了前缀 'p'。[#29828](https://github.com/ClickHouse/ClickHouse/pull/29828) ([Shoh Jahon](https://github.com/Shohjahon)) 。
* 在 mutate/merge 过程中应用 `max_untracked_memory`/`memory_profiler_step`/`memory_profiler_sample_probability`，以分析合并期间的内存使用情况。 [#29681](https://github.com/ClickHouse/ClickHouse/pull/29681) ([Azat Khuzhin](https://github.com/azat)).
* 查询混淆器：`clickhouse-format --obfuscate` 现在支持更多类型的查询。[#29672](https://github.com/ClickHouse/ClickHouse/pull/29672) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了一个问题：`clickhouse-format --obfuscate` 无法处理包含嵌入式字典 (函数 `regionTo...`) 的查询。[#29667](https://github.com/ClickHouse/ClickHouse/pull/29667) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了 JSON 函数对 Nullable 的错误处理。此修复解决了 [#29615](https://github.com/ClickHouse/ClickHouse/issues/29615)。标记为改进项，因为 [https://github.com/ClickHouse/ClickHouse/pull/28012](https://github.com/ClickHouse/ClickHouse/pull/28012) 尚未发布。[#29659](https://github.com/ClickHouse/ClickHouse/pull/29659) ([Amos Bird](https://github.com/amosbird)) 。
* 默认提高 `listen_backlog`，以与较新 Linux 内核中的默认值保持一致。[#29643](https://github.com/ClickHouse/ClickHouse/pull/29643) ([Azat Khuzhin](https://github.com/azat)) 。
* 如果服务器配置 `dictionaries_config`、`models_config` 或 `user_defined_executable_functions_config` 发生变化，则会重新加载字典、模型和用户定义的可执行函数。关闭 [#28142](https://github.com/ClickHouse/ClickHouse/issues/28142)。[#29529](https://github.com/ClickHouse/ClickHouse/pull/29529) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 取消了对投影名称不必要的限制。现在，投影名称可以以 `tmp_` 开头。[#29520](https://github.com/ClickHouse/ClickHouse/pull/29520) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了变更包含嵌套子查询时出现的 `There is no query or query context has expired` 错误。如果表是复制表，且禁用了 `allow_nondeterministic_mutations` 设置，则不允许在变更中使用子查询。[#29495](https://github.com/ClickHouse/ClickHouse/pull/29495) ([tavplubix](https://github.com/tavplubix)).
* 在运行时应用对 `max_concurrent_queries` 的配置更改 (无需重启) 。[#29414](https://github.com/ClickHouse/ClickHouse/pull/29414) ([Raúl Marín](https://github.com/Algunenano)) 。
* 新增了设置 `use_skip_indexes`。[#29405](https://github.com/ClickHouse/ClickHouse/pull/29405) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增对内存中 parts 执行 `FREEZE` (用于备份) 的支持。[#29376](https://github.com/ClickHouse/ClickHouse/pull/29376) ([Mo Xuan](https://github.com/mo-avatar)) 。
* 为 `clickhouse-benchmark` 传递初始 query\_id (此前，如果你通过 `clickhouse-benchmark` 运行远程查询，分片上的查询不会通过 `initial_query_id` 与初始查询关联起来) 。[#29364](https://github.com/ClickHouse/ClickHouse/pull/29364) ([Azat Khuzhin](https://github.com/azat)).
* 跳过索引 `tokenbf_v1` 和 `ngrambf_v1`：新增了对 `Array` 数据类型的支持，其键可为 `String` 或 `FixedString` 类型。[#29280](https://github.com/ClickHouse/ClickHouse/pull/29280) ([Maksim Kita](https://github.com/kitaisreal)) 。跳过索引 `tokenbf_v1` 和 `ngrambf_v1` 新增了对 `Map` 数据类型的支持，其键可为 `String` 或 `FixedString` 类型。作者 @lingtaolf。[#29220](https://github.com/ClickHouse/ClickHouse/pull/29220) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 函数 `has`：支持 `Map` 数据类型。[#29267](https://github.com/ClickHouse/ClickHouse/pull/29267) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 clickhouse-keeper 新增 `compress_logs` 设置，可使用 `ZSTD` 压缩 clickhouse-keeper 的日志 (用于复制状态机) 。实现：[#26977](https://github.com/ClickHouse/ClickHouse/issues/26977)。[#29223](https://github.com/ClickHouse/ClickHouse/pull/29223) ([alesapin](https://github.com/alesapin)) 。
* 新增设置 `external_table_strict_query`——即使存在不兼容情况，也会强制将查询中的整个 WHERE 表达式传递给外部数据库。[#29206](https://github.com/ClickHouse/ClickHouse/pull/29206) ([Azat Khuzhin](https://github.com/azat)).
* 当使用 `ARRAY JOIN` 时，禁用 projections。在之前的版本中，projection 分析可能会破坏 array join 中的别名。[#29139](https://github.com/ClickHouse/ClickHouse/pull/29139) ([Amos Bird](https://github.com/amosbird)) 。
* 为 `MsgPack` 输入/输出格式增加了对更多类型的支持。[#29077](https://github.com/ClickHouse/ClickHouse/pull/29077) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 允许在 `ORC` 输入/输出格式中读写 `LowCardinality` 列。[#29062](https://github.com/ClickHouse/ClickHouse/pull/29062) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 从 `system.distributed_ddl_queue` 中查询时可能会显示错误的值，现已修复。[#29061](https://github.com/ClickHouse/ClickHouse/pull/29061) ([tavplubix](https://github.com/tavplubix)).
* 修复 HTTP 连接遇到未知方法时的行为。解决了 [#29050](https://github.com/ClickHouse/ClickHouse/issues/29050)。[#29057](https://github.com/ClickHouse/ClickHouse/pull/29057) ([Filatenkov Artur](https://github.com/FArthur-cmd)) 。
* `clickhouse-keeper`：修复了 `clickhouse-keeper-converter` 中的一个 bug，该 bug 在根据 ZooKeeper 日志 (而非快照) 恢复时可能导致部分数据丢失。[#29030](https://github.com/ClickHouse/ClickHouse/pull/29030) ([小路](https://github.com/nicelulu))。修复了 `clickhouse-keeper-converter` 中的一个 bug，该 bug 可能导致 ZooKeeper 日志反序列化错误。[#29071](https://github.com/ClickHouse/ClickHouse/pull/29071) ([小路](https://github.com/nicelulu))。
* 对 `CREATE ... AS SELECT` 查询应用设置 (修复：[ #28810](https://github.com/ClickHouse/ClickHouse/issues/28810)) 。[#28962](https://github.com/ClickHouse/ClickHouse/pull/28962) ([Azat Khuzhin](https://github.com/azat)) 。
* ALTER TABLE ... ON CLUSTER ... REPLACE/MOVE PARTITION FROM/TO ... 现已遵循默认数据库设置 [#28955](https://github.com/ClickHouse/ClickHouse/pull/28955) ([anneji-dev](https://github.com/anneji-dev)) 。
* gRPC 协议：允许客户端更改服务端的压缩设置。[#28953](https://github.com/ClickHouse/ClickHouse/pull/28953) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 在为异步指标读取热传感器时，跳过 “no data” 异常。这解决了 [#28852](https://github.com/ClickHouse/ClickHouse/issues/28852)。[#28882](https://github.com/ClickHouse/ClickHouse/pull/28882) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了一个逻辑竞态条件，该问题在极少数情况下可能导致现有字典报出 `Dictionary not found` 错误。 [#28853](https://github.com/ClickHouse/ClickHouse/pull/28853) ([tavplubix](https://github.com/tavplubix)).
* 放宽 If-组合器检查中对嵌套函数的限制 (但禁止嵌套相同的组合器) 。[#28828](https://github.com/ClickHouse/ClickHouse/pull/28828) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了 server 终止过程中可能出现的未捕获异常。[#28761](https://github.com/ClickHouse/ClickHouse/pull/28761) ([Azat Khuzhin](https://github.com/azat)) 。
* 禁止清理在活动中的变更/合并异常耗时时仍可能被其使用的 tmp 目录。 [#28760](https://github.com/ClickHouse/ClickHouse/pull/28760) ([Azat Khuzhin](https://github.com/azat)).
* 在使用别名时，允许启用优化 `optimize_arithmetic_operations_in_aggregate_functions = 1`。[#28746](https://github.com/ClickHouse/ClickHouse/pull/28746) ([Amos Bird](https://github.com/amosbird)) 。
* 为 `ReplicatedMergeTree` 实现 `detach_not_byte_identical_parts` 设置：对于非字节级一致的 parts，在 merge/mutate 之后将执行分离而不是删除。[#28708](https://github.com/ClickHouse/ClickHouse/pull/28708) ([Azat Khuzhin](https://github.com/azat)) 。
* 为 `MergeTree` 实现 `max_suspicious_broken_parts_bytes` 设置 (用于限制所有损坏 parts 的总字节数，默认值为 `1GiB`) 。[#28707](https://github.com/ClickHouse/ClickHouse/pull/28707) ([Azat Khuzhin](https://github.com/azat)) 。
* 支持在 `RabbitMQ` 表设置中展开宏。[#28683](https://github.com/ClickHouse/ClickHouse/pull/28683) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 恢复了对使用 `Log` 引擎的表进行多线程读取数据的能力。[#28125](https://github.com/ClickHouse/ClickHouse/pull/28125) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了 JSON 函数中对 NULL 列处理不当的问题。此修复解决了 [#27930](https://github.com/ClickHouse/ClickHouse/issues/27930)。[#28012](https://github.com/ClickHouse/ClickHouse/pull/28012) ([Amos Bird](https://github.com/amosbird)) 。
* 允许为跳过索引单独设置标记/未压缩缓存大小，而不是与列共用。[#27961](https://github.com/ClickHouse/ClickHouse/pull/27961) ([Amos Bird](https://github.com/amosbird)).
* 允许将使用 `USING` 的 JOIN 与其他 JOIN 类型混用。[#23881](https://github.com/ClickHouse/ClickHouse/pull/23881) ([darkkeks](https://github.com/darkkeks)) 。
* 更新 aws-sdk 子模块，以适配 Yandex Cloud S3 的限流机制。 [#30646](https://github.com/ClickHouse/ClickHouse/pull/30646) ([ianton-ru](https://github.com/ianton-ru)).
* 修复了在处理 gRPC 调用时，未在查询处理结束时释放查询 ID 和会话 ID 的问题。[#29954](https://github.com/ClickHouse/ClickHouse/pull/29954) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复 `AccessControlManager` 的关闭问题，以解决测试偶发不稳定的问题。[#29951](https://github.com/ClickHouse/ClickHouse/pull/29951) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复从 `HDFS` 读取时触发的断言失败。更新 libhdfs3 库，使其能够在调试模式下运行测试。关闭 [#29251](https://github.com/ClickHouse/ClickHouse/issues/29251)。关闭 [#27814](https://github.com/ClickHouse/ClickHouse/issues/27814)。[#29276](https://github.com/ClickHouse/ClickHouse/pull/29276) ([Kseniia Sumarokova](https://github.com/kssenii)) 。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 新增对 Aarch64 机器上 FreeBSD 构建的支持。[#29952](https://github.com/ClickHouse/ClickHouse/pull/29952) ([MikaelUrankar](https://github.com/MikaelUrankar)).
* ClickHouse 不再需要递归子模块。[#30315](https://github.com/ClickHouse/ClickHouse/pull/30315) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* ClickHouse 现在可以基于 Musl 进行静态构建。该功能以实验性方式引入，暂不支持构建 `odbc-bridge`、`library-bridge`、与 CatBoost 的集成以及某些库。[#30248](https://github.com/ClickHouse/ClickHouse/pull/30248) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 为 `AArch64` 和 `Darwin` (macOS) 构建启用 `Protobuf`、`Arrow`、`ORC`、`Parquet`。这解决了 [#29248](https://github.com/ClickHouse/ClickHouse/issues/29248)。这解决了 [#28018](https://github.com/ClickHouse/ClickHouse/issues/28018)。[#30015](https://github.com/ClickHouse/ClickHouse/pull/30015) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 新增对 PowerPC (powerpc64le) 的交叉构建支持。这解决了 [#9589](https://github.com/ClickHouse/ClickHouse/issues/9589)。为 AArch64 和 PowerPC 启用与 MySQL 交互的支持。这解决了 [#26301](https://github.com/ClickHouse/ClickHouse/issues/26301)。[#30010](https://github.com/ClickHouse/ClickHouse/pull/30010) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 在交叉编译工具链中仅保留必需文件，并将其作为子模块纳入 (此前它们是以 tarball 形式下载的) 。[#29974](https://github.com/ClickHouse/ClickHouse/pull/29974) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 在 ClickHouse 中为 SELECT 语句解析器实现了结构感知的模糊测试方案。[#30012](https://github.com/ClickHouse/ClickHouse/pull/30012) ([Paul](https://github.com/PaulCher)).
* 为 clang 启用实验性的 constexpr 表达式求值器，以加快模板代码的编译速度。[#29668](https://github.com/ClickHouse/ClickHouse/pull/29668) ([myrrc](https://github.com/myrrc)).
* 新增一项能力：可以在不使用新符号的情况下，使用较新版本的 glibc 进行编译。[#29594](https://github.com/ClickHouse/ClickHouse/pull/29594) ([Azat Khuzhin](https://github.com/azat)).
* 通过 clang 优化选项减小 Debug 构建二进制文件的体积。[#28736](https://github.com/ClickHouse/ClickHouse/pull/28736) ([flynn](https://github.com/ucasfl)).
* 现在，所有用于 CI 的镜像都将放到单独的 dockerhub 仓库中。[#28656](https://github.com/ClickHouse/ClickHouse/pull/28656) ([alesapin](https://github.com/alesapin)).
* 改进了对使用 clang-13 进行构建的支持。[#28046](https://github.com/ClickHouse/ClickHouse/pull/28046) ([Sergei Semin](https://github.com/syominsergey)).
* 新增将原始 profile events 输出到 `clickhouse-client` 的能力 (这对调试和测试可能很有用) 。[#30064](https://github.com/ClickHouse/ClickHouse/pull/30064) ([Azat Khuzhin](https://github.com/azat)).
* 为 clickhouse-server 单元添加时间依赖 (systemd 和 sysvinit init) 。[#28891](https://github.com/ClickHouse/ClickHouse/pull/28891) ([Azat Khuzhin](https://github.com/azat)).
* 在符号重新加载时刷新 stacktrace cache。[#28137](https://github.com/ClickHouse/ClickHouse/pull/28137) ([Amos Bird](https://github.com/amosbird)).

<div id="bug-fixes">
  #### 问题修复
</div>

* 诸如 `positionCaseInsensitiveUTF8` 和 `countSubstringsCaseInsensitiveUTF8` 这类用于在 UTF-8 字符串中执行不区分大小写搜索的函数，在极少数情况下可能会找到实际上并不匹配的子字符串；该问题已修复。[#30663](https://github.com/ClickHouse/ClickHouse/pull/30663) ([tavplubix](https://github.com/tavplubix)).
* 修复了从加密磁盘上的空文件读取时出现的问题。[#30494](https://github.com/ClickHouse/ClickHouse/pull/30494) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了在设置 `legacy_column_name_of_tuple_literal = 0` 的分布式查询中，将析取事件链转换为 `IN` 时的问题 (由设置 `optimize_min_equality_disjunction_chain_length` 控制) 。[#28658](https://github.com/ClickHouse/ClickHouse/pull/28658) ([Anton Popov](https://github.com/CurtizJ)) 。
* 即使在 `insert_allow_materialized_columns=0` 的情况下，也允许在分布式表中将物化列用作分片键：. [#28637](https://github.com/ClickHouse/ClickHouse/pull/28637) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复了在设置了 `TO` 和 `FROM` 且结果集中没有任何行时，`ORDER BY ... WITH FILL` 的问题。[#30888](https://github.com/ClickHouse/ClickHouse/pull/30888) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了当操作数超过两个时，AND/OR 表达式中未使用 set 索引的问题。此修复解决了 [#30416](https://github.com/ClickHouse/ClickHouse/issues/30416) 。 [#30887](https://github.com/ClickHouse/ClickHouse/pull/30887) ([Amos Bird](https://github.com/amosbird)).
* 修复了在物化包含哈希函数的 projection 时发生的崩溃。此修复解决了 [#30861](https://github.com/ClickHouse/ClickHouse/issues/30861)。该问题与 [https://github.com/ClickHouse/ClickHouse/pull/28560](https://github.com/ClickHouse/ClickHouse/pull/28560) 类似，原因在于没有正确理解 header 为空这一不变量。[#30877](https://github.com/ClickHouse/ClickHouse/pull/30877) ([Amos Bird](https://github.com/amosbird)).
* 修复了在 `ReplicatedMergeTree` 中从 ZooKeeper 路径提取辅助 ZooKeeper 名称时存在的歧义。此前，如果 ZooKeeper 路径中包含冒号，server 可能会因 `Unknown auxiliary ZooKeeper name` 而启动失败。修复了 [#29052](https://github.com/ClickHouse/ClickHouse/issues/29052)。此外，之前允许指定不以斜杠开头的 ZooKeeper 路径，但现在这一用法已被弃用，并且不再允许使用此类路径创建新表。辅助 ZooKeeper 名称中同样不允许包含斜杠和冒号。[#30822](https://github.com/ClickHouse/ClickHouse/pull/30822) ([tavplubix](https://github.com/tavplubix)) 。
* 当 localBackup 因某种原因失败时，清理临时目录。[#30797](https://github.com/ClickHouse/ClickHouse/pull/30797) ([ianton-ru](https://github.com/ianton-ru)) 。
* 修复了非复制表 `MergeTree` 中 `REPLACE/MOVE PARTITION` 与后台 merge 之间的竞态条件，该问题可能导致已移动/替换的数据仍有一部分保留在分区中。修复了 [#29327](https://github.com/ClickHouse/ClickHouse/issues/29327)。[#30717](https://github.com/ClickHouse/ClickHouse/pull/30717) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了 PREWHERE 始终为 true 时与 WHERE 一起使用的问题。[#30668](https://github.com/ClickHouse/ClickHouse/pull/30668) ([Azat Khuzhin](https://github.com/azat)) 。
* Limit 下推优化可能会导致出现 `Cannot find column` 错误。修复了 [#30438](https://github.com/ClickHouse/ClickHouse/issues/30438)。[#30562](https://github.com/ClickHouse/ClickHouse/pull/30562) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 为将 `isNotNull`/`isNull` 重写为 `IS [NOT] NULL` 时补上缺失的括号 (修复了类似 `isNotNull(1)+isNotNull(2)` 的查询) 。[#30520](https://github.com/ClickHouse/ClickHouse/pull/30520) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在对同一表执行带标量子查询的 ALTER 时发生的死锁，关闭了 [#30461](https://github.com/ClickHouse/ClickHouse/issues/30461)。[#30492](https://github.com/ClickHouse/ClickHouse/pull/30492) ([Vladimir C](https://github.com/vdimir)) 。
* 修复了在执行 REPLACE PARTITION 时，若会话过期则可能发生的段错误。[#30432](https://github.com/ClickHouse/ClickHouse/pull/30432) ([tavplubix](https://github.com/tavplubix)).
* 带有 `IN (subquery)` 这类条件的查询，在应用聚合投影时可能返回错误结果。已修复为投影创建集合时的问题。[#30310](https://github.com/ClickHouse/ClickHouse/pull/30310) ([Amos Bird](https://github.com/amosbird)).
* 修复了启用 projection 时 JOIN 查询中的列别名解析问题。此修复解决了 [#30146](https://github.com/ClickHouse/ClickHouse/issues/30146)。[#30293](https://github.com/ClickHouse/ClickHouse/pull/30293) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了 `replaceRegexpAll` 函数中的一些问题。[#30292](https://github.com/ClickHouse/ClickHouse/pull/30292) ([Memo](https://github.com/Joeywzr)) 。
* 修复了 ComplexKeyHashedDictionary 和 ComplexKeySparseHashedDictionary 从布局配置中解析 `preallocate` 选项时的问题。[#30246](https://github.com/ClickHouse/ClickHouse/pull/30246) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了 `[I]LIKE` 函数。关闭 [#28661](https://github.com/ClickHouse/ClickHouse/issues/28661)。[#30244](https://github.com/ClickHouse/ClickHouse/pull/30244) ([Nikolay Degterinsky](https://github.com/evillique)) 。
* 修复了在 multiIf 中同时使用 shortcircuit 和 lowcardinality 时发生的崩溃问题。[#30243](https://github.com/ClickHouse/ClickHouse/pull/30243) ([Raúl Marín](https://github.com/Algunenano)) 。
* FlatDictionary、HashedDictionary 修复了 Nullable 属性的 bytes\_allocated 计算错误。[#30238](https://github.com/ClickHouse/ClickHouse/pull/30238) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 允许在多个 JOIN 中使用以数字开头的标识符。[#30230](https://github.com/ClickHouse/ClickHouse/pull/30230) ([Vladimir C](https://github.com/vdimir)) 。
* 修复了在 `max_read_buffer_size = 0` 时从 `MergeTree` 读取的问题 (相当于用户“自讨苦吃”时的情况)  (可能导致 `Can't adjust last granule`、`LOGICAL_ERROR` 等异常，甚至数据丢失) 。[#30192](https://github.com/ClickHouse/ClickHouse/pull/30192) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复 `pread_fake_async`/`pread_threadpool` 与 `min_bytes_to_use_direct_io` 一起使用时的问题。[#30191](https://github.com/ClickHouse/ClickHouse/pull/30191) ([Azat Khuzhin](https://github.com/azat)).
* 修复了 INSERT SELECT 中基于 Nullable 列错误填充 MATERIALIZED 列的问题。[#30189](https://github.com/ClickHouse/ClickHouse/pull/30189) ([Azat Khuzhin](https://github.com/azat)).
* 函数 `initializeAggregation` 现已支持 Nullable 参数。[#30177](https://github.com/ClickHouse/ClickHouse/pull/30177) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了在带有 `GLOBAL IN` 和 `WITH TOTALS` 的查询中出现的 `Port is already connected` 错误。仅适用于 21.9 和 21.10。[#30086](https://github.com/ClickHouse/ClickHouse/pull/30086) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
* 修复 MergeTree 中 MOVE PARTITION 与合并/变更操作之间的竞争条件。[#30074](https://github.com/ClickHouse/ClickHouse/pull/30074) ([Azat Khuzhin](https://github.com/azat)) 。
* 已修复：已删除的 `Memory` 数据库在服务器重启后可能会重新出现 ([#29795](https://github.com/ClickHouse/ClickHouse/issues/29795)) 。此外，还新增了 `force_remove_data_recursively_on_drop` 设置，用作删除 `Ordinary` 数据库时出现 `Directory not empty` 错误的临时解决方法 (因为在云环境中无法手动清理残留数据) 。[#30054](https://github.com/ClickHouse/ClickHouse/pull/30054) ([tavplubix](https://github.com/tavplubix)) 。
* 修复 `tuple()` 导致的 sample 崩溃问题，关闭了 [#30004](https://github.com/ClickHouse/ClickHouse/issues/30004)。[#30016](https://github.com/ClickHouse/ClickHouse/pull/30016) ([flynn](https://github.com/ucasfl)).
* 尝试修复问题：[#29965](https://github.com/ClickHouse/ClickHouse/issues/29965)。[#29976](https://github.com/ClickHouse/ClickHouse/pull/29976) ([hexiaoting](https://github.com/hexiaoting)) 。
* 修复 `FileChecker` 与 `StorageLog`/`StorageStripeLog` 之间可能出现的数据竞争问题。[#29959](https://github.com/ClickHouse/ClickHouse/pull/29959) ([Azat Khuzhin](https://github.com/azat)).
* 修复 `StorageLog` 中 `LogSink::writeMarks()` 与 `LogSource` 之间的数据竞争。[#29946](https://github.com/ClickHouse/ClickHouse/pull/29946) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在 [https://github.com/ClickHouse/ClickHouse/pull/19544](https://github.com/ClickHouse/ClickHouse/pull/19544) 中引入的 MergeTree 表并发查询限制可能导致的资源泄漏问题。[#29879](https://github.com/ClickHouse/ClickHouse/pull/29879) ([Amos Bird](https://github.com/amosbird)).
* 修复系统表重建检查无法检测枚举值变更的问题。[#29857](https://github.com/ClickHouse/ClickHouse/pull/29857) ([Azat Khuzhin](https://github.com/azat)) 。
* MaterializedMySQL：修复了一个问题：如果与 MySQL 的连接中断，事务可能只会被部分处理。[#29837](https://github.com/ClickHouse/ClickHouse/pull/29837) ([Håvard Kvålen](https://github.com/havardk)).
* 避免在极少数情况下出现 `Timeout exceeded: elapsed 18446744073.709553 seconds` 错误，这可能是由内核中的某个缺陷引起的。修复了 [#29154](https://github.com/ClickHouse/ClickHouse/issues/29154)。[#29811](https://github.com/ClickHouse/ClickHouse/pull/29811) ([tavplubix](https://github.com/tavplubix)).
* 修复了 `ATTACH TABLE ... FROM 'path'` 查询中将非字符串字面量误用为 path 时的错误类型转换。该问题可能导致读取未初始化的内存。[#29790](https://github.com/ClickHouse/ClickHouse/pull/29790) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了 `GROUP BY` 期间对 `LowCardinality` 的并发访问问题 (与 `Buffer` 表结合使用时可能会引发问题) 。[#29782](https://github.com/ClickHouse/ClickHouse/pull/29782) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复分布式查询场景下 `GROUP BY` 结果错误的问题 (结果中会出现键相同的多行) ：当各分片混用 `<= 21.3` 和 `>= 21.4` 版本、`GROUP BY` 键包含多个定长列，且启用了两级聚合时 (参见 `group_by_two_level_threshold` 和 `group_by_two_level_threshold_bytes`) ，会出现该问题。修复 [#29580](https://github.com/ClickHouse/ClickHouse/issues/29580)。[#29735](https://github.com/ClickHouse/ClickHouse/pull/29735) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了服务器重启时设置 `materialized_postgresql_tables_list` 的异常行为。见 [#28529](https://github.com/ClickHouse/ClickHouse/issues/28529)。[#29686](https://github.com/ClickHouse/ClickHouse/pull/29686) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 过滤谓词中的条件在下推优化后可能会丢失。[#29625](https://github.com/ClickHouse/ClickHouse/pull/29625) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复带有别名的 JIT 表达式编译和短路表达式求值问题。关闭 [#29403](https://github.com/ClickHouse/ClickHouse/issues/29403)。[#29574](https://github.com/ClickHouse/ClickHouse/pull/29574) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复罕见的段错误：在 `DEFAULT` 表达式中使用错误的表标识符 (如 `x.y.z...`) 时，`ALTER MODIFY` 查询会触发该问题。修复了 [#29184](https://github.com/ClickHouse/ClickHouse/issues/29184)。[#29573](https://github.com/ClickHouse/ClickHouse/pull/29573) ([alesapin](https://github.com/alesapin)) 。
* 修复 `GROUP BY WITH TOTALS HAVING` 中的 nullptr 解引用问题 (当 `HAVING` 中的列未被选中时) 。[#29553](https://github.com/ClickHouse/ClickHouse/pull/29553) ([Azat Khuzhin](https://github.com/azat)) 。
* 避免在同时对 Join 表引擎的表进行读写时发生死锁。[#29544](https://github.com/ClickHouse/ClickHouse/pull/29544) ([Raúl Marín](https://github.com/Algunenano)) 。
* 修复 `pathStartsWith` 检查中的一个 bug，原因是 `std::mismatch` 的使用存在问题：`如果第二个范围比第一个范围短，则其行为未定义。`。[#29531](https://github.com/ClickHouse/ClickHouse/pull/29531) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 在 ODBC bridge 中为 Invalid cursor state 错误添加了重试机制。该错误可进行重试。关闭 [#29473](https://github.com/ClickHouse/ClickHouse/issues/29473)。[#29518](https://github.com/ClickHouse/ClickHouse/pull/29518) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 修复了加载 `Lazy` 数据库时表名解析错误的问题。修复了 [#29456](https://github.com/ClickHouse/ClickHouse/issues/29456)。[#29476](https://github.com/ClickHouse/ClickHouse/pull/29476) ([tavplubix](https://github.com/tavplubix)).
* 修复在将 `HAVING` 谓词下推到子查询时可能出现的 `Block structure mismatch` 问题。修复了 [#29010](https://github.com/ClickHouse/ClickHouse/issues/29010)。[#29475](https://github.com/ClickHouse/ClickHouse/pull/29475) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了函数 greatest/least 中的逻辑错误 `Cannot capture columns`。关闭 [#29334](https://github.com/ClickHouse/ClickHouse/issues/29334)。[#29454](https://github.com/ClickHouse/ClickHouse/pull/29454) ([Kruglov Pavel](https://github.com/Avogar)).
* RocksDB 表引擎：修复打开多个 DB 时的竞态条件问题 (并恢复了一些会在 CI 上触发该问题的测试) 。[#29393](https://github.com/ClickHouse/ClickHouse/pull/29393) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在配置错误时 replicated access storage 无法正常关闭的问题。[#29388](https://github.com/ClickHouse/ClickHouse/pull/29388) ([Kevin Michel](https://github.com/kmichel-aiven)) 。
* 移除窗口函数 `nth_value`，因为它不具备内存安全性。此项修复关闭了 [#29347](https://github.com/ClickHouse/ClickHouse/issues/29347)。[#29348](https://github.com/ClickHouse/ClickHouse/pull/29348) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复投影 parts 的纵向合并问题。该修复解决了 [#29253](https://github.com/ClickHouse/ClickHouse/issues/29253)。此 PR 还修复了在 [https://github.com/ClickHouse/ClickHouse/pull/25165](https://github.com/ClickHouse/ClickHouse/pull/25165) 中引入的若干投影合并/变更问题。[#29337](https://github.com/ClickHouse/ClickHouse/pull/29337) ([Amos Bird](https://github.com/amosbird)) 。
* 修复在添加新副本时 Replicated 数据库上的 DDL 查询挂起问题。[#29328](https://github.com/ClickHouse/ClickHouse/pull/29328) ([Kevin Michel](https://github.com/kmichel-aiven)) 。
* 修复了连接超时问题 (`send_timeout`/`receive_timeout`) 。[#29282](https://github.com/ClickHouse/ClickHouse/pull/29282) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在重新创建或新建 `ReplicatedMergeTree` 副本时可能出现的 `Table columns structure in ZooKeeper is different from local table structure` 异常；当某个表列的默认表达式中包含不区分大小写的函数时，就会触发该问题。[#29266](https://github.com/ClickHouse/ClickHouse/pull/29266) ([Anton Popov](https://github.com/CurtizJ)).
* 向客户端 (通过 TCP) 发送常规的 `Database doesn't exist error` (`UNKNOWN_DATABASE`) ，而不是 `Attempt to read after eof` (`ATTEMPT_TO_READ_AFTER_EOF`) 。[#29229](https://github.com/ClickHouse/ClickHouse/pull/29229) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复在 Avro 输入格式中向 LowCardinality(Nullable) 类型列插入数据时发生的段错误。[#29132](https://github.com/ClickHouse/ClickHouse/pull/29132) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 在使用服务器间 secret 的情况下，不允许重用之前的凭据 (此前，在通过 Buffer/Kafka 向为该集群配置了服务器间 secret 的分布式表执行 INSERT 时，可能会在该连接中重用先前设置的用户) 。[#29060](https://github.com/ClickHouse/ClickHouse/pull/29060) ([Azat Khuzhin](https://github.com/azat)) 。
* 处理与字典进行 join 时的 `any_join_distinct_right_table_keys` 问题，关闭 [#29007](https://github.com/ClickHouse/ClickHouse/issues/29007)。[#29014](https://github.com/ClickHouse/ClickHouse/pull/29014) ([Vladimir C](https://github.com/vdimir)) 。
* 修复按别名列进行 join 时出现的 "在块中找不到列 ..." 错误，关闭 [#26980](https://github.com/ClickHouse/ClickHouse/issues/26980)。[#29008](https://github.com/ClickHouse/ClickHouse/pull/29008) ([Vladimir C](https://github.com/vdimir)) 。
* 修复了 `GLOBAL IN` 子查询使用的线程数 (自 [#19414](https://github.com/ClickHouse/ClickHouse/issues/19414) 修复该 bug 后，它一直以单线程执行) 。[#28997](https://github.com/ClickHouse/ClickHouse/pull/28997) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 ORDER BY 包含 WITH FILL 时的不当优化。此项修复关闭了 [#28908](https://github.com/ClickHouse/ClickHouse/issues/28908)。此项修复关闭了 [#26049](https://github.com/ClickHouse/ClickHouse/issues/26049)。[#28910](https://github.com/ClickHouse/ClickHouse/pull/28910) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了高阶数组函数在使用常量时的问题 (`arrayCompact` 会触发 `SIGSEGV`，`arrayDifference` / `arrayCumSumNonNegative` 会触发 `ILLEGAL_COLUMN`) 。[#28904](https://github.com/ClickHouse/ClickHouse/pull/28904) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了使用 `mutations_sync=2` 时等待变更的问题。[#28889](https://github.com/ClickHouse/ClickHouse/pull/28889) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了外部数据库 (如 MySQL) 查询在 `IN` 中使用多列时的问题 (即 `(k,v) IN ((1, 2))`) 。[#28888](https://github.com/ClickHouse/ClickHouse/pull/28888) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了 `LowCardinality` 在短路函数求值中的缺陷。关闭 [#28884](https://github.com/ClickHouse/ClickHouse/issues/28884)。[#28887](https://github.com/ClickHouse/ClickHouse/pull/28887) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 修复了从 compact parts 中读取子列的问题。[#28873](https://github.com/ClickHouse/ClickHouse/pull/28873) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了 `DROP PART` 与 `REPLACE/MOVE PARTITION` 之间的一个竞态条件，该问题在极少数情况下可能导致副本出现不一致。 [#28864](https://github.com/ClickHouse/ClickHouse/pull/28864) ([tavplubix](https://github.com/tavplubix)).
* 修复短路求值情况下的表达式编译问题。[#28821](https://github.com/ClickHouse/ClickHouse/pull/28821) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复一种极其罕见的情况：在所有 ReplicatedMergeTree 副本都经历硬重启后，各副本之间可能出现数据分歧。错误类似于 `Part ... intersects (previous|next) part ...`。[#28817](https://github.com/ClickHouse/ClickHouse/pull/28817) ([alesapin](https://github.com/alesapin)).
* 进一步检查连接是否可用，并在 `RabbitMQ` 关闭时顺便捕获可能出现的任何异常。[#28797](https://github.com/ClickHouse/ClickHouse/pull/28797) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 修复了 ReplicatedMergeTreeQueue 中一个无害的竞态条件。虽然用户通常不会察觉，但它可能导致一些隐蔽的 bug。[#28734](https://github.com/ClickHouse/ClickHouse/pull/28734) ([alesapin](https://github.com/alesapin)).
* 修复了在发生异常时，`SELECT` 查询遇到部分创建的聚合投影时可能崩溃的问题。[#28700](https://github.com/ClickHouse/ClickHouse/pull/28700) ([Amos Bird](https://github.com/amosbird)).
* 修复了创建分布式表时因传入参数错误而导致 coredump 的问题。[#28686](https://github.com/ClickHouse/ClickHouse/pull/28686) ([Zhiyong Wang](https://github.com/ljcui)) 。
* 为 system.processes 表新增 Settings.Names 和 Settings.Values 别名。[#28685](https://github.com/ClickHouse/ClickHouse/pull/28685) ([Vitaly](https://github.com/orloffv)).
* 支持 S2 Geometry 库：修正 `s2RectAdd` 和 `s2RectContains` 函数所需参数个数。[#28663](https://github.com/ClickHouse/ClickHouse/pull/28663) ([Bharat Nallan](https://github.com/bharatnc)) 。
* 修复了在使用 Nullable 或 LowCardinality 主键时出现的无效常量类型转换问题。[#28636](https://github.com/ClickHouse/ClickHouse/pull/28636) ([Amos Bird](https://github.com/amosbird)) 。
* 修复使用 PREWHERE 时出现的“列既不在聚合函数中，也不在 GROUP BY 中”问题 (修复：[#28461](https://github.com/ClickHouse/ClickHouse/issues/28461)) 。[#28502](https://github.com/ClickHouse/ClickHouse/pull/28502) ([Azat Khuzhin](https://github.com/azat)) 。

<div id="clickhouse-release-v2110-2021-10-16">
  ### 发布 v21.10，2021-10-16。 [Presentation](https://presentations.clickhouse.com/2021-release-21.10/), [Video](https://www.youtube.com/watch?v=b9MeoOtAivQ)
</div>

<Frame>
  <iframe src="https://www.youtube.com/embed/b9MeoOtAivQ" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
</Frame>

<div id="backward-incompatible-change">
  #### 向后不兼容变更
</div>

* 现在，以下 MergeTree 表级设置：`replicated_max_parallel_sends`、`replicated_max_parallel_sends_for_table`、`replicated_max_parallel_fetches`、`replicated_max_parallel_fetches_for_table` 已不起作用。它们之前一直都未能正常工作，现已由 `max_replicated_fetches_network_bandwidth`、`max_replicated_sends_network_bandwidth` 和 `background_fetches_pool_size` 取代。[#28404](https://github.com/ClickHouse/ClickHouse/pull/28404) ([alesapin](https://github.com/alesapin)) 。

<div id="new-feature">
  #### 新功能
</div>

* 新增通过 lambda 表达式创建用户自定义函数 (UDF) 的功能。语法为 `CREATE FUNCTION {function_name} as ({parameters}) -> {function core}`。示例：`CREATE FUNCTION plus_one as (a) -> a + 1`。作者 @Realist007。[#27796](https://github.com/ClickHouse/ClickHouse/pull/27796) ([Maksim Kita](https://github.com/kitaisreal)) [#23978](https://github.com/ClickHouse/ClickHouse/pull/23978) ([Realist007](https://github.com/Realist007)).
* 新增 `Executable` 存储引擎和 `executable` 表函数。它支持以流式方式使用外部脚本处理数据。[#28102](https://github.com/ClickHouse/ClickHouse/pull/28102) ([Maksim Kita](https://github.com/kitaisreal)) ([ruct](https://github.com/ruct)).
* 新增 `ExecutablePool` 存储引擎。与 `Executable` 类似，但它使用的是长期运行的进程池。[#28518](https://github.com/ClickHouse/ClickHouse/pull/28518) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增 `ALTER TABLE ... MATERIALIZE COLUMN` 查询。[#27038](https://github.com/ClickHouse/ClickHouse/pull/27038) ([Vladimir Chebotarev](https://github.com/excitoon)).
* `s3` 表函数现已支持分区写入。[#23051](https://github.com/ClickHouse/ClickHouse/pull/23051) ([Vladimir Chebotarev](https://github.com/excitoon)).
* 数据导入 / 导出支持 `lz4` 压缩格式 (除 `gz`、`bz2`、`xz`、`zstd` 外) 。[#25310](https://github.com/ClickHouse/ClickHouse/pull/25310) ([Bharat Nallan](https://github.com/bharatnc)).
* 在设置 `enable_positional_arguments` 下允许使用位置参数。关闭了 [#2592](https://github.com/ClickHouse/ClickHouse/issues/2592)。[#27530](https://github.com/ClickHouse/ClickHouse/pull/27530) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 在用于 s3 表的 `CREATE` 查询中，`SETTINGS` 子句现可接受与文件格式相关的用户设置。此更改关闭了 [#27580](https://github.com/ClickHouse/ClickHouse/issues/27580)。[#28037](https://github.com/ClickHouse/ClickHouse/pull/28037) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* `RabbitMQ` 引擎现已支持 SSL 连接。[#28365](https://github.com/ClickHouse/ClickHouse/pull/28365) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 新增 `getServerPort` 函数，用于获取服务器端口。如果该端口未被服务器使用，则会抛出异常。[#27900](https://github.com/ClickHouse/ClickHouse/pull/27900) ([Amos Bird](https://github.com/amosbird)).
* 新增 "snowflake id" 与 `DateTime`、`DateTime64` 之间的转换函数。参见 [#27058](https://github.com/ClickHouse/ClickHouse/issues/27058)。[#27704](https://github.com/ClickHouse/ClickHouse/pull/27704) ([jasine](https://github.com/jasine)).
* 新增函数 `SHA512`。[#27830](https://github.com/ClickHouse/ClickHouse/pull/27830) ([zhanglistar](https://github.com/zhanglistar)).
* 新增 `log_queries_probability` 设置，允许用户仅将部分查询的样本写入 query\_log。关闭了 [#16609](https://github.com/ClickHouse/ClickHouse/issues/16609)。[#27527](https://github.com/ClickHouse/ClickHouse/pull/27527) ([Nikolay Degterinsky](https://github.com/evillique)).

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 新增 `web` 类型磁盘，可将只读表以静态文件形式存储在 Web 服务器上。参见 [#23982](https://github.com/ClickHouse/ClickHouse/issues/23982)。[#25251](https://github.com/ClickHouse/ClickHouse/pull/25251) ([Kseniia Sumarokova](https://github.com/kssenii)) 。这主要用于便于测试共享存储上的操作，以及轻松导入数据集。不建议在 21.11 版本发布前使用。
* 新增 `BACKUP` 和 `RESTORE` 命令。[#21945](https://github.com/ClickHouse/ClickHouse/pull/21945) ([Vitaly Baranov](https://github.com/vitlibar)) 。该功能仍在开发中，不建议在当前版本中使用。

<div id="performance-improvement">
  #### 性能改进
</div>

* 加快 `sumIf` 和 `countIf` 聚合函数的执行速度。[#28272](https://github.com/ClickHouse/ClickHouse/pull/28272) ([Raúl Marín](https://github.com/Algunenano)) 。
* 为 `minmax` 索引创建虚拟投影。现在，启用 `allow_experimental_projection_optimization` 后，查询会在可能的情况下使用 minmax 索引，而不是读取数据。[#26286](https://github.com/ClickHouse/ClickHouse/pull/26286) ([Amos Bird](https://github.com/amosbird)) 。
* 在 `sequenceMatch` 和 `sequenceCount` 中新增两项检查：当事件列表中缺少序列模式的某些确定性部分时，可提前退出。这一改动使许多此前会因达到操作上限而失败的查询得以执行，并整体提升了执行管道的速度。[#27729](https://github.com/ClickHouse/ClickHouse/pull/27729) ([Jakub Kuklis](https://github.com/jkuklis)) 。
* 利用二元函数始终单调的信息 (尤其是非零常量除法) ，增强主键分析。[#28302](https://github.com/ClickHouse/ClickHouse/pull/28302) ([Amos Bird](https://github.com/amosbird)) 。
* 让 `hasAll` 过滤条件能够利用 bloom filter 跳过索引。[#27984](https://github.com/ClickHouse/ClickHouse/pull/27984) ([Braulio Valdivielso Martínez](https://github.com/BraulioVM)) 。
* 通过延后表启动过程来加快数据分区片段加载。[#28313](https://github.com/ClickHouse/ClickHouse/pull/28313) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了可能有过多条件从 `WHERE` 移动到 `PREWHERE` 的问题 (该优化由设置 `optimize_move_to_prewhere` 控制) 。[#28139](https://github.com/ClickHouse/ClickHouse/pull/28139) ([lthaooo](https://github.com/lthaooo)) 。
* 默认启用 `optimize_distributed_group_by_sharding_key`。[#28105](https://github.com/ClickHouse/ClickHouse/pull/28105) ([Azat Khuzhin](https://github.com/azat)) 。

<div id="improvement">
  #### 改进
</div>

* 在创建 `Distributed` 表之前检查集群名称，不允许使用错误的集群名称创建表。修复了 [#27832](https://github.com/ClickHouse/ClickHouse/issues/27832)。[#27927](https://github.com/ClickHouse/ClickHouse/pull/27927) ([tavplubix](https://github.com/tavplubix)) 。
* 新增聚合函数 `quantileBFloat16Weighted`，其方式与其他 quantile...Weighted 函数类似。此更改关闭了 [#27745](https://github.com/ClickHouse/ClickHouse/issues/27745)。[#27758](https://github.com/ClickHouse/ClickHouse/pull/27758) ([Ivan Novitskiy](https://github.com/RedClusive)) 。
* 允许创建属性列表为空的字典。[#27905](https://github.com/ClickHouse/ClickHouse/pull/27905) ([Maksim Kita](https://github.com/kitaisreal)).
* 在 `clickhouse-client` 中添加了关于如何重置密码的交互式文档。这在用户安装了 ClickHouse、设置好密码后却立刻忘记的情况下很有用。参见 [#27750](https://github.com/ClickHouse/ClickHouse/issues/27750)。[#27903](https://github.com/ClickHouse/ClickHouse/pull/27903) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 支持在 `JSONAsString` 输入格式中处理数据被数组包裹的情况。修复 [#25517](https://github.com/ClickHouse/ClickHouse/issues/25517)。[#25633](https://github.com/ClickHouse/ClickHouse/pull/25633) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 在 `system.replicas` 表中新增列 `last_queue_update_exception`。[#26843](https://github.com/ClickHouse/ClickHouse/pull/26843) ([nvartolomei](https://github.com/nvartolomei)) 。
* 支持 `MaterializedPostgreSQL` 表在故障转移时自动重连。关闭 [#28529](https://github.com/ClickHouse/ClickHouse/issues/28529)。[#28614](https://github.com/ClickHouse/ClickHouse/pull/28614) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 在 server 首次启动时生成唯一的 UUID。[#20089](https://github.com/ClickHouse/ClickHouse/pull/20089) ([Bharat Nallan](https://github.com/bharatnc)) 。
* 为 `MySQL` 引擎新增 `connection_wait_timeout` 设置 (默认值为 5 秒，0 表示不等待) 。[#28474](https://github.com/ClickHouse/ClickHouse/pull/28474) ([Azat Khuzhin](https://github.com/azat)) 。
* 不允许使用无效参数创建 `MaterializedPostgreSQL`。已关闭 [#28423](https://github.com/ClickHouse/ClickHouse/issues/28423)。[#28430](https://github.com/ClickHouse/ClickHouse/pull/28430) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 在垂直合并中，使用真实的 tmp 文件而不是预定义的 "rows\_sources"。这样可避免在 tmp 磁盘上生成垃圾目录。[#28299](https://github.com/ClickHouse/ClickHouse/pull/28299) ([Amos Bird](https://github.com/amosbird)).
* 在 server 配置中新增了 `libhdfs3_conf`，而不是在 clickhouse-server.service 中导出环境变量 `LIBHDFS3_CONF`。该项用于配置与 HDFS 的交互。[#28268](https://github.com/ClickHouse/ClickHouse/pull/28268) ([Zhichang Yu](https://github.com/yuzhichang)).
* 修复删除处于 Temporary 状态的 parts 时可能引发意外异常 (`Part %name% doesn't exist`) 的问题。修复了 [#23661](https://github.com/ClickHouse/ClickHouse/issues/23661)。[#28221](https://github.com/ClickHouse/ClickHouse/pull/28221) [#28221](https://github.com/ClickHouse/ClickHouse/issues/28221)) ([Azat Khuzhin](https://github.com/azat)).
* 修复 `zookeeper_log.address` (在此 PR 的第一个补丁之前，该地址始终是 `::`) ，并减少对此列调用 `getpeername(2)` 的次数 (因为每次向 `zookeeper_log` 添加条目时都会调用 `getpeername()`，因此将该地址缓存在 zookeeper 客户端中以避免这种情况) 。[#28212](https://github.com/ClickHouse/ClickHouse/pull/28212) ([Azat Khuzhin](https://github.com/azat)) 。
* 支持在 `[]` 运算符中的下标与 `Map` 类型的键之间进行隐式转换 (例如不同的 `Int` 类型，以及 `String` 与 `FixedString`) 。[#28096](https://github.com/ClickHouse/ClickHouse/pull/28096) ([Anton Popov](https://github.com/CurtizJ)) 。
* 支持在向 PostgreSQL 表引擎或表函数插入数据时使用 `ON CONFLICT` 子句。已关闭 [#27727](https://github.com/ClickHouse/ClickHouse/issues/27727)。[#28081](https://github.com/ClickHouse/ClickHouse/pull/28081) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 放宽 `Enum` 数据类型的限制，以允许附加兼容数据。关闭了 [#26672](https://github.com/ClickHouse/ClickHouse/issues/26672)。[#28028](https://github.com/ClickHouse/ClickHouse/pull/28028) ([Dmitry Novik](https://github.com/novikd))。
* 新增设置 `empty_result_for_aggregation_by_constant_keys_on_empty_set`，用于控制在空集上按常量键进行分组时的行为。此项变更旨在恢复 [#6842](https://github.com/ClickHouse/ClickHouse/issues/6842) 中的旧行为。[#27932](https://github.com/ClickHouse/ClickHouse/pull/27932) ([Amos Bird](https://github.com/amosbird)) 。
* 新增了 `replication_wait_for_inactive_replica_timeout` 设置。该设置允许指定等待非活动副本执行 `ALTER`/`OPTIMZE`/`TRUNCATE` 查询的最长时间 (默认为 120 秒) 。如果 `replication_alter_partitions_sync` 为 2，且某些副本处于非活动状态的时间超过 `replication_wait_for_inactive_replica_timeout` 秒，则会抛出 `UNFINISHED`。 [#27931](https://github.com/ClickHouse/ClickHouse/pull/27931) ([tavplubix](https://github.com/tavplubix)) 。
* 支持 `APPLY` 列转换器的 lambda 参数，使其能够应用带有多个参数的函数。此项变更对应 [#27877](https://github.com/ClickHouse/ClickHouse/issues/27877)。[#27901](https://github.com/ClickHouse/ClickHouse/pull/27901) ([Amos Bird](https://github.com/amosbird)) 。
* 默认启用 `tcp_keep_alive_timeout`。 [#27882](https://github.com/ClickHouse/ClickHouse/pull/27882) ([Azat Khuzhin](https://github.com/azat)) 。
* 优化远程查询取消机制 (适用于远程服务器异常终止的情况) 。[#27881](https://github.com/ClickHouse/ClickHouse/pull/27881) ([Azat Khuzhin](https://github.com/azat)) 。
* 对于大型 S3 对象，使用多部分复制上传。[#27858](https://github.com/ClickHouse/ClickHouse/pull/27858) ([ianton-ru](https://github.com/ianton-ru)).
* 允许在库字典路径中跟随符号链接。[#27815](https://github.com/ClickHouse/ClickHouse/pull/27815) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 现在，将 `ALTER MODIFY COLUM` `T` 修改为 `Nullable(T)` 不再需要变更。[#27787](https://github.com/ClickHouse/ClickHouse/pull/27787) ([victorgao](https://github.com/kafka1991)) 。
* 不要默默忽略错误，也不要将延迟计入 `ReadBufferFromS3`。[#27484](https://github.com/ClickHouse/ClickHouse/pull/27484) ([Vladimir Chebotarev](https://github.com/excitoon)).
* 改进 `ALTER ... MATERIALIZE TTL`：仅重新计算元数据，而不执行实际的 TTL 操作。[#27019](https://github.com/ClickHouse/ClickHouse/pull/27019) ([lthaooo](https://github.com/lthaooo)) 。
* 允许读取自定义顶级域名列表，即使文件末尾 EOF 处没有换行符。[#28213](https://github.com/ClickHouse/ClickHouse/pull/28213) ([Azat Khuzhin](https://github.com/azat)) 。

<div id="bug-fixes">
  #### 问题修复
</div>

* 修复了从 `carbon-clickhouse` 读取压缩数据时出现“试图在文件末尾后读取”错误而导致失败的情况。关闭 [#26149](https://github.com/ClickHouse/ClickHouse/issues/26149)。[#28150](https://github.com/ClickHouse/ClickHouse/pull/28150) ([FArthur-cmd](https://github.com/FArthur-cmd)).
* 修复执行带有 `ON CLUSTER` 子句的 `GRANT WITH REPLACE` 语句时，对访问授权的检查问题。此 PR 改进了对 [#27001](https://github.com/ClickHouse/ClickHouse/pull/27701) 中修复的处理。[#27983](https://github.com/ClickHouse/ClickHouse/pull/27983) ([Vitaly Baranov](https://github.com/vitlibar)).
* 允许对类型为 `LowCardinality(UUID)` 的列使用 `extremes = 1` 进行查询。[#27918](https://github.com/ClickHouse/ClickHouse/pull/27918) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复 PostgreSQL 风格类型转换 (`::` 运算符) 在处理负数时的问题。[#27876](https://github.com/ClickHouse/ClickHouse/pull/27876) ([Anton Popov](https://github.com/CurtizJ)) 。
* 在 [#26864](https://github.com/ClickHouse/ClickHouse/pull/26864) 之后，修复了 `NamedSessionStorage` 的关闭问题：存储在 `NamedSessionStorage` 中的会话上下文现在会在全局上下文销毁之前先行销毁。[#27875](https://github.com/ClickHouse/ClickHouse/pull/27875) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复了 `windowFunnel` 的 "strict" 模式问题。此修复解决了 [#27469](https://github.com/ClickHouse/ClickHouse/issues/27469)。[#27563](https://github.com/ClickHouse/ClickHouse/pull/27563) ([achimbab](https://github.com/achimbab)).
* 修复读取截断的 `bzip2` 归档文件时陷入无限循环的问题。[#28543](https://github.com/ClickHouse/ClickHouse/pull/28543) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复 `MaterializedMySQL` 内部 DDL 在执行 `DROP TABLE` 时出现的 UUID 冲突问题。MaterializedMySQL 是一项 Experimental 功能。[#28533](https://github.com/ClickHouse/ClickHouse/pull/28533) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在从包含 `Nested` 列，以及名称中带点、且前缀与 `Nested` 相同的标量列的表中执行 `select` 时出现的 `There is no subcolumn` 错误 (例如 `n.id UInt32, n.arr1 Array(UInt64), n.arr2 Array(UInt64)`) 。[#28531](https://github.com/ClickHouse/ClickHouse/pull/28531) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了一个 bug：对 `ReplicatedVersionedCollapsingMergeTree` 执行 ALTER 后，可能会出现错误 `Existing table metadata in ZooKeeper differs in sorting key expression.`。修复 [#28515](https://github.com/ClickHouse/ClickHouse/issues/28515)。[#28528](https://github.com/ClickHouse/ClickHouse/pull/28528) ([alesapin](https://github.com/alesapin)) 。
* 修复了在后台处理分布式 DDL 队列期间可能出现的 ZooKeeper watches 泄漏 (小问题) 。已关闭 [#26036](https://github.com/ClickHouse/ClickHouse/issues/26036)。[#28446](https://github.com/ClickHouse/ClickHouse/pull/28446) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了 `MaterializedPostgreSQL` 引擎中表名未正确加引号的问题。关闭 [#28316](https://github.com/ClickHouse/ClickHouse/issues/28316)。[#28433](https://github.com/ClickHouse/ClickHouse/pull/28433) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了可空列中未关联行的错误行为。关闭 [#27691](https://github.com/ClickHouse/ClickHouse/issues/27691)。[#28349](https://github.com/ClickHouse/ClickHouse/pull/28349) ([vdimir](https://github.com/vdimir)) 。
* 修复了在未使用所有键列时 `NOT-IN` 索引优化失效的问题。此修复解决了 [#28120](https://github.com/ClickHouse/ClickHouse/issues/28120)。[#28315](https://github.com/ClickHouse/ClickHouse/pull/28315) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了因新的 parts 被空 parts 替换而导致的 parts 相互重叠问题。[#28310](https://github.com/ClickHouse/ClickHouse/pull/28310) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在启用设置 `optimize_read_in_order` 时，对 `Merge` 表执行带有 `ORDER BY` 的查询会出现结果不一致的问题。[#28266](https://github.com/ClickHouse/ClickHouse/pull/28266) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了在查询使用 `Nullable(LowCardinality)` 类型且 `extremes` 设置为 1 时，可能读取未初始化内存的问题。修复 [#28165](https://github.com/ClickHouse/ClickHouse/issues/28165)。[#28205](https://github.com/ClickHouse/ClickHouse/pull/28205) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 针对 projections 的多项小修复。详见该 PR 的详细描述。[#28178](https://github.com/ClickHouse/ClickHouse/pull/28178) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了在关闭过程中，由于 Context/config reloader 关闭顺序不正确而导致的极其罕见的段错误。 [#28088](https://github.com/ClickHouse/ClickHouse/pull/28088) ([nvartolomei](https://github.com/nvartolomei)).
* 修复了函数 `JSONExtract` 对 `Nullable(String)` 类型的 null 值处理问题。此修复解决了 [#27929](https://github.com/ClickHouse/ClickHouse/issues/27929) 和 [#27930](https://github.com/ClickHouse/ClickHouse/issues/27930)。该问题是在 [https://github.com/ClickHouse/ClickHouse/pull/25452](https://github.com/ClickHouse/ClickHouse/pull/25452) 中引入的。[#27939](https://github.com/ClickHouse/ClickHouse/pull/27939) ([Amos Bird](https://github.com/amosbird)) 。
* 对新的 `clickhouse-keeper` 工具进行了多项修复。修复了 `clickhouse-keeper` 中一个罕见 bug：客户端可能会在请求-响应完成前收到 watch 响应。[#28197](https://github.com/ClickHouse/ClickHouse/pull/28197) ([alesapin](https://github.com/alesapin))。修复了 `clickhouse-keeper` 中的一处错误行为：对子节点发出 `set` 请求时，会触发列表 watch (`getChildren`) 。[#28190](https://github.com/ClickHouse/ClickHouse/pull/28190) ([alesapin](https://github.com/alesapin))。修复了一个罕见问题：更改 `clickhouse-keeper` 设置可能导致日志丢失并使服务器卡死。[#28360](https://github.com/ClickHouse/ClickHouse/pull/28360) ([alesapin](https://github.com/alesapin))。修复了 `clickhouse-keeper` 中一个 bug：当 `rotate_logs_interval` 减小时，可能导致日志持续不断地生成。[#28152](https://github.com/ClickHouse/ClickHouse/pull/28152) ([alesapin](https://github.com/alesapin))。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 在压力测试中启用 Thread Fuzzer。Thread Fuzzer 是 ClickHouse 的一项功能，可用于测试更多线程调度组合，并发现更多潜在问题。此项变更关闭了 [#9813](https://github.com/ClickHouse/ClickHouse/issues/9813)。此项变更关闭了 [#9814](https://github.com/ClickHouse/ClickHouse/issues/9814)。此项变更关闭了 [#9515](https://github.com/ClickHouse/ClickHouse/issues/9515)。此项变更关闭了 [#9516](https://github.com/ClickHouse/ClickHouse/issues/9516)。[#27538](https://github.com/ClickHouse/ClickHouse/pull/27538) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 为测试环境新增 `test` 日志级别。它甚至比默认的 `trace` 还要更详细。[#28559](https://github.com/ClickHouse/ClickHouse/pull/28559) ([alesapin](https://github.com/alesapin)).
* 在 CMake 配置阶段输出 git 状态信息。[#28047](https://github.com/ClickHouse/ClickHouse/pull/28047) ([Braulio Valdivielso Martínez](https://github.com/BraulioVM)).
* 暂时将 Ubuntu 的 apt 仓库切换为镜像源 ru.archive.ubuntu.com，因为默认源 (archive.ubuntu.com) 在我们的 CI 中没有响应。[#28016](https://github.com/ClickHouse/ClickHouse/pull/28016) ([Ilya Yatsishin](https://github.com/qoega)).

<div id="clickhouse-release-v219-2021-09-09">
  ### ClickHouse 发布 v21.9，2021-09-09
</div>

<div id="backward-incompatible-change-3">
  #### 向后不兼容的变更
</div>

* 不再在 `Decimal` 类型的文本表示中输出末尾的零。示例：对于标度为 6 的 decimal，将输出 `1.23`，而不是 `1.230000`。这关闭了 [#15794](https://github.com/ClickHouse/ClickHouse/issues/15794)。如果你的应用程序以某种方式依赖这些末尾的零，可能会引入轻微的不兼容。输出格式中的序列化行为可以通过设置 `output_format_decimal_trailing_zeros` 控制。`toString` 的实现以及转换为 String 的行为已无条件更改。[#27680](https://github.com/ClickHouse/ClickHouse/pull/27680) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 不再允许将带有 `-Merge` 组合器的参数化聚合函数应用到聚合函数状态上，如果该状态是由参数不同的聚合函数生成的。例如，`fooState(42)(x)` 的状态不能通过 `fooMerge(s)` 或 `fooMerge(123)(s)` 完成最终计算，参数必须像 `fooMerge(42)(s)` 这样显式指定，并且必须一致。这不会影响某些特殊聚合函数，例如 `quantile` 和 `sequence*`，因为它们的参数仅用于最终计算。[#26847](https://github.com/ClickHouse/ClickHouse/pull/26847) ([tavplubix](https://github.com/tavplubix)).
* 在 clickhouse-local 中，始终将带端口的本地地址视为远程地址。[#26736](https://github.com/ClickHouse/ClickHouse/pull/26736) ([Raúl Marín](https://github.com/Algunenano)).
* 修复了这样一个问题：在某些复杂查询中，如果列别名与表达式名称相同，可能会发生错误的类型转换。这修复了 [#25447](https://github.com/ClickHouse/ClickHouse/issues/25447)。这修复了 [#26914](https://github.com/ClickHouse/ClickHouse/issues/26914)。此修复可能会引入向后不兼容：如果存在名称相同但内容不同的表达式，将抛出异常。在设置了 `enable_optimize_predicate_expression` 时，这可能会影响某些少见场景。[#26639](https://github.com/ClickHouse/ClickHouse/pull/26639) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 现在，如果标量子查询的类型可以是 `Nullable`，则它始终返回 `Nullable` 结果。这是必要的，因为当子查询为空时，其结果应为 `Null`。此前，可能会出现类型不兼容错误 (类型推导不会执行标量子查询，因此可能会使用不可空类型) 。现在，结果为空且无法转换为 `Nullable` 的标量子查询 (如 `Array` 或 `Tuple`) 会抛出错误。修复了 [#25411](https://github.com/ClickHouse/ClickHouse/issues/25411)。[#26423](https://github.com/ClickHouse/ClickHouse/pull/26423) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
* 引入了 here document 语法。示例：`SELECT $doc$ VALUE $doc$`。[#26671](https://github.com/ClickHouse/ClickHouse/pull/26671) ([Maksim Kita](https://github.com/kitaisreal)). 如果查询中存在包含 `$` 的标识符，则此更改是向后不兼容的 [#28768](https://github.com/ClickHouse/ClickHouse/issues/28768)。
* 现在索引可以处理 Nullable 类型，包括 `isNull` 和 `isNotNull`。[#12433](https://github.com/ClickHouse/ClickHouse/pull/12433) 和 [#12455](https://github.com/ClickHouse/ClickHouse/pull/12455) ([Amos Bird](https://github.com/amosbird)) 以及 [#27250](https://github.com/ClickHouse/ClickHouse/pull/27250) ([Azat Khuzhin](https://github.com/azat))。但这是通过磁盘格式变更实现的，因此即使新服务器可以读取旧数据，旧服务器也无法读取新数据。此外，如果你有 `MINMAX` 数据跳过索引，可能会收到 `Data after mutation/merge is not byte-identical` 错误，因为新的索引会使用 `.idx2` 扩展名，而以前是 `.idx`。也就是说，在这种情况下，你不应延迟更新所有现有副本；否则，如果旧副本 (\<21.9) 从 21.9+ 的新副本下载数据，将无法对下载的分片应用索引。

<div id="new-feature-3">
  #### 新特性
</div>

* 实现了短路函数求值，关闭了 [#12587](https://github.com/ClickHouse/ClickHouse/issues/12587)。新增设置 `short_circuit_function_evaluation`，用于配置短路函数求值。[#23367](https://github.com/ClickHouse/ClickHouse/pull/23367) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 支持 INTERSECT、EXCEPT、ANY 和 ALL 运算符。[#24757](https://github.com/ClickHouse/ClickHouse/pull/24757) ([Kirill Ershov](https://github.com/zdikov)) 。 ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 新增了在虚拟文件系统级别使用 AES-CTR 算法进行加密的支持 (数据静态加密) 。[#24206](https://github.com/ClickHouse/ClickHouse/pull/24206) ([Latysheva Alexandra](https://github.com/alexelex)). ([Vitaly Baranov](https://github.com/vitlibar)) [#26733](https://github.com/ClickHouse/ClickHouse/pull/26733) [#26377](https://github.com/ClickHouse/ClickHouse/pull/26377) [#26465](https://github.com/ClickHouse/ClickHouse/pull/26465).
* 新增了自然语言处理 (NLP) 函数，用于分词、词干提取、词形还原以及在同义词扩展中进行搜索。[#24997](https://github.com/ClickHouse/ClickHouse/pull/24997) ([Nikolay Degterinsky](https://github.com/evillique)) 。
* 新增了对 S2 几何库的集成支持。[#24980](https://github.com/ClickHouse/ClickHouse/pull/24980) ([Andr0901](https://github.com/Andr0901)) 。([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 新增 SQLite 表引擎、表函数和数据库引擎。[#24194](https://github.com/ClickHouse/ClickHouse/pull/24194) ([Arslan Gumerov](https://github.com/g-arslan)) 。 ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 新增支持为 `MySQL`、`PostgreSQL`、`ClickHouse`、`JDBC`、`Cassandra` 字典源使用自定义查询。已关闭 [#1270](https://github.com/ClickHouse/ClickHouse/issues/1270)。[#26995](https://github.com/ClickHouse/ClickHouse/pull/26995) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 通过 ZooKeeper 为用户、角色、行策略、配额和 profile 提供共享 (复制) 存储。[#27426](https://github.com/ClickHouse/ClickHouse/pull/27426) ([Kevin Michel](https://github.com/kmichel-aiven)) 。
* 为 `INTO OUTFILE` 添加压缩支持，可自动选择压缩算法。关闭 [#3473](https://github.com/ClickHouse/ClickHouse/issues/3473)。[#27134](https://github.com/ClickHouse/ClickHouse/pull/27134) ([Filatenkov Artur](https://github.com/FArthur-cmd)) 。
* 新增 `INSERT ... FROM INFILE`，类似于 `SELECT ... INTO OUTFILE`。[#27655](https://github.com/ClickHouse/ClickHouse/pull/27655) ([Filatenkov Artur](https://github.com/FArthur-cmd)) 。
* 新增了 `complex_key_range_hashed` 字典。解决了 [#22029](https://github.com/ClickHouse/ClickHouse/issues/22029)。[#27629](https://github.com/ClickHouse/ClickHouse/pull/27629) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 支持在 JOIN ON 子句中使用表达式。关闭 [#21868](https://github.com/ClickHouse/ClickHouse/issues/21868)。[#24420](https://github.com/ClickHouse/ClickHouse/pull/24420) ([Vladimir C](https://github.com/vdimir)).
* 当客户端连接到服务器时，会收到服务器已收集的所有警告信息。 (可使用选项 `--no-warnings` 禁用。) 新增 `system.warnings` 表，用于收集有关服务器配置的警告。[#26246](https://github.com/ClickHouse/ClickHouse/pull/26246) ([Filatenkov Artur](https://github.com/FArthur-cmd)). [#26282](https://github.com/ClickHouse/ClickHouse/pull/26282) ([Filatenkov Artur](https://github.com/FArthur-cmd)).
* 允许在聚合函数参数中使用来自 WITH 和 SELECT 的常量表达式。关闭 [#10945](https://github.com/ClickHouse/ClickHouse/issues/10945)。[#27531](https://github.com/ClickHouse/ClickHouse/pull/27531) ([abel-cheng](https://github.com/abel-cheng)) 。
* 新增 `tupleToNameValuePairs` 函数，可将命名元组转换为由成对元素组成的数组。[#27505](https://github.com/ClickHouse/ClickHouse/pull/27505) ([Braulio Valdivielso Martínez](https://github.com/BraulioVM)) 。
* 新增对导入/导出使用 `bzip2` 压缩方法的支持。已关闭 [#22428](https://github.com/ClickHouse/ClickHouse/issues/22428)。[#27377](https://github.com/ClickHouse/ClickHouse/pull/27377) ([Nikolay Degterinsky](https://github.com/evillique)) 。
* 新增了 `bitmapSubsetOffsetLimit(bitmap, offset, cardinality_limit)` 函数。该函数会创建 bitmap 的一个子集，并将结果从 `offset` 开始偏移，最多限制为 `cardinality_limit`。[#27234](https://github.com/ClickHouse/ClickHouse/pull/27234) ([DHBin](https://github.com/DHBin)).
* 在 `system.users` 中添加列 `default_database`。[#27054](https://github.com/ClickHouse/ClickHouse/pull/27054) ([kevin wan](https://github.com/MaxWk)) 。
* 在表函数 'cluster' 和 'clusterAllReplicas' 中支持 `cluster` 宏。[#26913](https://github.com/ClickHouse/ClickHouse/pull/26913) ([polyprogrammist](https://github.com/PolyProgrammist)) 。
* 新增 `currentRoles()`、`enabledRoles()` 和 `defaultRoles()` 函数。[#26780](https://github.com/ClickHouse/ClickHouse/pull/26780) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 新增函数 `currentProfiles()`、`enabledProfiles()`、`defaultProfiles()`。[#26714](https://github.com/ClickHouse/ClickHouse/pull/26714) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 新增可返回当前查询的 (initial\_)query\_id 的函数。此更改关闭了 [#23682](https://github.com/ClickHouse/ClickHouse/issues/23682)。[#26410](https://github.com/ClickHouse/ClickHouse/pull/26410) ([Alexey Boykov](https://github.com/mathalex)).
* 新增 `REPLACE GRANT` 功能。[#26384](https://github.com/ClickHouse/ClickHouse/pull/26384) ([Caspian](https://github.com/Cas-pian)) 。
* `EXPLAIN` 查询现已支持 `EXPLAIN ESTIMATE ...` 模式，可显示从 MergeTree 表读取的行、标记和 parts 信息。关闭 [#23941](https://github.com/ClickHouse/ClickHouse/issues/23941)。[#26131](https://github.com/ClickHouse/ClickHouse/pull/26131) ([fastio](https://github.com/fastio)).
* 新增了 `system.zookeeper_log` 表。ZooKeeper 客户端的所有操作都会被记录到该表中。实现了 [#25449](https://github.com/ClickHouse/ClickHouse/issues/25449)。[#26129](https://github.com/ClickHouse/ClickHouse/pull/26129) ([tavplubix](https://github.com/tavplubix)) 。
* 基于 `HDFS` 存储的 `ReplicatedMergeTree` 零拷贝复制。[#25918](https://github.com/ClickHouse/ClickHouse/pull/25918) ([Zhichang Yu](https://github.com/yuzhichang)) 。
* 允许在 `Arrow`、`ORC` 和 `Parquet` 输入格式中，将 Nested 类型作为结构体数组插入。[#25902](https://github.com/ClickHouse/ClickHouse/pull/25902) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 新增数据类型 `Date32` (以 Int32 存储数据) ，支持与 `DateTime64` 相同的日期范围，支持将 Parquet date32 加载到 ClickHouse `Date32`，新增函数 `toDate32`，用法类似 `toDate`。[#25774](https://github.com/ClickHouse/ClickHouse/pull/25774) ([LiuNeng](https://github.com/liuneng1994)).
* 允许设置默认数据库。[#25268](https://github.com/ClickHouse/ClickHouse/issues/25268)。[#25687](https://github.com/ClickHouse/ClickHouse/pull/25687) ([kevin wan](https://github.com/MaxWk)) 。
* 为 `MongoDB` 引擎新增一个可选参数，用于接受连接字符串选项并支持 SSL 连接。关闭 [#21189](https://github.com/ClickHouse/ClickHouse/issues/21189)。关闭 [#21041](https://github.com/ClickHouse/ClickHouse/issues/21041)。[#22045](https://github.com/ClickHouse/ClickHouse/pull/22045) ([Omar Bazaraa](https://github.com/OmarBazaraa)) 。

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 新增了一个压缩编解码器 `AES_128_GCM_SIV`，它会对列进行加密而非压缩。[#19896](https://github.com/ClickHouse/ClickHouse/pull/19896) ([PHO](https://github.com/depressed-pho))。后续会重写，请勿使用。
* 将 `MaterializeMySQL` 重命名为 `MaterializedMySQL`。[#26822](https://github.com/ClickHouse/ClickHouse/pull/26822) ([tavplubix](https://github.com/tavplubix))。

<div id="performance-improvement">
  #### 性能改进
</div>

* 通过减少 `clock_gettime` 系统调用次数，在 `max_execution_time = 0` 时提升快速查询的性能。[#27325](https://github.com/ClickHouse/ClickHouse/pull/27325) ([filimonov](https://github.com/filimonov)).
* 针对与日期时间相关的比较进行了特化优化，以获得更好的性能。此修复解决了 [#27083](https://github.com/ClickHouse/ClickHouse/issues/27083)。[#27122](https://github.com/ClickHouse/ClickHouse/pull/27122) ([Amos Bird](https://github.com/amosbird)).
* 在并发读取同一文件时共享文件描述符。在 Linux 上性能差异并不明显，但在典型服务器上，打开的文件数量会显著减少 (10 到 100 倍) ，从而简化操作。参见 [#26214](https://github.com/ClickHouse/ClickHouse/issues/26214)。[#26768](https://github.com/ClickHouse/ClickHouse/pull/26768) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 降低短查询的延迟，这类查询需要从包含大量列的表中读取数据。[#26371](https://github.com/ClickHouse/ClickHouse/pull/26371) ([Anton Popov](https://github.com/CurtizJ)).
* 在分析查询时，不再为索引构建 Set。[#26365](https://github.com/ClickHouse/ClickHouse/pull/26365) ([Raúl Marín](https://github.com/Algunenano)).
* 使用原生表示对 Nullable 整数类型的 SUM 进行向量化 ([David Manzanares](https://github.com/davidmanzanares), [Raúl Marín](https://github.com/Algunenano)) 。[#26248](https://github.com/ClickHouse/ClickHouse/pull/26248) ([Raúl Marín](https://github.com/Algunenano)).
* 编译涉及 `Enum` 类型列的表达式。[#26237](https://github.com/ClickHouse/ClickHouse/pull/26237) ([Maksim Kita](https://github.com/kitaisreal)).
* 编译聚合函数 `groupBitOr`、`groupBitAnd`、`groupBitXor`。[#26161](https://github.com/ClickHouse/ClickHouse/pull/26161) ([Maksim Kita](https://github.com/kitaisreal)).
* 在读取空 DEFAULT 列时，通过更准确的块大小预测降低了内存占用。关闭了 [#17317](https://github.com/ClickHouse/ClickHouse/issues/17317)。[#25917](https://github.com/ClickHouse/ClickHouse/pull/25917) ([Vladimir Chebotarev](https://github.com/excitoon)).
* 在带有 `ORDER BY primary_key` 的查询中，减少内存占用和读取行数。[#25721](https://github.com/ClickHouse/ClickHouse/pull/25721) ([Anton Popov](https://github.com/CurtizJ)).
* 默认启用 `distributed_push_down_limit`。[#27104](https://github.com/ClickHouse/ClickHouse/pull/27104) ([Azat Khuzhin](https://github.com/azat)).
* 当 timeZone 为常量值时，使 `toTimeZone` 具备单调性，以支持在使用如下 SQL 时进行分区裁剪。[#26261](https://github.com/ClickHouse/ClickHouse/pull/26261) ([huangzhaowei](https://github.com/SaintBacchus)).

<div id="improvement">
  #### 改进
</div>

* 将窗口函数标记为正式可用。移除 `allow_experimental_window_functions` 设置。[#27184](https://github.com/ClickHouse/ClickHouse/pull/27184) ([Alexander Kuzmenkov](https://github.com/akuzm)) 。
* 改进了对非整分钟时区偏移量的兼容性。[#27080](https://github.com/ClickHouse/ClickHouse/pull/27080) ([Raúl Marín](https://github.com/Algunenano)) 。
* 如果 `File` 表引擎中的文件描述符是普通文件，则允许对其进行多次读取。这样一来，如果 stdin 是普通文件，例如 `clickhouse-local --query "SELECT * FROM table UNION ALL SELECT * FROM table" ... < file`，`clickhouse-local` 就可以从 stdin 多次读取 (例如在执行多个 SELECT 查询或子查询时) 。此项修复了 [#11124](https://github.com/ClickHouse/ClickHouse/issues/11124)。与 ([alexey-milovidov](https://github.com/alexey-milovidov)) 共同完成。[#25960](https://github.com/ClickHouse/ClickHouse/pull/25960) ([BoloniniD](https://github.com/BoloniniD)).
* 删除重复的索引分析，并避免在投影分析期间进行可能失效的 limit 检查。[#27742](https://github.com/ClickHouse/ClickHouse/pull/27742) ([Amos Bird](https://github.com/amosbird)) 。
* 支持通过 HTTP 请求正文传递查询参数。[#27706](https://github.com/ClickHouse/ClickHouse/pull/27706) ([Hermano Lustosa](https://github.com/hllustosa)) 。
* 禁止在分区表达式中使用 `arrayJoin`。[#27648](https://github.com/ClickHouse/ClickHouse/pull/27648) ([Raúl Marín](https://github.com/Algunenano)) 。
* 身份验证失败时记录客户端 IP 地址。[#27514](https://github.com/ClickHouse/ClickHouse/pull/27514) ([Misko Lee](https://github.com/imiskolee)) 。
* 在 GRPC 协议中，二进制数据使用字节而非字符串。[#27431](https://github.com/ClickHouse/ClickHouse/pull/27431) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 如果未设置 HTTP 端口，而用户又尝试将 HTTP 请求发送到 TCP 端口，则返回包含错误消息的响应。[#27385](https://github.com/ClickHouse/ClickHouse/pull/27385) ([Braulio Valdivielso Martínez](https://github.com/BraulioVM)) 。
* 新增仅供内部使用的 `_CAST` 函数；它不会保留类型的 Nullable 属性，而非内部 cast 则会根据设置 `cast_keep_nullable` 保留该属性。关闭 [#12636](https://github.com/ClickHouse/ClickHouse/issues/12636)。[#27382](https://github.com/ClickHouse/ClickHouse/pull/27382) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 添加设置 `log_formatted_queries`，将额外的格式化后的查询记录到 `system.query_log` 中。这对归一化查询分析很有用，因为像 `normalizeQuery` 和 `normalizeQueryKeepNames` 这样的函数为了获得更好的性能，不会对查询做解析或格式化。[#27380](https://github.com/ClickHouse/ClickHouse/pull/27380) ([Amos Bird](https://github.com/amosbird)) 。
* 新增两个设置 `max_hyperscan_regexp_length` 和 `max_hyperscan_regexp_total_length`，以防止在 hyperscan 相关函数 (如 `multiMatchAny`) 中使用过大的正则表达式。[#27378](https://github.com/ClickHouse/ClickHouse/pull/27378) ([Amos Bird](https://github.com/amosbird)) 。
* bitmap 聚合函数消耗的内存现已计入内存限制。这修复了 [#26555](https://github.com/ClickHouse/ClickHouse/issues/26555)。[#27252](https://github.com/ClickHouse/ClickHouse/pull/27252) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 为 S3 代理解析器新增 10 秒缓存。[#27216](https://github.com/ClickHouse/ClickHouse/pull/27216) ([ianton-ru](https://github.com/ianton-ru)) 。
* 将全局互斥锁拆分为各个正则表达式构建过程各自独立的锁。这有助于避免耗时巨大的正则表达式构建阻塞其他相关线程。[#27211](https://github.com/ClickHouse/ClickHouse/pull/27211) ([Amos Bird](https://github.com/amosbird)).
* 为 PostgreSQL 数据库引擎提供 schema 支持。关闭 [#27166](https://github.com/ClickHouse/ClickHouse/issues/27166)。[#27198](https://github.com/ClickHouse/ClickHouse/pull/27198) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 支持在 clickhouse-client 中跟踪内存使用情况。[#27191](https://github.com/ClickHouse/ClickHouse/pull/27191) ([Filatenkov Artur](https://github.com/FArthur-cmd)).
* 即使查询未能启动，也会尝试在 `system.query_log` 中记录 `query_kind`。[#27182](https://github.com/ClickHouse/ClickHouse/pull/27182) ([Amos Bird](https://github.com/amosbird)) 。
* 在表 `system.replicas` 中新增了列 `replica_is_active`，用于将副本名称映射为副本是否处于活动状态。关闭了 [#27138](https://github.com/ClickHouse/ClickHouse/issues/27138)。[#27180](https://github.com/ClickHouse/ClickHouse/pull/27180) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 支持在 Web UI 中通过服务器 URI 传递查询设置。[#27177](https://github.com/ClickHouse/ClickHouse/pull/27177) ([kolsys](https://github.com/kolsys)).
* 添加了一个名为 `MaxPushedDDLEntryID` 的新指标，表示当前节点推送到 zookeeper 的最大 DDL 条目 ID。[#27174](https://github.com/ClickHouse/ClickHouse/pull/27174) ([Fuwang Hu](https://github.com/fuwhu)) 。
* 改进了 `clickhouse-keeper` 在创建 znode 时对节点是否存在以及空字符串节点的判断。[#27125](https://github.com/ClickHouse/ClickHouse/pull/27125) ([小路](https://github.com/nicelulu)) 。
* Merge JOIN 现已能正确处理右侧为空集的情况。[#27078](https://github.com/ClickHouse/ClickHouse/pull/27078) ([Vladimir C](https://github.com/vdimir)) 。
* 现在，函数可以是分片级常量，这意味着如果它是在某个分布式表的上下文中执行的，就会生成普通列；否则会产生常量值。值得注意的函数包括：`hostName()`, `tcpPort()`, `version()`, `buildId()`, `uptime()` 等。[#27020](https://github.com/ClickHouse/ClickHouse/pull/27020) ([Amos Bird](https://github.com/amosbird)) 。
* 已更新 `extractAllGroupsHorizontal`：现在可通过可选的第三个参数设置每行匹配数的上限。[#26961](https://github.com/ClickHouse/ClickHouse/pull/26961) ([Vasily Nemkov](https://github.com/Enmk)) 。
* 通过 system.rocksdb 表公开 `RocksDB` 统计信息。从 ClickHouse 配置中读取 RocksDB 选项 (`rocksdb...` 配置键) 。注意：ClickHouse 并不依赖 RocksDB；它只是额外的集成存储引擎之一。[#26821](https://github.com/ClickHouse/ClickHouse/pull/26821) ([Azat Khuzhin](https://github.com/azat)).
* 更精简的内部 RocksDB 日志。注意：ClickHouse 并不依赖 RocksDB，它只是额外的集成存储引擎之一。此项改进关闭了 [#26252](https://github.com/ClickHouse/ClickHouse/issues/26252)。[#26789](https://github.com/ClickHouse/ClickHouse/pull/26789) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 更改默认角色仅影响新会话。[#26759](https://github.com/ClickHouse/ClickHouse/pull/26759) ([Vitaly Baranov](https://github.com/vitlibar)).
* Docker 中默认禁用了 Watchdog。修复了未处理 Ctrl+C 的问题。[#26757](https://github.com/ClickHouse/ClickHouse/pull/26757) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) 。
* 如果传入的 profile 设有约束，`SET PROFILE` 现在也会应用这些约束。[#26730](https://github.com/ClickHouse/ClickHouse/pull/26730) ([Vitaly Baranov](https://github.com/vitlibar)).
* 改进了 `KILL QUERY` 请求的处理方式。[#26675](https://github.com/ClickHouse/ClickHouse/pull/26675) ([Raúl Marín](https://github.com/Algunenano)) 。
* `mapPopulatesSeries` 函数现已支持 `Map` 类型。[#26663](https://github.com/ClickHouse/ClickHouse/pull/26663) ([Ildus Kurbangaliev](https://github.com/ildus)) 。
* 修复使用 `skip_unavailable_shards` 时连接尝试次数过多 (x2) 的问题。[#26658](https://github.com/ClickHouse/ClickHouse/pull/26658) ([Azat Khuzhin](https://github.com/azat)) 。
* 避免在连接失败时 (即发生 EMFILE 时) 导致 `clickhouse-benchmark` 挂起。[#26656](https://github.com/ClickHouse/ClickHouse/pull/26656) ([Azat Khuzhin](https://github.com/azat)) 。
* 允许 Kafka 引擎使用更多的线程。[#26642](https://github.com/ClickHouse/ClickHouse/pull/26642) ([feihengye](https://github.com/feihengye)) 。
* 为 `clickhouse-benchmark` 添加轮转支持 (除统计报告外，它与常规的多主机/端口运行没有区别) 。[#26607](https://github.com/ClickHouse/ClickHouse/pull/26607) ([Azat Khuzhin](https://github.com/azat)) 。
* 可执行字典 (`executable`、`executable_pool`) 现已支持使用 `clickhouse-local` 通过 DDL 查询进行创建。解决了 [#22355](https://github.com/ClickHouse/ClickHouse/issues/22355)。[#26510](https://github.com/ClickHouse/ClickHouse/pull/26510) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 `mysql` 和 `postgresql` 兼容协议处理器设置客户端查询种类。[#26498](https://github.com/ClickHouse/ClickHouse/pull/26498) ([anneji-dev](https://github.com/anneji-dev)) 。
* 对于诸如 `SELECT * FROM dist ORDER BY key LIMIT 10` 这类查询，在分片上应用 `LIMIT`，并配合 `distributed_push_down_limit=1`。避免对诸如 `SELECT DISTINCT shading_key FROM dist ORDER BY key` 这类查询执行 `Distinct`/`LIMIT BY` 步骤。现在，`optimize_distributed_group_by_sharding_key` 优化也会正确遵循 `distributed_push_down_limit`。[#26466](https://github.com/ClickHouse/ClickHouse/pull/26466) ([Azat Khuzhin](https://github.com/azat)) 。
* 已将 protobuf 更新至 3.17.3。更新日志可见于 [https://github.com/protocolbuffers/protobuf/releases。](https://github.com/protocolbuffers/protobuf/releases。) [#26424](https://github.com/ClickHouse/ClickHouse/pull/26424) ([Ilya Yatsishin](https://github.com/qoega)).
* 启用 `use_hedged_requests` 设置，有助于缓解大型集群中的尾延迟。[#26380](https://github.com/ClickHouse/ClickHouse/pull/26380) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 改进当用户允许的主机列表中包含不存在的主机时的处理行为。[#26368](https://github.com/ClickHouse/ClickHouse/pull/26368) ([ianton-ru](https://github.com/ianton-ru)).
* 新增了可通过 CREATE TABLE 设置 `Distributed` 目录监控器配置的功能 (即 `CREATE TABLE dist (key Int) Engine=Distributed(cluster, db, table) SETTINGS monitor_batch_inserts=1` 及类似用法) 。[#26336](https://github.com/ClickHouse/ClickHouse/pull/26336) ([Azat Khuzhin](https://github.com/azat)) 。
* 如果服务器地址与 Web UI 的源地址不同，则在 Web UI 的历史 URL 中保存该服务器地址。此更改修复了 [#26044](https://github.com/ClickHouse/ClickHouse/issues/26044)。[#26322](https://github.com/ClickHouse/ClickHouse/pull/26322) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 为调用 `sleep` / `sleepEachRow` 时的 profile 添加事件。[#26320](https://github.com/ClickHouse/ClickHouse/pull/26320) ([Raúl Marín](https://github.com/Algunenano)) 。
* 允许不同集群复用分片连接。这样在使用 `cluster` 表函数时也无需创建新的连接。[#26318](https://github.com/ClickHouse/ClickHouse/pull/26318) ([Amos Bird](https://github.com/amosbird)) 。
* 可通过带默认值的参数控制清理旧临时目录的执行周期。[#26212](https://github.com/ClickHouse/ClickHouse/issues/26212)。[#26313](https://github.com/ClickHouse/ClickHouse/pull/26313) ([fastio](https://github.com/fastio))。
* 新增设置 `function_range_max_elements_in_block`，用于调节函数 `range` 生成数据量的安全阈值。此项更改解决了 [#26303](https://github.com/ClickHouse/ClickHouse/issues/26303)。[#26305](https://github.com/ClickHouse/ClickHouse/pull/26305) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在创建表时检查哈希函数，而不是在采样时才检查。为 MergeTree 添加了设置：如果有人创建了采样列不正确但从未使用采样的表，可以禁用这些设置，以便服务器启动时不抛出异常。[#26256](https://github.com/ClickHouse/ClickHouse/pull/26256) ([zhaoyu](https://github.com/zxc111)).
* 添加了 `output_format_avro_string_column_pattern` 设置，用于将指定的 String 列以 string 而不是默认的 bytes 格式写入 Avro。实现了 [#22414](https://github.com/ClickHouse/ClickHouse/issues/22414)。[#26245](https://github.com/ClickHouse/ClickHouse/pull/26245) ([Ilya Golshtein](https://github.com/ilejn)) 。
* 在 `system.columns` 表中增加了 `Log` 和 `TinyLog` 表的列大小信息。此更改修复了 [#9001](https://github.com/ClickHouse/ClickHouse/issues/9001)。[#26241](https://github.com/ClickHouse/ClickHouse/pull/26241) ([Nikolay Degterinsky](https://github.com/evillique)) 。
* 如果使用了自定义磁盘配置，且某些磁盘上不存在 `detached` 目录，那么在查询 `system.detached_parts` 表时不要抛出异常。此项更改关闭了 [#26078](https://github.com/ClickHouse/ClickHouse/issues/26078)。[#26236](https://github.com/ClickHouse/ClickHouse/pull/26236) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 检查键中的非确定性函数，包括 `now()`、`today()` 这类常量表达式。此更改关闭了 [#25875](https://github.com/ClickHouse/ClickHouse/issues/25875)。此更改关闭了 [#11333](https://github.com/ClickHouse/ClickHouse/issues/11333)。[#26235](https://github.com/ClickHouse/ClickHouse/pull/26235) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 在 PostgreSQL 表引擎中，将 timestamp 和 timestamptz 数据类型转换为 `DateTime64`。[#26234](https://github.com/ClickHouse/ClickHouse/pull/26234) ([jasine](https://github.com/jasine)) 。
* 对投影应用更激进的 IN 索引分析，以便选择更优的投影候选项。[#26218](https://github.com/ClickHouse/ClickHouse/pull/26218) ([Amos Bird](https://github.com/amosbird)) 。
* 当传入标量函数时，移除 `IN` 的 `GLOBAL` 关键字。在之前的版本中，如果用户指定 `GLOBAL IN f(x)`，就会抛出异常。[#26217](https://github.com/ClickHouse/ClickHouse/pull/26217) ([Amos Bird](https://github.com/amosbird)).
* 在异常消息中添加错误 ID (如 `BAD_ARGUMENTS`) 。此更改关闭了 [#25862](https://github.com/ClickHouse/ClickHouse/issues/25862)。[#26172](https://github.com/ClickHouse/ClickHouse/pull/26172) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了 `clickhouse-local` 使用 --progress 选项时输出错误的问题。进度条达到 100% 后会被清除，与 `clickhouse-client` 的处理方式相同。关闭了 [#17484](https://github.com/ClickHouse/ClickHouse/issues/17484)。[#26128](https://github.com/ClickHouse/ClickHouse/pull/26128) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 新增 `merge_selecting_sleep_ms` 设置。[#26120](https://github.com/ClickHouse/ClickHouse/pull/26120) ([lthaooo](https://github.com/lthaooo)) 。
* 移除了 Linux AIO 配合单块预读这种复杂用法，改为使用 O\_DIRECT 的简单同步 IO。在此前的版本中，如果 `max_threads` 大于 1，设置 `min_bytes_to_use_direct_io` 可能无法正常生效。使用 direct IO 读取时 (对查询默认禁用，对大型合并默认启用) ，效率会较低。此更改修复了 [#25997](https://github.com/ClickHouse/ClickHouse/issues/25997)。[#26003](https://github.com/ClickHouse/ClickHouse/pull/26003) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在 `REPLACE TABLE` 查询时刷写 `Distributed` 表。解决了 [#24566](https://github.com/ClickHouse/ClickHouse/issues/24566) —— 如果向新表插入失败，则在 `[CREATE OR] REPLACE TABLE ... AS SELECT` 查询中不要替换 (或创建) 表。解决了 [#23175](https://github.com/ClickHouse/ClickHouse/issues/23175)。[#25895](https://github.com/ClickHouse/ClickHouse/pull/25895) ([tavplubix](https://github.com/tavplubix)).
* 向 system.query\_log 添加 `views` 列，其中包含查询执行的 (物化或实时) 视图名称。新增一个日志表 (`system.query_views_log`) ，其中包含查询期间执行的每个视图的信息。修改视图执行行为：当执行视图时抛出异常后，任何已经开始执行的视图都会继续运行直到完成。这种行为以前仅在 parallel\_view\_processing=true 时才会出现，现在始终如此。- 依赖视图现在会向上下文报告读取进度。[#25714](https://github.com/ClickHouse/ClickHouse/pull/25714) ([Raúl Marín](https://github.com/Algunenano)).
* 在分布式查询执行完成后，连接排空将异步进行。新增了一个服务器级设置 `max_threads_for_connection_collector`，用于指定在后台回收连接的工作线程数量。如果线程池已满，则仍会同步排空连接，不过和之前略有不同：会在向客户端发送 EOS 后再进行排空；查询在接收到足够数据后会立即成功返回；任何异常都会被记入日志，而不会抛给客户端。新增设置 `drain_timeout` (默认为 3 秒) 。连接排空在超时后会断开该连接。[#25674](https://github.com/ClickHouse/ClickHouse/pull/25674) ([Amos Bird](https://github.com/amosbird)).
* 支持在配置中使用多个 include。现在可以从多个来源引入 users 配置和 remote servers 配置。只需放置带有 `from_zk`、`from_env` 或 `incl` 属性的 `<include />` 元素，它就会被替换为相应的内容。[#24404](https://github.com/ClickHouse/ClickHouse/pull/24404) ([nvartolomei](https://github.com/nvartolomei)).
* 修复了在 `insert_distributed_one_random_shard = 1` 时向分布式表插入多个块的问题。这是一项较少使用的功能。归类为改进。[#23140](https://github.com/ClickHouse/ClickHouse/pull/23140) ([Amos Bird](https://github.com/amosbird)) 。
* 支持 `Map` 类型使用 `LowCardinality` 和 `FixedString` 作为键/值。[#21543](https://github.com/ClickHouse/ClickHouse/pull/21543) ([hexiaoting](https://github.com/hexiaoting)) 。
* 支持重新加载本地磁盘配置。[#19526](https://github.com/ClickHouse/ClickHouse/pull/19526) ([taiyang-li](https://github.com/taiyang-li)).

<div id="bug-fixes">
  #### 问题修复
</div>

* 修复了几个可能导致副本出现分歧的 bug。[#27808](https://github.com/ClickHouse/ClickHouse/pull/27808) ([tavplubix](https://github.com/tavplubix)).
* 修复了 `DROP PART` 中一个罕见错误，该错误可能导致报错 `Unexpected merged part intersects drop range`。 [#27807](https://github.com/ClickHouse/ClickHouse/pull/27807) ([alesapin](https://github.com/alesapin)) 。
* 防止某些格式在接收到来自 Kafka 的 NULL (墓碑) 消息时发生崩溃。关闭 [#19255](https://github.com/ClickHouse/ClickHouse/issues/19255)。[#27794](https://github.com/ClickHouse/ClickHouse/pull/27794) ([filimonov](https://github.com/filimonov)) 。
* 修复子查询中使用 union distinct 时的列过滤问题。关闭 [#27578](https://github.com/ClickHouse/ClickHouse/issues/27578)。[#27689](https://github.com/ClickHouse/ClickHouse/pull/27689) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了当 `arrayHas` 等函数应用于元素类型不同的非数值类型 (如 `DateTime` 和 `DateTime64`) LowCardinality Nullable 数组时的错误类型转换问题。在之前的版本中会发生错误转换；在新版本中，这会导致抛出异常。此修复关闭了 [#26330](https://github.com/ClickHouse/ClickHouse/issues/26330)。[#27682](https://github.com/ClickHouse/ClickHouse/pull/27682) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复 postgresql 表函数导致连接无法关闭的问题。已关闭 [#26088](https://github.com/ClickHouse/ClickHouse/issues/26088)。[#27662](https://github.com/ClickHouse/ClickHouse/pull/27662) ([Kseniia Sumarokova](https://github.com/kssenii))。
* 修复了另一种触发 `Unexpected merged part ... intersecting drop range ...` error 的情况。[#27656](https://github.com/ClickHouse/ClickHouse/pull/27656) ([tavplubix](https://github.com/tavplubix)).
* 修复 `Distributed` 表中别名列相关错误。[#27652](https://github.com/ClickHouse/ClickHouse/pull/27652) ([Vladimir C](https://github.com/vdimir)) 。
* 将 `max_memory_usage*` 设置为非零值后，便无法再将其重置为 0 (无限制) 。现已修复。[#27638](https://github.com/ClickHouse/ClickHouse/pull/27638) ([tavplubix](https://github.com/tavplubix)).
* 修复了从各个分量构造时间值时出现的下溢问题。关闭 [#27193](https://github.com/ClickHouse/ClickHouse/issues/27193)。[#27605](https://github.com/ClickHouse/ClickHouse/pull/27605) ([Vasily Nemkov](https://github.com/Enmk)).
* 修复了在投影实体化过程中，当某些 parts 缺少列时发生的崩溃。此修复对应 [#27512](https://github.com/ClickHouse/ClickHouse/issues/27512)。[#27528](https://github.com/ClickHouse/ClickHouse/pull/27528) ([Amos Bird](https://github.com/amosbird)) 。
* 修复指标 `BackgroundMessageBrokerSchedulePoolTask`，之前的名称可能有拼写错误。[#27452](https://github.com/ClickHouse/ClickHouse/pull/27452) ([Ben](https://github.com/benbiti)).
* 修复了在零个分片和聚合场景下的分布式查询问题。[#27427](https://github.com/ClickHouse/ClickHouse/pull/27427) ([Azat Khuzhin](https://github.com/azat)) 。
* 兼容 `/proc/meminfo` 不包含 KB 后缀的情况。[#27361](https://github.com/ClickHouse/ClickHouse/pull/27361) ([Mike Kot](https://github.com/myrrc)).
* 修复了在带有行级安全、PREWHERE 和 LowCardinality 过滤器的查询中返回结果错误的问题。修复 [#27179](https://github.com/ClickHouse/ClickHouse/issues/27179)。[#27329](https://github.com/ClickHouse/ClickHouse/pull/27329) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了对使用旧语法创建的 MergeTree 表的分区 id 验证有误的问题。[#27328](https://github.com/ClickHouse/ClickHouse/pull/27328) ([tavplubix](https://github.com/tavplubix)).
* 修复了在使用并行格式 (CSV / TSV) 时 MySQL 协议的问题。[#27326](https://github.com/ClickHouse/ClickHouse/pull/27326) ([Raúl Marín](https://github.com/Algunenano)) 。
* 修复了带有采样的查询出现 `Cannot find column` 错误的问题。该问题是在 [#24574](https://github.com/ClickHouse/ClickHouse/issues/24574) 中引入的。修复了 [#26522](https://github.com/ClickHouse/ClickHouse/issues/26522)。[#27301](https://github.com/ClickHouse/ClickHouse/pull/27301) ([Nikolai Kochetov](https://github.com/KochetovNicolai))。
* 修复了某些在 `PREWHERE` 中使用 `LowCardinality` 的查询报错的问题，例如 `Expected ColumnLowCardinality, gotUInt8` 或 `Bad cast from type DB::ColumnVector<char8_t> to DB::ColumnLowCardinality`。更重要的是，还修复了错误消息中缺少空格的问题。修复了 [#23515](https://github.com/ClickHouse/ClickHouse/issues/23515)。[#27298](https://github.com/ClickHouse/ClickHouse/pull/27298) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 `distributed_group_by_no_merge = 2` 与 `distributed_push_down_limit = 1`，或 `optimize_distributed_group_by_sharding_key = 1` 与 `LIMIT BY` 和 `LIMIT OFFSET` 搭配使用时的问题。[#27249](https://github.com/ClickHouse/ClickHouse/pull/27249) ([Azat Khuzhin](https://github.com/azat)) 。这些都是几乎没人会用到的冷门设置组合。
* 修复非复制表 MergeTree 中变更因无效分区而卡住的问题。[#27248](https://github.com/ClickHouse/ClickHouse/pull/27248) ([Azat Khuzhin](https://github.com/azat)) 。
* 如有歧义，lambda function 会优先将其参数解析为参数本身，而非其他别名或标识符。[#27235](https://github.com/ClickHouse/ClickHouse/pull/27235) ([Raúl Marín](https://github.com/Algunenano)) 。
* 修复 merge join 中的列结构问题，关闭 [#27091](https://github.com/ClickHouse/ClickHouse/issues/27091)。[#27217](https://github.com/ClickHouse/ClickHouse/pull/27217) ([Vladimir C](https://github.com/vdimir)) 。
* 在极少数情况下，`system.detached_parts` 表中某些 parts 的信息可能不正确，现已修复。修复 [#27114](https://github.com/ClickHouse/ClickHouse/issues/27114)。[#27183](https://github.com/ClickHouse/ClickHouse/pull/27183) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了函数 `multiSearch*` 在空数组情况下使用未初始化内存的问题，关闭 [#27169](https://github.com/ClickHouse/ClickHouse/issues/27169)。[#27181](https://github.com/ClickHouse/ClickHouse/pull/27181) ([Vladimir C](https://github.com/vdimir)).
* 修复了 GRPCServer 中的同步问题。此 PR 解决了 [#27024](https://github.com/ClickHouse/ClickHouse/issues/27024)。[#27064](https://github.com/ClickHouse/ClickHouse/pull/27064) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了 `cache`、`complex_key_cache`、`ssd_cache`、`complex_key_ssd_cache` 配置的解析问题。对于非 `cache` 类型的字典，此前不会解析选项 `allow_read_expired_keys`、`max_update_queue_size`、`update_queue_push_timeout_milliseconds`、`query_wait_timeout_milliseconds`。[#27032](https://github.com/ClickHouse/ClickHouse/pull/27032) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复因与 DROP\_RANGE 存在竞争条件而可能导致的变更堆积问题。[#27002](https://github.com/ClickHouse/ClickHouse/pull/27002) ([Azat Khuzhin](https://github.com/azat)) 。
* 现在，像 `ALTER TABLE ... PARTITION ID xxx` 这样的查询中的分区 ID 会校验其是否正确。修复了 [#25718](https://github.com/ClickHouse/ClickHouse/issues/25718)。[#26963](https://github.com/ClickHouse/ClickHouse/pull/26963) ([alesapin](https://github.com/alesapin)).
* 修复在某些情况下多个 JOIN 引发“未知列名”错误的问题，关闭 [#26899](https://github.com/ClickHouse/ClickHouse/issues/26899)。[#26957](https://github.com/ClickHouse/ClickHouse/pull/26957) ([Vladimir C](https://github.com/vdimir)).
* 修复了读取自定义顶级域名时的问题 (在缓冲区较小或文件较大时会停止处理) 。[#26948](https://github.com/ClickHouse/ClickHouse/pull/26948) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了以下错误：当 `DEFAULT` 列引用另一个没有 `DEFAULT` 表达式的非物化列时，会出现 `Missing columns: 'xxx'`。修复 [#26591](https://github.com/ClickHouse/ClickHouse/issues/26591)。[#26900](https://github.com/ClickHouse/ClickHouse/pull/26900) ([alesapin](https://github.com/alesapin)) 。
* 修复了 `library-bridge` 中 `library` 字典源的字典键加载问题。[#26834](https://github.com/ClickHouse/ClickHouse/pull/26834) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 在应用某些组合器时，聚合函数的参数可能会丢失，从而导致类似 `Conversion from AggregateFunction(topKArray, Array(String)) to AggregateFunction(topKArray(10), Array(String)) is not supported` 的异常。现已修复。修复了 [#26196](https://github.com/ClickHouse/ClickHouse/issues/26196) 和 [#26433](https://github.com/ClickHouse/ClickHouse/issues/26433)。[#26814](https://github.com/ClickHouse/ClickHouse/pull/26814) ([tavplubix](https://github.com/tavplubix)) 。
* 为 `system.part_log` 中的 `REMOVE_PART` 添加了 `event_time_microseconds` 值。在之前的版本中，该值未被设置。[#26720](https://github.com/ClickHouse/ClickHouse/pull/26720) ([Azat Khuzhin](https://github.com/azat)).
* 在关闭 ReplicatedMergeTree 表时，不要删除数据，以避免造成数据与元数据不一致。[#26716](https://github.com/ClickHouse/ClickHouse/pull/26716) ([nvartolomei](https://github.com/nvartolomei)) 。
* 有时 `SET ROLE` 可能无法正常工作，此 PR 修复了这个问题。[#26707](https://github.com/ClickHouse/ClickHouse/pull/26707) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了一些并行格式化相关问题 ([https://github.com/ClickHouse/ClickHouse/issues/26694](https://github.com/ClickHouse/ClickHouse/issues/26694)) 。[#26703](https://github.com/ClickHouse/ClickHouse/pull/26703) ([Raúl Marín](https://github.com/Algunenano)) 。
* 修复窗口函数中潜在的 `nullptr` 解引用问题。此修复解决了 [#25276](https://github.com/ClickHouse/ClickHouse/issues/25276)。[#26668](https://github.com/ClickHouse/ClickHouse/pull/26668) ([Alexander Kuzmenkov](https://github.com/akuzm)).
* 修复 `clickhouse-client` 历史文件的转换问题：从 3 年前版本的 `clickhouse-client` 格式升级时，如果文件为空，也能正确处理。[#26589](https://github.com/ClickHouse/ClickHouse/pull/26589) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了 `groupBitmapAnd/Or/Xor` 函数名称不正确的问题 (在某些情况下会显示) 。详见 [#26557](https://github.com/ClickHouse/ClickHouse/pull/26557) ([Amos Bird](https://github.com/amosbird)) 。
* 更新了 clickhouse-server Docker 入口点中的 `chown` 命令检查，修复了 Kubernetes 上集群 pod (容器组) 重启失败 (或超时) 的问题。[#26545](https://github.com/ClickHouse/ClickHouse/pull/26545) ([Ky Li](https://github.com/Kylinrix)) 。
* 修复了在未启动 `RabbitMQ` 设置的情况下关闭 `RabbitMQ` 时导致的崩溃问题。关闭 [#26504](https://github.com/ClickHouse/ClickHouse/issues/26504)。[#26529](https://github.com/ClickHouse/ClickHouse/pull/26529) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了在字典名称或数据库名称带引号时，`CREATE DICTIONARY` 查询出现的问题。关闭 [#26491](https://github.com/ClickHouse/ClickHouse/issues/26491)。[#26508](https://github.com/ClickHouse/ClickHouse/pull/26508) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了重写列别名后列名解析失效的问题。此修复对应 [#26432](https://github.com/ClickHouse/ClickHouse/issues/26432)。 [#26475](https://github.com/ClickHouse/ClickHouse/pull/26475) ([Amos Bird](https://github.com/amosbird)).
* 修复一些由模糊测试触发的 msan 崩溃。修复了 [#22517](https://github.com/ClickHouse/ClickHouse/issues/22517)。[#26428](https://github.com/ClickHouse/ClickHouse/pull/26428) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复 `partial_merge_join` 中未 join 的块流无限循环的问题，关闭 [#26325](https://github.com/ClickHouse/ClickHouse/issues/26325)。[#26374](https://github.com/ClickHouse/ClickHouse/pull/26374) ([Vladimir C](https://github.com/vdimir)) 。
* 修复了以已删除用户身份登录时可能导致的崩溃问题。此 PR 修复了 [#26073](https://github.com/ClickHouse/ClickHouse/issues/26073)。[#26363](https://github.com/ClickHouse/ClickHouse/pull/26363) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复 `optimize_distributed_group_by_sharding_key` 在多列场景下的问题 (在 `optimize_skip_unused_shards=1`/`allow_nondeterministic_optimize_skip_unused_shards=1` 且分片键表达式包含多列时，会导致结果错误) 。[#26353](https://github.com/ClickHouse/ClickHouse/pull/26353) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了丢失副本恢复中的一个罕见 bug，该问题可能导致副本之间出现不一致。[#26321](https://github.com/ClickHouse/ClickHouse/pull/26321) ([tavplubix](https://github.com/tavplubix)).
* 修复 zstd 解压缩在以下情况下的问题：对于采用 zstd 帧格式且与表数据无关的导入/导出，如果内部缓冲区末尾存在转义序列。关闭 [#26013](https://github.com/ClickHouse/ClickHouse/issues/26013)。[#26314](https://github.com/ClickHouse/ClickHouse/pull/26314) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复 join 与 totals 一起使用时的逻辑错误，关闭 [#26017](https://github.com/ClickHouse/ClickHouse/issues/26017)。[#26250](https://github.com/ClickHouse/ClickHouse/pull/26250) ([Vladimir C](https://github.com/vdimir))。
* 移除了 `system.stack_trace` 表中 `thread_name` 列里的多余换行符。这修复了 [#24124](https://github.com/ClickHouse/ClickHouse/issues/24124)。[#26210](https://github.com/ClickHouse/ClickHouse/pull/26210) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了在使用多个 `untuple` expression 时可能发生的崩溃问题。[#26179](https://github.com/ClickHouse/ClickHouse/pull/26179) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 如果 Nullable Enum 中没有与零对应的值，则不要在 `toString` 中抛出异常，解决 [#25806](https://github.com/ClickHouse/ClickHouse/issues/25806)。[#26123](https://github.com/ClickHouse/ClickHouse/pull/26123) ([Vladimir C](https://github.com/vdimir)) 。
* 修复了在查询执行期间发生异常时，ClickHouse 在 MySQL 协议数据包中发送错误 `sequence_id` 的问题。这可能会导致 MySQL 客户端重置与 ClickHouse server 的连接。修复了 [#21184](https://github.com/ClickHouse/ClickHouse/issues/21184)。[#26051](https://github.com/ClickHouse/ClickHouse/pull/26051) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了以下问题：`cutToFirstSignificantSubdomainCustom()`/`cutToFirstSignificantSubdomainCustomWithWWW()`/`firstSignificantSubdomainCustom()` 对常量返回错误的类型，导致 `optimize_skip_unused_shards` 无法工作。[#26041](https://github.com/ClickHouse/ClickHouse/pull/26041) ([Azat Khuzhin](https://github.com/azat)).
* 修复了在将普通 projection 与 prewhere 一起使用时，可能出现的头信息不匹配问题。此修复对应于 [#26020](https://github.com/ClickHouse/ClickHouse/issues/26020)。[#26038](https://github.com/ClickHouse/ClickHouse/pull/26038) ([Amos Bird](https://github.com/amosbird)).
* 修复 `remote()` 中使用不带函数的列作为 `sharding_key` 时的问题 (此前 `select * from remote('127.1', system.one, dummy)` 会导致 `Unknown column: dummy, there are only columns .` 错误) 。[#25824](https://github.com/ClickHouse/ClickHouse/pull/25824) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了从 `MaterializeMySQL` 查询时出现的 `Not found column ...` 和 `Missing column ...` 错误。修复了 [#23708](https://github.com/ClickHouse/ClickHouse/issues/23708)、[#24830](https://github.com/ClickHouse/ClickHouse/issues/24830) 和 [#25794](https://github.com/ClickHouse/ClickHouse/issues/25794)。[#25822](https://github.com/ClickHouse/ClickHouse/pull/25822) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了 `optimize_skip_unused_shards_rewrite_in` 在非 UInt64 类型上的问题 (最终可能会选错分片，或抛出 `Cannot infer type of an empty tuple` 或 `Function tuple requires at least one argument`) 。[#25798](https://github.com/ClickHouse/ClickHouse/pull/25798) ([Azat Khuzhin](https://github.com/azat)) 。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 现在会在随机时区下运行有状态和无状态测试。修复了 [#12439](https://github.com/ClickHouse/ClickHouse/issues/12439)。现在，在 Protobuf 格式中将 String 读取为 DateTime，以及将 DateTime 写为 String 时，都会遵循时区设置。在 Arrow 和 Parquet 格式中将 UInt16 读取为 DateTime 时，现在会先将其视为 Date，再根据 DateTime 的时区将其转换为 DateTime，因为 Date 在 Arrow 和 Parquet 中会序列化为 UInt16。GraphiteMergeTree 现在在时间舍入时也会遵循时区。修复了 [#5098](https://github.com/ClickHouse/ClickHouse/issues/5098)。作者：@alexey-milovidov。 [#15408](https://github.com/ClickHouse/ClickHouse/pull/15408) ([alesapin](https://github.com/alesapin)).
* `clickhouse-test` 现已支持带有 [Jinja2](https://jinja.palletsprojects.com/en/3.0.x/templates/#synopsis) 模板的 SQL 测试。[#26579](https://github.com/ClickHouse/ClickHouse/pull/26579) ([Vladimir C](https://github.com/vdimir)).
* 新增对使用 `clang-13` 构建的支持。此项关闭了 [#27705](https://github.com/ClickHouse/ClickHouse/issues/27705)。[#27714](https://github.com/ClickHouse/ClickHouse/pull/27714) ([alexey-milovidov](https://github.com/alexey-milovidov))。[#27777](https://github.com/ClickHouse/ClickHouse/pull/27777) ([Sergei Semin](https://github.com/syominsergey))
* 新增了可指定是否使用特定 CPU 指令集进行构建的 CMake 选项。这是针对 [#17469](https://github.com/ClickHouse/ClickHouse/issues/17469) 和 [#27509](https://github.com/ClickHouse/ClickHouse/issues/27509)。[#27508](https://github.com/ClickHouse/ClickHouse/pull/27508) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了使用动态库时辅助程序的链接问题。[#26958](https://github.com/ClickHouse/ClickHouse/pull/26958) ([Raúl Marín](https://github.com/Algunenano)).
* 将 RocksDB 更新到 `2021-07-16` master。[#26411](https://github.com/ClickHouse/ClickHouse/pull/26411) ([alexey-milovidov](https://github.com/alexey-milovidov)).

<div id="clickhouse-release-v218-2021-08-12">
  ### ClickHouse 版本发布 v21.8，2021-08-12
</div>

<div id="upgrade-notes">
  #### 升级说明
</div>

* 新版本在系统日志表 (`system.query_log`、`system.query_thread_log`、`system.processes`、`system.opentelemetry_span_log`) 中使用 `Map` 数据类型。这些表会使用新的数据类型自动创建。为兼容旧查询，系统会创建虚拟列。修复了 [#18698](https://github.com/ClickHouse/ClickHouse/issues/18698)。[#23934](https://github.com/ClickHouse/ClickHouse/pull/23934), [#25773](https://github.com/ClickHouse/ClickHouse/pull/25773) ([hexiaoting](https://github.com/hexiaoting), [sundy-li](https://github.com/sundy-li), [Maksim Kita](https://github.com/kitaisreal))。如果你想从 21.8 版本*降级*到更早版本，则需要手动清理系统中的日志表。请查看 `/var/lib/clickhouse/data/system/*_log`。

<div id="new-feature">
  #### 新功能
</div>

* 新增对部分 SQL/JSON 标准的支持。[#24148](https://github.com/ClickHouse/ClickHouse/pull/24148) ([l1tsolaiki](https://github.com/l1tsolaiki), [Kseniia Sumarokova](https://github.com/kssenii)).
* 收集常见的系统指标 (存储在 `system.asynchronous_metrics` 和 `system.asynchronous_metric_log` 中) ，包括 CPU 使用率、磁盘使用率、内存使用量、IO、网络、文件、平均负载、CPU 频率、温度传感器、EDAC 计数器、系统运行时间；同时还新增了调度抖动以及收集这些指标所耗时间的相关指标。这一功能在 ClickHouse 中的作用类似于 `atop`，即使未安装任何额外工具，也可以访问监控数据。关闭 [#9430](https://github.com/ClickHouse/ClickHouse/issues/9430)。[#24416](https://github.com/ClickHouse/ClickHouse/pull/24416) ([alexey-milovidov](https://github.com/alexey-milovidov), [Yegor Levankov](https://github.com/elevankoff)).
* 新增 MaterializedPostgreSQL 表引擎和数据库引擎。该数据库引擎支持复制整个数据库或其中任意子集的表。[#20470](https://github.com/ClickHouse/ClickHouse/pull/20470) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 新增函数 `leftPad()`, `rightPad()`, `leftPadUTF8()`, `rightPadUTF8()`。[#26075](https://github.com/ClickHouse/ClickHouse/pull/26075) ([Vitaly Baranov](https://github.com/vitlibar)).
* 在 `ADD INDEX` 命令中新增 `FIRST` 关键字，以便将索引添加到索引列表的开头。[#25904](https://github.com/ClickHouse/ClickHouse/pull/25904) ([xjewer](https://github.com/xjewer)).
* 新增 `system.data_skipping_indices` 表，用于包含现有数据跳过索引的信息。关闭 [#7659](https://github.com/ClickHouse/ClickHouse/issues/7659)。[#25693](https://github.com/ClickHouse/ClickHouse/pull/25693) ([Dmitry Novik](https://github.com/novikd)).
* 新增 `bin`/`unbin` 函数。[#25609](https://github.com/ClickHouse/ClickHouse/pull/25609) ([zhaoyu](https://github.com/zxc111)).
* `mapAdd` 和 `mapSubtract` 函数现已支持 `Map` 以及 `UInt128`、`Int128`、`UInt256`、`Int256` 类型。[#25596](https://github.com/ClickHouse/ClickHouse/pull/25596) ([Ildus Kurbangaliev](https://github.com/ildus)).
* 支持 `DISTINCT ON (columns)` 表达式，关闭 [#25404](https://github.com/ClickHouse/ClickHouse/issues/25404)。[#25589](https://github.com/ClickHouse/ClickHouse/pull/25589) ([Zijie Lu](https://github.com/TszKitLo40)).
* 新增将自定义 setting 重置为默认值并从表元数据中移除的能力。这样一来，无需知道系统/配置的默认值也能回滚更改。关闭 [#14449](https://github.com/ClickHouse/ClickHouse/issues/14449)。[#17769](https://github.com/ClickHouse/ClickHouse/pull/17769) ([xjewer](https://github.com/xjewer)).
* 如果提交了 `EXPLAIN PIPELINE graph = 1` 查询，则会在 Web UI 中将管道渲染为图形。[#26067](https://github.com/ClickHouse/ClickHouse/pull/26067) ([alexey-milovidov](https://github.com/alexey-milovidov)).

<div id="performance-improvement">
  #### 性能改进
</div>

* 编译 聚合函数。使用选项 `compile_aggregate_expressions` 启用该功能。[#24789](https://github.com/ClickHouse/ClickHouse/pull/24789) ([Maksim Kita](https://github.com/kitaisreal)).
* 改进短查询的延迟，这类查询需要从包含大量列的表中读取数据。[#26371](https://github.com/ClickHouse/ClickHouse/pull/26371) ([Anton Popov](https://github.com/CurtizJ)).

<div id="improvements">
  #### 改进内容
</div>

* 系统日志表 (`system.query_log`、`system.query_thread_log`、`system.processes`、`system.opentelemetry_span_log`) 现已使用 `Map` 数据类型。这些表将以新的数据类型自动创建。创建了虚拟列以支持旧查询。关闭 [#18698](https://github.com/ClickHouse/ClickHouse/issues/18698)。[#23934](https://github.com/ClickHouse/ClickHouse/pull/23934), [#25773](https://github.com/ClickHouse/ClickHouse/pull/25773) ([hexiaoting](https://github.com/hexiaoting), [sundy-li](https://github.com/sundy-li), [Maksim Kita](https://github.com/kitaisreal)).
* 对于复杂键且仅包含一个属性的字典，允许在函数 `dictGet`、`dictHas` 中不将键表达式包装在元组中。[#26130](https://github.com/ClickHouse/ClickHouse/pull/26130) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 实现了对 `AggregateFunction` 状态使用 `bin`/`hex` 函数的支持。[#26094](https://github.com/ClickHouse/ClickHouse/pull/26094) ([zhaoyu](https://github.com/zxc111)) 。
* 支持 `empty` 和 `notEmpty` 函数接受 `UUID` 类型的参数。`UUID` 在全为零时 (nil UUID) 视为空。关闭 [#3446](https://github.com/ClickHouse/ClickHouse/issues/3446)。[#25974](https://github.com/ClickHouse/ClickHouse/pull/25974) ([zhaoyu](https://github.com/zxc111)).
* 为 MySQL 协议添加对 `SET SQL_SELECT_LIMIT` 的支持。关闭 [#17115](https://github.com/ClickHouse/ClickHouse/issues/17115)。[#25972](https://github.com/ClickHouse/ClickHouse/pull/25972) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 为网络交互增加更多埋点：为 recv/send 字节添加计数器；为 recvs/sends 添加 Gauge 指标。补充了缺失的文档。关闭 [#5897](https://github.com/ClickHouse/ClickHouse/issues/5897)。[#25962](https://github.com/ClickHouse/ClickHouse/pull/25962) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 新增设置 `optimize_move_to_prewhere_if_final`。如果查询中包含 `FINAL`，则只有在 `optimize_move_to_prewhere` 和 `optimize_move_to_prewhere_if_final` 均已启用时，才会启用 `move_to_prewhere` 优化。关闭 [#8684](https://github.com/ClickHouse/ClickHouse/issues/8684)。[#25940](https://github.com/ClickHouse/ClickHouse/pull/25940) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 允许参与 JOIN 的表使用复杂的带引号标识符。关闭 [#17861](https://github.com/ClickHouse/ClickHouse/issues/17861)。 [#25924](https://github.com/ClickHouse/ClickHouse/pull/25924) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 为 `Nested` 数据类型添加对 Unicode 组件 (如中文、西里尔文) 的支持。关闭 [#25594](https://github.com/ClickHouse/ClickHouse/issues/25594)。[#25923](https://github.com/ClickHouse/ClickHouse/pull/25923) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 使 `quantiles*` 函数能够与 `aggregate_functions_null_for_empty` 一起使用。关闭 [#25892](https://github.com/ClickHouse/ClickHouse/issues/25892)。[#25919](https://github.com/ClickHouse/ClickHouse/pull/25919) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 允许参数化聚合函数的参数使用任意常量表达式 (例如 `1 + 2`) ，而不只是字面量。还支持在参数化聚合函数中使用查询参数 (例如在 `{param:UInt8}` 这类参数化查询中) 。关闭 [#11607](https://github.com/ClickHouse/ClickHouse/issues/11607)。[#25910](https://github.com/ClickHouse/ClickHouse/pull/25910) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在尝试解析无效的 `Date` 时，会正确抛出异常。关闭 [#6481](https://github.com/ClickHouse/ClickHouse/issues/6481)。[#25909](https://github.com/ClickHouse/ClickHouse/pull/25909) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 支持在配置中使用多个 include。现在可以从多个来源引入用户配置和远程服务器配置。只需放置带有 `from_zk`、`from_env` 或 `incl` 属性的 `<include />` 元素，它就会被相应的替换内容替换。[#24404](https://github.com/ClickHouse/ClickHouse/pull/24404) ([nvartolomei](https://github.com/nvartolomei)) 。
* 支持包含名为 `"null"` 的列 (必须用反引号或双引号括起来) 以及使用 `ON CLUSTER` 的查询。已关闭 [#24035](https://github.com/ClickHouse/ClickHouse/issues/24035)。[#25907](https://github.com/ClickHouse/ClickHouse/pull/25907) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 为 `JSONExtract` 提供对 `LowCardinality`、`Decimal` 和 `UUID` 的支持。已关闭 [#24606](https://github.com/ClickHouse/ClickHouse/issues/24606)。[#25900](https://github.com/ClickHouse/ClickHouse/pull/25900) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 将历史文件的格式从 `readline` 转换为 `replxx`。[#25888](https://github.com/ClickHouse/ClickHouse/pull/25888) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了一个问题：在执行 `DROP PART` 或后台删除空 part 后，可能会导致出现重叠的 parts。[#25884](https://github.com/ClickHouse/ClickHouse/pull/25884) ([alesapin](https://github.com/alesapin)) 。
* 更好地处理 `ReplicatedMergeTree` 表中丢失的 parts。修复了 `ReplicationQueue` 中少见的不一致问题。修复了 [#10368](https://github.com/ClickHouse/ClickHouse/issues/10368)。[#25820](https://github.com/ClickHouse/ClickHouse/pull/25820) ([alesapin](https://github.com/alesapin)).
* 允许在工作目录不可读时启动 clickhouse-client。[#25817](https://github.com/ClickHouse/ClickHouse/pull/25817) ([ianton-ru](https://github.com/ianton-ru)) 。
* 修复 `Merge` 存储引擎中的“无可用列”错误。[#25801](https://github.com/ClickHouse/ClickHouse/pull/25801) ([Azat Khuzhin](https://github.com/azat)) 。
* MySQL 引擎现已支持在 MySQL 与 ClickHouse 之间交换列注释。[#25795](https://github.com/ClickHouse/ClickHouse/pull/25795) ([Storozhuk Kostiantyn](https://github.com/sand6255)) 。
* 修复了空集情况下 `GROUP BY` 常量行为不一致的问题。关闭 [#6842](https://github.com/ClickHouse/ClickHouse/issues/6842)。[#25786](https://github.com/ClickHouse/ClickHouse/pull/25786) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 对 `ReplicatedMergeTree` 执行 `DROP PARTITION` 和 `TRUNCATE` 时，会取消该分区中已在进行的 merge 操作。解决了 [#17151](https://github.com/ClickHouse/ClickHouse/issues/17151)。[#25684](https://github.com/ClickHouse/ClickHouse/pull/25684) ([tavplubix](https://github.com/tavplubix)) 。
* MaterializeMySQL 现已支持 ENUM\` 数据类型。[#25676](https://github.com/ClickHouse/ClickHouse/pull/25676) ([Storozhuk Kostiantyn](https://github.com/sand6255)) 。
* 支持在 JOIN 中使用物化列和别名列，解决 [#13274](https://github.com/ClickHouse/ClickHouse/issues/13274)。[#25634](https://github.com/ClickHouse/ClickHouse/pull/25634) ([Vladimir C](https://github.com/vdimir)) 。
* 修复 `ALTER TABLE ... DETACH` 与后台合并之间可能存在的逻辑竞态条件。[#25605](https://github.com/ClickHouse/ClickHouse/pull/25605) ([Azat Khuzhin](https://github.com/azat)).
* 使 `NetworkReceiveElapsedMicroseconds` 指标能够正确计入等待客户端将数据 `INSERT` 进来所花费的时间。关闭 [#9958](https://github.com/ClickHouse/ClickHouse/issues/9958)。[#25602](https://github.com/ClickHouse/ClickHouse/pull/25602) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 支持对 S3 和 HDFS 执行 `TRUNCATE TABLE`。已关闭 [#25530](https://github.com/ClickHouse/ClickHouse/issues/25530)。[#25550](https://github.com/ClickHouse/ClickHouse/pull/25550) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 支持动态重新加载配置，以调整后台作业 (合并、变更、拉取) 执行线程池中的线程数。[#25548](https://github.com/ClickHouse/ClickHouse/pull/25548) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 允许使用 `JSONExtract` 将非字符串元素按字符串提取。这是为了解决 [#25414](https://github.com/ClickHouse/ClickHouse/issues/25414)。[#25452](https://github.com/ClickHouse/ClickHouse/pull/25452) ([Amos Bird](https://github.com/amosbird)) 。
* 为 `StorageMerge` 的 `Database` 参数支持正则表达式。关闭 [#776](https://github.com/ClickHouse/ClickHouse/issues/776)。[#25064](https://github.com/ClickHouse/ClickHouse/pull/25064) ([flynn](https://github.com/ucasfl)).
* Web UI：如果值看起来像 URL，则自动生成链接。[#25965](https://github.com/ClickHouse/ClickHouse/pull/25965) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 使 `sudo service clickhouse-server start` 可在使用 `systemd` 的系统 (如 CentOS 8) 上正常运行。关闭 [#14298](https://github.com/ClickHouse/ClickHouse/issues/14298)。关闭 [#17799](https://github.com/ClickHouse/ClickHouse/issues/17799)。[#25921](https://github.com/ClickHouse/ClickHouse/pull/25921) ([alexey-milovidov](https://github.com/alexey-milovidov)).

<div id="bug-fixes">
  #### 问题修复
</div>

* 修复了某些情况下 `SET ROLE` 错误的问题。 [#26707](https://github.com/ClickHouse/ClickHouse/pull/26707) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复窗口函数中 `nullptr` 的潜在解引用问题。修复 [#25276](https://github.com/ClickHouse/ClickHouse/issues/25276)。[#26668](https://github.com/ClickHouse/ClickHouse/pull/26668) ([Alexander Kuzmenkov](https://github.com/akuzm)) 。
* 修正 `groupBitmapAnd/Or/Xor` 的函数名称错误。修复 [#26557](https://github.com/ClickHouse/ClickHouse/pull/26557) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了在 RabbitMQ 配置尚未启动时关闭 RabbitMQ 导致崩溃的问题。关闭 [#26504](https://github.com/ClickHouse/ClickHouse/issues/26504)。[#26529](https://github.com/ClickHouse/ClickHouse/pull/26529) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了在字典名称或数据库名称加了引号时，`CREATE DICTIONARY` 查询的问题。关闭 [#26491](https://github.com/ClickHouse/ClickHouse/issues/26491)。[#26508](https://github.com/ClickHouse/ClickHouse/pull/26508) ([Maksim Kita](https://github.com/kitaisreal)).
* 修复重写列别名后失效的名称解析。修复了 [#26432](https://github.com/ClickHouse/ClickHouse/issues/26432)。[#26475](https://github.com/ClickHouse/ClickHouse/pull/26475) ([Amos Bird](https://github.com/amosbird)) 。
* 修复 `partial_merge_join` 中未 join 的块流无限输出的问题，关闭 [#26325](https://github.com/ClickHouse/ClickHouse/issues/26325)。[#26374](https://github.com/ClickHouse/ClickHouse/pull/26374) ([Vladimir C](https://github.com/vdimir)) 。
* 修复以已删除用户身份登录时可能导致的崩溃。修复 [#26073](https://github.com/ClickHouse/ClickHouse/issues/26073)。[#26363](https://github.com/ClickHouse/ClickHouse/pull/26363) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了 `optimize_distributed_group_by_sharding_key` 在处理多列时的问题 (在 `optimize_skip_unused_shards=1`/`allow_nondeterministic_optimize_skip_unused_shards=1` 且分片键表达式中包含多列时，会导致结果不正确) 。[#26353](https://github.com/ClickHouse/ClickHouse/pull/26353) ([Azat Khuzhin](https://github.com/azat)) 。
* 从 `Date` 到 `DateTime` (或 `DateTime64`) 的 `CAST` 之前未使用 `DateTime` 类型的时区。这也可能影响 `Date` 与 `DateTime` 之间的比较。为 `Date` 和 `DateTime` 推断公共类型时，此前同样未使用相应的时区。这会影响函数 `if` 和数组构造的结果。关闭 [#24128](https://github.com/ClickHouse/ClickHouse/issues/24128)。[#24129](https://github.com/ClickHouse/ClickHouse/pull/24129) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了丢失副本恢复过程中的一个罕见错误，该错误可能导致副本间出现不一致。 [#26321](https://github.com/ClickHouse/ClickHouse/pull/26321) ([tavplubix](https://github.com/tavplubix)).
* 修复了在内部缓冲区末尾存在转义序列时 zstd 解压缩出错的问题。关闭 [#26013](https://github.com/ClickHouse/ClickHouse/issues/26013)。[#26314](https://github.com/ClickHouse/ClickHouse/pull/26314) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了 JOIN 与 totals 配合使用时的逻辑错误，关闭 [#26017](https://github.com/ClickHouse/ClickHouse/issues/26017)。[#26250](https://github.com/ClickHouse/ClickHouse/pull/26250) ([Vladimir C](https://github.com/vdimir)).
* 移除 `system.stack_trace` 表中 `thread_name` 列里的多余换行符。修复了 [#24124](https://github.com/ClickHouse/ClickHouse/issues/24124)。[#26210](https://github.com/ClickHouse/ClickHouse/pull/26210) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复 `LowCarinality` 列中的 `joinGet` 问题，关闭 [#25993](https://github.com/ClickHouse/ClickHouse/issues/25993)。[#26118](https://github.com/ClickHouse/ClickHouse/pull/26118) ([Vladimir C](https://github.com/vdimir)) 。
* 修复了在关闭 `validate_polygons` 设置时，`pointInPolygon` 可能崩溃的问题。[#26113](https://github.com/ClickHouse/ClickHouse/pull/26113) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复遍历不存在的远程目录时抛出异常的问题。[#26087](https://github.com/ClickHouse/ClickHouse/pull/26087) ([ianton-ru](https://github.com/ianton-ru)) 。
* 修复了 ZooKeeper 客户端中因 `abort` 导致的罕见 server 崩溃。修复 [#25813](https://github.com/ClickHouse/ClickHouse/issues/25813)。[#26079](https://github.com/ClickHouse/ClickHouse/pull/26079) ([alesapin](https://github.com/alesapin)).
* 修复了某些情况下右侧子查询 JOIN 的线程数估算错误。关闭 [#24075](https://github.com/ClickHouse/ClickHouse/issues/24075)。[#26052](https://github.com/ClickHouse/ClickHouse/pull/26052) ([Vladimir C](https://github.com/vdimir)) 。
* 修复了 ClickHouse 在查询执行期间发生异常时，通过 MySQL 协议数据包发送的 `sequence_id` 不正确的问题。这可能会导致 MySQL 客户端重置与 ClickHouse server 的连接。修复了 [#21184](https://github.com/ClickHouse/ClickHouse/issues/21184)。[#26051](https://github.com/ClickHouse/ClickHouse/pull/26051) ([tavplubix](https://github.com/tavplubix)).
* 修复将普通投影与 `PREWHERE` 一起使用时可能出现的 header 不匹配问题。修复 [#26020](https://github.com/ClickHouse/ClickHouse/issues/26020)。[#26038](https://github.com/ClickHouse/ClickHouse/pull/26038) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了将带有整数键的 `Map` 类型格式化为 `JSON` 时的问题。[#25982](https://github.com/ClickHouse/ClickHouse/pull/25982) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复查询分析器在堆栈展开期间可能出现的死锁问题。修复 [#25968](https://github.com/ClickHouse/ClickHouse/issues/25968)。[#25970](https://github.com/ClickHouse/ClickHouse/pull/25970) ([Maksim Kita](https://github.com/kitaisreal)).
* 修复了在使用错误参数调用 `dictGet()` 时发生崩溃的问题。[#25913](https://github.com/ClickHouse/ClickHouse/pull/25913) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复了 PostgreSQL 引擎的 `scram-sha-256` 身份验证问题。关闭 [#24516](https://github.com/ClickHouse/ClickHouse/issues/24516)。[#25906](https://github.com/ClickHouse/ClickHouse/pull/25906) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复后台池满载时后台任务退避时间过长的问题。修复了 [#25836](https://github.com/ClickHouse/ClickHouse/issues/25836)。[#25893](https://github.com/ClickHouse/ClickHouse/pull/25893) ([alesapin](https://github.com/alesapin)).
* 修复了在非默认页大小下 ARM 的异常处理问题。修复了 [#25512](https://github.com/ClickHouse/ClickHouse/issues/25512)、[#25044](https://github.com/ClickHouse/ClickHouse/issues/25044)、[#24901](https://github.com/ClickHouse/ClickHouse/issues/24901)、[#23183](https://github.com/ClickHouse/ClickHouse/issues/23183)、[#20221](https://github.com/ClickHouse/ClickHouse/issues/20221)、[#19703](https://github.com/ClickHouse/ClickHouse/issues/19703)、[#19028](https://github.com/ClickHouse/ClickHouse/issues/19028)、[#18391](https://github.com/ClickHouse/ClickHouse/issues/18391)、[#18121](https://github.com/ClickHouse/ClickHouse/issues/18121)、[#17994](https://github.com/ClickHouse/ClickHouse/issues/17994)、[#12483](https://github.com/ClickHouse/ClickHouse/issues/12483)。[#25854](https://github.com/ClickHouse/ClickHouse/pull/25854) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了 `remote()` 中 `sharding&#95;key` 使用不带函数的列时的问题 (此前，`select * from remote('127.1', system.one, dummy)` 会报 `Unknown column: dummy, there are only columns .` 错误) 。[#25824](https://github.com/ClickHouse/ClickHouse/pull/25824) ([Azat Khuzhin](https://github.com/azat)).
* 修复了从 `MaterializeMySQL` 查询时出现的 `Not found column ...` 和 `Missing column ...` 错误。修复了 [#23708](https://github.com/ClickHouse/ClickHouse/issues/23708)、[#24830](https://github.com/ClickHouse/ClickHouse/issues/24830) 和 [#25794](https://github.com/ClickHouse/ClickHouse/issues/25794)。[#25822](https://github.com/ClickHouse/ClickHouse/pull/25822) ([tavplubix](https://github.com/tavplubix)).
* 修复了 `optimize_skip_unused_shards_rewrite_in` 在非 `UInt64` 类型下的问题 (否则最终可能会选错分片，或抛出 `Cannot infer type of an empty tuple` 或 `Function tuple requires at least one argument`) 。[#25798](https://github.com/ClickHouse/ClickHouse/pull/25798) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了 `ReplicatedMergeTree` 表上 `DROP PART` 查询的一个罕见问题，该问题可能导致出现错误消息 `Unexpected merged part intersecting drop range`。[#25783](https://github.com/ClickHouse/ClickHouse/pull/25783) ([alesapin](https://github.com/alesapin)) 。
* 修复了 `TTL` 中带有 `GROUP BY` 表达式的一个缺陷：该缺陷会导致 `TTL` 在分片中首次执行后无法再次执行。[#25743](https://github.com/ClickHouse/ClickHouse/pull/25743) ([alesapin](https://github.com/alesapin)).
* 允许 StorageMerge 访问带别名的表。关闭 [#6051](https://github.com/ClickHouse/ClickHouse/issues/6051)。[#25694](https://github.com/ClickHouse/ClickHouse/pull/25694) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了某些情况下 dict join 较慢的问题，关闭 [#24209](https://github.com/ClickHouse/ClickHouse/issues/24209)。[#25618](https://github.com/ClickHouse/ClickHouse/pull/25618) ([Vladimir C](https://github.com/vdimir)).
* 修复对参与生存时间 (TTL) 表达式的列执行 `ALTER MODIFY COLUMN` 时的问题。[#25554](https://github.com/ClickHouse/ClickHouse/pull/25554) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了 `PREWHERE` 在非 UInt8 类型情况下的断言问题，关闭了 [#19589](https://github.com/ClickHouse/ClickHouse/issues/19589)。[#25484](https://github.com/ClickHouse/ClickHouse/pull/25484) ([Vladimir C](https://github.com/vdimir)) 。
* 修复了一些由模糊测试触发的 msan 崩溃问题。修复了 [#22517](https://github.com/ClickHouse/ClickHouse/issues/22517)。[#26428](https://github.com/ClickHouse/ClickHouse/pull/26428) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 更新 `clickhouse-server` Docker 入口点中的 `chown` 命令检查。修复了 Kubernetes 上的错误 '集群 pod (容器组) 重启失败 (或超时) '。[#26545](https://github.com/ClickHouse/ClickHouse/pull/26545) ([Ky Li](https://github.com/Kylinrix)) 。

<div id="clickhouse-release-v217-2021-07-09">
  ### ClickHouse 版本发布 v21.7，2021-07-09
</div>

<div id="backward-incompatible-change-3">
  #### 向后不兼容的变更
</div>

* 提升了带有显式定义的大型 Set 的查询性能。新增了兼容性设置 `legacy_column_name_of_tuple_literal`。在将集群从低于 21.7 的版本滚动升级到更高版本时，建议将其设为 `true`。否则，在升级期间，`IN` 子句中带有显式定义 Set 的分布式查询可能会失败。[#25371](https://github.com/ClickHouse/ClickHouse/pull/25371) ([Anton Popov](https://github.com/CurtizJ)).
* clickhouse-keeper (ZooKeeper 的一种实验性替代方案) 中的最大缓冲区大小发生了前向/后向不兼容变更。与其以后再改，不如现在就做 (在投入生产之前) 。[#25421](https://github.com/ClickHouse/ClickHouse/pull/25421) ([alesapin](https://github.com/alesapin)).

<div id="new-feature-3">
  #### 新特性
</div>

* 支持使用 YAML 格式进行配置，作为 XML 的替代方案。此更改关闭了 [#3607](https://github.com/ClickHouse/ClickHouse/issues/3607)。[#21858](https://github.com/ClickHouse/ClickHouse/pull/21858) ([BoloniniD](https://github.com/BoloniniD)).
* 提供了一种在数据 (可能) 仍然存在、但 ZooKeeper 元数据丢失时恢复复制表的方法。解决了 [#13458](https://github.com/ClickHouse/ClickHouse/issues/13458)。[#13652](https://github.com/ClickHouse/ClickHouse/pull/13652) ([Mike Kot](https://github.com/myrrc)).
* 在 Arrow/Parquet/ORC 中支持结构体和 Map，并在 Arrow 输入/输出格式中支持字典。引入了新设置 `output_format_arrow_low_cardinality_as_dictionary`。[#24341](https://github.com/ClickHouse/ClickHouse/pull/24341) ([Kruglov Pavel](https://github.com/Avogar)).
* 新增了对字典中 `Array` 类型的支持。[#25119](https://github.com/ClickHouse/ClickHouse/pull/25119) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增函数 `bitPositionsToArray`。关闭了 [#23792](https://github.com/ClickHouse/ClickHouse/issues/23792)。作者为 \[Kevin Wan] (@MaxWk)。[#25394](https://github.com/ClickHouse/ClickHouse/pull/25394) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增函数 `dateName`，用于返回诸如 'Friday' 或 'April' 之类的名称。作者为 \[Daniil Kondratyev] (@dankondr)。[#25372](https://github.com/ClickHouse/ClickHouse/pull/25372) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增 `toJSONString` 函数，用于将列序列化为其 JSON 表示。[#25164](https://github.com/ClickHouse/ClickHouse/pull/25164) ([Amos Bird](https://github.com/amosbird)).
* 现在，`query_log` 新增了两个列：`initial_query_start_time`、`initial_query_start_time_microsecond`，用于记录分布式查询的起始时间 (如果有) 。[#25022](https://github.com/ClickHouse/ClickHouse/pull/25022) ([Amos Bird](https://github.com/amosbird)).
* 新增聚合函数 `segmentLengthSum`。[#24250](https://github.com/ClickHouse/ClickHouse/pull/24250) ([flynn](https://github.com/ucasfl)).
* 新增一个布尔设置 `prefer_global_in_and_join`，默认将所有 IN/JOIN 都视为 GLOBAL IN/JOIN。[#23434](https://github.com/ClickHouse/ClickHouse/pull/23434) ([Amos Bird](https://github.com/amosbird)).
* `Join` table engine 现已支持 `ALTER DELETE` 查询。[#23260](https://github.com/ClickHouse/ClickHouse/pull/23260) ([foolchi](https://github.com/foolchi)).
* 新增 `quantileBFloat16` 聚合函数，以及对应的 `quantilesBFloat16` 和 `medianBFloat16`。这是一个非常简单且快速的分位数估计器，相对误差不超过 0.390625%。此更改关闭了 [#16641](https://github.com/ClickHouse/ClickHouse/issues/16641)。[#23204](https://github.com/ClickHouse/ClickHouse/pull/23204) ([Ivan Novitskiy](https://github.com/RedClusive)).
* 实现了 `sequenceNextNode()` 函数，可用于 `flow analysis`。[#19766](https://github.com/ClickHouse/ClickHouse/pull/19766) ([achimbab](https://github.com/achimbab)).

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 增加了对 HDFS 上虚拟 filesystem 的支持。[#11058](https://github.com/ClickHouse/ClickHouse/pull/11058) ([overshov](https://github.com/overshov)) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 现在，clickhouse-keeper (一种用于替代 ZooKeeper 的实验性方案) 已支持类似 ZooKeeper 的 `digest` ACL。[#24448](https://github.com/ClickHouse/ClickHouse/pull/24448) ([alesapin](https://github.com/alesapin)).

<div id="performance-improvement">
  #### 性能改进
</div>

* 新增了一项优化，可将某些函数转换为读取子列，从而减少读取数据量。例如，语句 `col IS NULL` 会被转换为读取子列 `col.null`。可通过设置 `optimize_functions_to_subcolumns` 启用该优化，目前默认关闭。[#24406](https://github.com/ClickHouse/ClickHouse/pull/24406) ([Anton Popov](https://github.com/CurtizJ)).
* 将更多列改写为可用的别名表达式。这可能带来更好的优化效果，例如投影。[#24405](https://github.com/ClickHouse/ClickHouse/pull/24405) ([Amos Bird](https://github.com/amosbird)).
* `bloom_filter` 类型的索引可用于包含常量数组的 `hasAny` 函数表达式。此项改动关闭了：[ #24291](https://github.com/ClickHouse/ClickHouse/issues/24291)。[#24900](https://github.com/ClickHouse/ClickHouse/pull/24900) ([Vasily Nemkov](https://github.com/Enmk)).
* 当 RabbitMQ 队列为空时，新增了指数退避机制，以重新调度读取尝试。 (ClickHouse 支持从 RabbitMQ 导入数据。) 关闭了 [#24340](https://github.com/ClickHouse/ClickHouse/issues/24340)。[#24415](https://github.com/ClickHouse/ClickHouse/pull/24415) ([Kseniia Sumarokova](https://github.com/kssenii)).

<div id="improvement">
  #### 改进
</div>

* 支持限制复制带宽。新增两个 Replicated\*MergeTree 设置：`max_replicated_fetches_network_bandwidth` 和 `max_replicated_sends_network_bandwidth`，用于限制表级复制拉取/发送的最大速度。新增两个服务器级设置 (位于 `default` 用户 profile 中) ：`max_replicated_fetches_network_bandwidth_for_server` 和 `max_replicated_sends_network_bandwidth_for_server`，用于限制所有表的复制最大速度。这些设置无法做到完全精确地生效。默认关闭。修复了 [#1821](https://github.com/ClickHouse/ClickHouse/issues/1821)。[#24573](https://github.com/ClickHouse/ClickHouse/pull/24573) ([alesapin](https://github.com/alesapin)) 。
* 为 ODBC 和 Library bridge 提供资源约束与隔离。为 bridge 进程使用单独的 `clickhouse-bridge` 用户组和用户。设置 oom\_score\_adj，以便这些 bridge 优先成为 OOM killer 的目标。将最大 RSS 设为 1 GiB。关闭 [#23861](https://github.com/ClickHouse/ClickHouse/issues/23861)。[#25280](https://github.com/ClickHouse/ClickHouse/pull/25280) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 为主 `clickhouse` 可执行文件添加独立的 `clickhouse-keeper` 符号链接。现在无需主 ClickHouse server 即可运行协调功能。[#24059](https://github.com/ClickHouse/ClickHouse/pull/24059) ([alesapin](https://github.com/alesapin)) 。
* 对 `VIEW` 的查询改为使用全局设置。修复了对 `VIEW` 的查询使用本地设置时的行为问题；如果 `CREATE VIEW` 和 `SELECT` 的设置不同，会导致错误。现在，`VIEW` 不会使用这些修改后的设置，但你仍然可以在 `CREATE VIEW` 查询的 `SETTINGS` 部分传递额外设置。关闭 [#20551](https://github.com/ClickHouse/ClickHouse/issues/20551)。[#24095](https://github.com/ClickHouse/ClickHouse/pull/24095) ([Vladimir](https://github.com/vdimir)).
* 服务器启动时，分区 ID 错误的 parts 不会被删除，而总是会被置为 detached。[#25070](https://github.com/ClickHouse/ClickHouse/issues/25070)。[#25166](https://github.com/ClickHouse/ClickHouse/pull/25166) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 将后台调度池大小增加到 128 (`background_schedule_pool_size` 设置) 。这样可以避免在 ZooKeeper 连接较慢时复制队列卡住。[#25072](https://github.com/ClickHouse/ClickHouse/pull/25072) ([alesapin](https://github.com/alesapin)).
* 新增 MergeTree 设置 `max_parts_to_merge_at_once`，用于限制后台一次可同时合并的 parts 数量。不影响 `OPTIMIZE FINAL` 查询。修复了 [#1820](https://github.com/ClickHouse/ClickHouse/issues/1820)。[#24496](https://github.com/ClickHouse/ClickHouse/pull/24496) ([alesapin](https://github.com/alesapin)) 。
* 允许将 `NOT IN` 运算符用于分区裁剪。[#24894](https://github.com/ClickHouse/ClickHouse/pull/24894) ([Amos Bird](https://github.com/amosbird)) 。
* 将类似 `127.0.1.1` 的 IPv4 地址识别为本地地址。此举存在争议，并解决了 [#23504](https://github.com/ClickHouse/ClickHouse/issues/23504)。Michael Filimonov 将测试这项功能。[#24316](https://github.com/ClickHouse/ClickHouse/pull/24316) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 使用 MaterializeMySQL 创建的 ClickHouse 数据库 (这是一项 Experimental 功能) 现已包含被物化的 MySQL 数据库中的所有列注释。[#25199](https://github.com/ClickHouse/ClickHouse/pull/25199) ([Storozhuk Kostiantyn](https://github.com/sand6255)).
* 为 MySQL 存储引擎新增设置项 (`connection_auto_close`/`connection_max_tries`/`connection_pool_size`) 。[#24146](https://github.com/ClickHouse/ClickHouse/pull/24146) ([Azat Khuzhin](https://github.com/azat)) 。
* 优化 Distributed 引擎的启动时间。[#25663](https://github.com/ClickHouse/ClickHouse/pull/25663) ([Azat Khuzhin](https://github.com/azat)) 。
* 分布式表改进。对于 internal\_replication=true，不再将副本包含在 dirname 中 (这样可对带有 cluster 的 Distributed 执行 INSERT，而不受副本数量限制；此前仅支持 15 个副本，超过后在为异步块创建目录时会因 ENAMETOOLONG 而失败) 。[#25513](https://github.com/ClickHouse/ClickHouse/pull/25513) ([Azat Khuzhin](https://github.com/azat)).
* 为 `LowCardinality` 新增了对 `Interval` 类型的支持。这对于某些表达式的中间值是必需的。关闭了 [#21730](https://github.com/ClickHouse/ClickHouse/issues/21730)。[#25410](https://github.com/ClickHouse/ClickHouse/pull/25410) ([Vladimir](https://github.com/vdimir)) 。
* 为 `sequenceMatch` 和 `sequenceCount` 函数的时间 conditions 添加 `==` operator。例如：sequenceMatch('(?1)(?t==1)(?2)')(time, data = 1, data = 2)。[#25299](https://github.com/ClickHouse/ClickHouse/pull/25299) ([Christophe Kalenzaga](https://github.com/mga-chka)).
* 新增设置 `http_max_fields`、`http_max_field_name_size`、`http_max_field_value_size`。[#25296](https://github.com/ClickHouse/ClickHouse/pull/25296) ([Ivan](https://github.com/abyss7)) 。
* 为函数 `if` 增加了对其分支使用 `Decimal` 和 `Int` 类型的支持。此更改关闭了 [#20549](https://github.com/ClickHouse/ClickHouse/issues/20549)。此更改关闭了 [#10142](https://github.com/ClickHouse/ClickHouse/issues/10142)。[#25283](https://github.com/ClickHouse/ClickHouse/pull/25283) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 更新 `clickhouse-client` 中的提示符，并在重新连接时显示提示信息。此项修复关闭了 [#10577](https://github.com/ClickHouse/ClickHouse/issues/10577)。[#25281](https://github.com/ClickHouse/ClickHouse/pull/25281) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修正了聚合函数 `topK` 中的内存跟踪问题。此修复关闭了 [#25259](https://github.com/ClickHouse/ClickHouse/issues/25259)。[#25260](https://github.com/ClickHouse/ClickHouse/pull/25260) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了 IDN 主机 (即 `example.рф`) 的 `topLevelDomain` 问题，此前这类主机会返回空字符串。[#25103](https://github.com/ClickHouse/ClickHouse/pull/25103) ([Azat Khuzhin](https://github.com/azat)) 。
* 在运行时检测 Linux 内核版本 (为使嵌套 epoll 正常工作，`async_socket_for_remote`/`use_hedged_requests` 需要这样做，否则远程查询可能会卡住) 。[#25067](https://github.com/ClickHouse/ClickHouse/pull/25067) ([Azat Khuzhin](https://github.com/azat)) 。
* 对于分布式查询，当 `optimize_skip_unused_shards=1` 时，支持通过类似 `(sharding key) IN (one-element-tuple)` 的条件跳过分片。 (此前已支持多元素的 Tuple。单元素的 Tuple 无法生效，因为它会被解析为字面量) 。[#24930](https://github.com/ClickHouse/ClickHouse/pull/24930) ([Amos Bird](https://github.com/amosbird)) 。
* 改进了 S3 错误的日志消息；当键和存储桶为空时，不再出现双空格。[#24897](https://github.com/ClickHouse/ClickHouse/pull/24897) ([Vladimir Chebotarev](https://github.com/excitoon)).
* 某些查询需要经过多轮语义分析。在这种情况下，尝试对 `IN` 复用已构建的 Set。[#24874](https://github.com/ClickHouse/ClickHouse/pull/24874) ([Amos Bird](https://github.com/amosbird)).
* 让 `insert_distributed_sync` 遵守 `max_distributed_connections` 限制 (否则在超大规模集群中进行同步插入时，可能会耗尽 `max_thread_pool_size`) 。[#24754](https://github.com/ClickHouse/ClickHouse/pull/24754) ([Azat Khuzhin](https://github.com/azat)) 。
* 避免隐藏标量子查询中的 `Limit for rows or bytes to read exceeded` 等错误。[#24545](https://github.com/ClickHouse/ClickHouse/pull/24545) ([nvartolomei](https://github.com/nvartolomei)) 。
* 让 String 转 Int 的解析器更严格一些，这样 `toInt64('+')` 就会抛出异常。[#24475](https://github.com/ClickHouse/ClickHouse/pull/24475) ([Amos Bird](https://github.com/amosbird)) 。
* 如果通过 DDL 查询创建 `SSD_CACHE`，则只能在 `user_files` 目录中创建它。[#24466](https://github.com/ClickHouse/ClickHouse/pull/24466) ([Maksim Kita](https://github.com/kitaisreal)) 。
* PostgreSQL 现已支持为 insert 查询指定非默认 schema。关闭 [#24149](https://github.com/ClickHouse/ClickHouse/issues/24149)。[#24413](https://github.com/ClickHouse/ClickHouse/pull/24413) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复 IPv6 地址解析异常的问题 (即修复了 `select * from remote('[::1]', system.one)`) 。[#24319](https://github.com/ClickHouse/ClickHouse/pull/24319) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了多行模式下 FROM 子句中包含子查询时的尾随空白问题，并以更便于理解的方式对查询输出做了细微调整。[#24151](https://github.com/ClickHouse/ClickHouse/pull/24151) ([Azat Khuzhin](https://github.com/azat)).
* 分布式表改进。新增支持在发生故障时拆分分布式批次 (例如由于内存限制或数据损坏) ，由 `distributed_directory_monitor_split_batch_on_failure` 控制 (默认关闭) 。[#23864](https://github.com/ClickHouse/ClickHouse/pull/23864) ([Azat Khuzhin](https://github.com/azat)) 。
* 解决 `Join` 表引擎中的列名冲突。关闭 [#20309](https://github.com/ClickHouse/ClickHouse/issues/20309)。[#23769](https://github.com/ClickHouse/ClickHouse/pull/23769) ([Vladimir](https://github.com/vdimir)) 。
* 当数据通过 stdin 传入时，在 `clickhouse-local` 中为 `File` 表引擎显示进度，并在 `clickhouse-client` 中为 INSERT 查询显示进度。关闭 [#18209](https://github.com/ClickHouse/ClickHouse/issues/18209)。[#23656](https://github.com/ClickHouse/ClickHouse/pull/23656) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 修复并改进了 `clickhouse-copier`。现在允许复制 schema 不同 (但兼容) 的表。关闭 [#9159](https://github.com/ClickHouse/ClickHouse/issues/9159)。新增了复制 ReplacingMergeTree 的测试。关闭 [#22711](https://github.com/ClickHouse/ClickHouse/issues/22711)。支持列上的生存时间 (TTL) 和数据跳过索引。为创建内部 Distributed 表，会直接将其移除 (底层表仍会保留生存时间 (TTL) 和跳过索引) 。关闭 [#19384](https://github.com/ClickHouse/ClickHouse/issues/19384)。现在允许复制 MATERIALIZED 和 ALIAS 列。在某些情况下，这会很有用 (例如该列位于 PRIMARY KEY 中时) 。现在可以通过在任务配置中将 `allow_to_copy_alias_and_materialized_columns` 属性设为 true 来启用此功能。关闭 [#9177](https://github.com/ClickHouse/ClickHouse/issues/9177)。关闭 \[#11007] ([https://github.com/ClickHouse/ClickHouse/issues/11007)。关闭](https://github.com/ClickHouse/ClickHouse/issues/11007\)。关闭) [#9514](https://github.com/ClickHouse/ClickHouse/issues/9514)。在任务配置中新增了属性 `allow_to_drop_target_partitions`，用于在移动辅助表之前删除原始表中的分区。关闭 [#20957](https://github.com/ClickHouse/ClickHouse/issues/20957)。移除了 `OPTIMIZE DEDUPLICATE` 查询。之所以需要这个临时方案，是因为 `ALTER TABLE MOVE PARTITION` 会重试很多次，而普通的 MergeTree 表不具备去重能力。关闭 [#17966](https://github.com/ClickHouse/ClickHouse/issues/17966)。将进度以 JSON 格式写入路径为 `task_path + /status` 的 ZooKeeper 节点。关闭 [#20955](https://github.com/ClickHouse/ClickHouse/issues/20955)。支持不带参数的 Replicated 表。关闭 [#24834](https://github.com/ClickHouse/ClickHouse/issues/24834) .[#23518](https://github.com/ClickHouse/ClickHouse/pull/23518) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 在从 S3 读取时的重试之间，新增了带退避机制的休眠等待。 [#23461](https://github.com/ClickHouse/ClickHouse/pull/23461) ([Vladimir Chebotarev](https://github.com/excitoon)).
* 对 `Distributed` 表执行 INSERT 时，会遵循 `insert_allow_materialized_columns` (允许物化列) 设置。[#23349](https://github.com/ClickHouse/ClickHouse/pull/23349) ([Azat Khuzhin](https://github.com/azat)).
* 新增支持在分布式查询中下推 LIMIT。[#23027](https://github.com/ClickHouse/ClickHouse/pull/23027) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复多个 S3 卷场景下的零拷贝复制问题 (修复了 [#22679](https://github.com/ClickHouse/ClickHouse/issues/22679)) 。[#22864](https://github.com/ClickHouse/ClickHouse/pull/22864) ([ianton-ru](https://github.com/ianton-ru)) 。
* 当用户向操作系统请求任意可用端口时，确定实际绑定的端口号，并将其显示在日志消息中。[#25569](https://github.com/ClickHouse/ClickHouse/pull/25569) ([bnaecker](https://github.com/bnaecker)).
* 修复了以下问题：有时 Postgres 数组转换后会变成 String 数据类型，而不是 n 维数组，因为 `attndims` 在某些情况下不能正确工作。关闭 [#24804](https://github.com/ClickHouse/ClickHouse/issues/24804)。[#25538](https://github.com/ClickHouse/ClickHouse/pull/25538) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复 MySQL、PostgreSQL 和 ODBC 中带时区的 DateTime 转换问题。关闭 [#5057](https://github.com/ClickHouse/ClickHouse/issues/5057)。[#25528](https://github.com/ClickHouse/ClickHouse/pull/25528) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 区分不同表的 KILL MUTATION (修复了意外出现的 `Cancelled mutating parts` 错误) 。[#25025](https://github.com/ClickHouse/ClickHouse/pull/25025) ([Azat Khuzhin](https://github.com/azat)).
* 允许在 bucket 根目录下声明 S3 磁盘 (S3 虚拟文件系统是一项仍在开发中的实验性功能) 。[#24898](https://github.com/ClickHouse/ClickHouse/pull/24898) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 支持读取分布式表中的子列 (例如 Tuple 的各个元素) 。[#24472](https://github.com/ClickHouse/ClickHouse/pull/24472) ([Anton Popov](https://github.com/CurtizJ)).
* 一项面向 MySQL 兼容协议的功能改进：使 `user` 函数返回正确的结果。关闭 [#25697](https://github.com/ClickHouse/ClickHouse/pull/25697)。[#25697](https://github.com/ClickHouse/ClickHouse/pull/25697) ([sundyli](https://github.com/sundy-li)) 。

<div id="bug-fixes">
  #### 问题修复
</div>

* 改进了向后兼容性。在分区键中使用时，改用旧版 modulo 函数。关闭 [#23508](https://github.com/ClickHouse/ClickHouse/issues/23508)。[#24157](https://github.com/ClickHouse/ClickHouse/pull/24157) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 修复了低内存服务器上一个极其罕见的问题，该问题可能导致在不重启的情况下无法执行合并。也可能修复了 [#24603](https://github.com/ClickHouse/ClickHouse/issues/24603)。[#24872](https://github.com/ClickHouse/ClickHouse/pull/24872) ([alesapin](https://github.com/alesapin)).
* 修复了在并发执行 `alter move/replace partition` 时，复制队列中极其罕见的错误 `Tagging already tagged part`。可能也修复了 [#22142](https://github.com/ClickHouse/ClickHouse/issues/22142)。[#24961](https://github.com/ClickHouse/ClickHouse/pull/24961) ([alesapin](https://github.com/alesapin)) 。
* 修复了在通过对其他 aggregate function 的 aggregate function state 进行 aggregation 来计算 aggregate function state 时可能发生的崩溃问题 (这并非实际使用场景) 。参见 [#24523](https://github.com/ClickHouse/ClickHouse/issues/24523)。[#25015](https://github.com/ClickHouse/ClickHouse/pull/25015) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了查询 `SYSTEM RESTART REPLICA` 或 `SYSTEM SYNC REPLICA` 无法结束时的异常行为。该问题是在 RAM 极低的服务器上发现的。[#24457](https://github.com/ClickHouse/ClickHouse/pull/24457) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 修复了一个可能导致 clickhouse-server 内部的 ZooKeeper 客户端卡住的问题。[#24721](https://github.com/ClickHouse/ClickHouse/pull/24721) ([alesapin](https://github.com/alesapin)) 。
* 如果 ZooKeeper 连接丢失，且在连接恢复后克隆了副本，其复制队列中可能包含过期条目。修复了复制队列包含相交的 virtual parts 时导致的断言失败。若某个数据分区片段丢失，极少数情况下可能会发生这种情况。现在会将错误记录到日志中，而不是直接终止。[#24777](https://github.com/ClickHouse/ClickHouse/pull/24777) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了查询计划中表达式下推优化导致 `WHERE` 条件丢失的问题 (默认将 `query_plan_filter_push_down = 1` 设为启用) 。修复了 [#25368](https://github.com/ClickHouse/ClickHouse/issues/25368)。[#25370](https://github.com/ClickHouse/ClickHouse/pull/25370) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了一个可能导致在带有生存时间 (TTL) 的合并后出现重叠 parts 的错误：`Part all_40_40_0 is covered by all_40_40_1 but should be merged into all_40_41_1. This shouldn't happen often.`。[#25549](https://github.com/ClickHouse/ClickHouse/pull/25549) ([alesapin](https://github.com/alesapin)) 。
* 当 ZooKeeper 连接丢失时，`ReplicatedMergeTree` 表在尝试重新连接前，可能会等待后台操作完成。此问题已修复，现在会强制停止后台操作。[#25306](https://github.com/ClickHouse/ClickHouse/pull/25306) ([tavplubix](https://github.com/tavplubix)).
* 修复了在数组用作主键时，带有 `ARRAY JOIN` 的查询出现 `Key expression contains comparison between inconvertible types` 错误的问题。修复 [#8247](https://github.com/ClickHouse/ClickHouse/issues/8247)。[#25546](https://github.com/ClickHouse/ClickHouse/pull/25546) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复查询 `WITH TOTALS` 和 `WITH FILL` 中总计结果错误的问题。修复了 [#20872](https://github.com/ClickHouse/ClickHouse/issues/20872)。[#25539](https://github.com/ClickHouse/ClickHouse/pull/25539) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了在查询 `system.clusters` 的同时重新加载集群配置时出现的数据竞争问题。[#25737](https://github.com/ClickHouse/ClickHouse/pull/25737) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了在数据库之间移动 `Distributed` 表时出现的 `No such file or directory` 错误。已修复 [#24971](https://github.com/ClickHouse/ClickHouse/issues/24971)。[#25667](https://github.com/ClickHouse/ClickHouse/pull/25667) ([tavplubix](https://github.com/tavplubix)) 。
* 在极少数情况下，如果源分区为空，`REPLACE PARTITION` 可能会被忽略。此问题现已修复。修复了 [#24869](https://github.com/ClickHouse/ClickHouse/issues/24869)。[#25665](https://github.com/ClickHouse/ClickHouse/pull/25665) ([tavplubix](https://github.com/tavplubix)).
* 修复了 `Replicated` 数据库引擎中的一个缺陷：在极少数情况下，该缺陷可能导致某些副本跳过队列中的 DDL 查询。[#24805](https://github.com/ClickHouse/ClickHouse/pull/24805) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了在未提供查询时执行 `EXPLAIN AST` 会发生空指针解引用的问题。[#25631](https://github.com/ClickHouse/ClickHouse/pull/25631) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了自动删除空 parts 时的等待问题。该问题可能导致 background pool 被完全占满，并使复制卡住。[#23315](https://github.com/ClickHouse/ClickHouse/pull/23315) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了存储在 S3 虚拟文件系统中的表在恢复时出现的问题 (这是一项尚未适用于生产环境的实验性功能) 。[#25601](https://github.com/ClickHouse/ClickHouse/pull/25601) ([ianton-ru](https://github.com/ianton-ru)) 。
* 修复在使用 `Decimal256` 时 `Arrow` 格式中的空指针解引用问题。为 `Arrow` 格式添加对 `Decimal256` 的支持。[#25531](https://github.com/ClickHouse/ClickHouse/pull/25531) ([Kruglov Pavel](https://github.com/Avogar)).
* 修复了预处理配置文件名称前多余下划线的问题。[#25431](https://github.com/ClickHouse/ClickHouse/pull/25431) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 针对 `clickhouse-copier` 工具的一项修复：修复了 copier 的 task 配置中缺少 sharding\_key 时会发生段错误的问题。[#25419](https://github.com/ClickHouse/ClickHouse/pull/25419) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复了在 DDL 中使用 `REPLACE` 列转换器时，因未正确为格式化后的查询加引号而导致的问题。此修复解决了 [#23925](https://github.com/ClickHouse/ClickHouse/issues/23925)。[#25391](https://github.com/ClickHouse/ClickHouse/pull/25391) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了 `quantileDeterministic` 函数及类似函数可能存在的非确定性行为问题。此修复关闭了 [#20480](https://github.com/ClickHouse/ClickHouse/issues/20480)。[#25313](https://github.com/ClickHouse/ClickHouse/pull/25313) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 支持在 `SummingMergeTree` 中使用 `SimpleAggregateFunction(LowCardinality)`。修复了 [#25134](https://github.com/ClickHouse/ClickHouse/issues/25134)。[#25300](https://github.com/ClickHouse/ClickHouse/pull/25300) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复异常消息 "Cannot sum Array/Tuple in min/maxMap" 的逻辑错误。[#25298](https://github.com/ClickHouse/ClickHouse/pull/25298) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 修复了在 IN 中使用 `LowCardinality` 参数时，查询出现的错误 `Bad cast from type DB::ColumnLowCardinality to DB::ColumnVector<char8_t>` (该问题出现在 21.6 中) 。修复 [#25187](https://github.com/ClickHouse/ClickHouse/issues/25187)。[#25290](https://github.com/ClickHouse/ClickHouse/pull/25290) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 `joinGetOrNull` 在非 Nullable 列上的错误行为。此项修复解决了 [#24261](https://github.com/ClickHouse/ClickHouse/issues/24261)。[#25288](https://github.com/ClickHouse/ClickHouse/pull/25288) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了大整数中的错误行为以及 UBSan 报告的问题。在之前的版本中，`CAST(1e19 AS UInt128)` 会返回零。[#25279](https://github.com/ClickHouse/ClickHouse/pull/25279) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了使用 CSVWithNames 格式插入部分列时出现的错误。修复 [#25129](https://github.com/ClickHouse/ClickHouse/issues/25129)。[#25169](https://github.com/ClickHouse/ClickHouse/pull/25169) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 不要在带有 `FINAL` 的 `SELECT` 中使用表的投影。目前尚不支持。[#25163](https://github.com/ClickHouse/ClickHouse/pull/25163) ([Amos Bird](https://github.com/amosbird)).
* 修复了以下问题：如果表的分区键使用了 `UUID`，升级到 21.5 后可能会发生 parts 丢失。 (不建议在分区键中使用 `UUID`。) 修复 [#25070](https://github.com/ClickHouse/ClickHouse/issues/25070)。[#25127](https://github.com/ClickHouse/ClickHouse/pull/25127) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了在包含 cross join 且 `joined_subquery_requires_alias = 0` 的查询中发生的崩溃。修复了 [#24011](https://github.com/ClickHouse/ClickHouse/issues/24011)。[#25082](https://github.com/ClickHouse/ClickHouse/pull/25082) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 `mapContains` 函数中常量 Map 处理不当的问题，该问题会导致报错 `empty column was returned by function mapContains`。关闭 [#25077](https://github.com/ClickHouse/ClickHouse/issues/25077)。[#25080](https://github.com/ClickHouse/ClickHouse/pull/25080) ([Kruglov Pavel](https://github.com/Avogar)).
* 不再允许创建包含自引用列的表，例如 `a UInt32 ALIAS a + 1` 或 `b UInt32 MATERIALIZED b`。修复了 [#24910](https://github.com/ClickHouse/ClickHouse/issues/24910)、[#24292](https://github.com/ClickHouse/ClickHouse/issues/24292)。[#25059](https://github.com/ClickHouse/ClickHouse/pull/25059) ([alesapin](https://github.com/alesapin)) 。
* 修复了使用带有*非空* `GROUP BY` 键的聚合投影来执行按*空*键进行 `GROUP BY` 的查询时结果错误的问题。[#25055](https://github.com/ClickHouse/ClickHouse/pull/25055) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了 Protobuf 格式中拆分后的嵌套消息的序列化问题。此 PR 修复了 [#24647](https://github.com/ClickHouse/ClickHouse/issues/24647)。[#25000](https://github.com/ClickHouse/ClickHouse/pull/25000) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复分布式查询的 limit/offset 设置问题 (在远程节点上忽略) 。[#24940](https://github.com/ClickHouse/ClickHouse/pull/24940) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复 `Arrow` 格式中可能的堆缓冲区溢出问题。[#24922](https://github.com/ClickHouse/ClickHouse/pull/24922) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 修复了从 DiskS3 读取文件时可能出现的 'Cannot read from istream at offset 0' 错误 (S3 虚拟文件系统是一项尚在开发中的 Experimental 功能，不应在生产环境中使用) 。[#24885](https://github.com/ClickHouse/ClickHouse/pull/24885) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* 修复连接分布式 materialized view 时出现的“缺少列”异常。[#24870](https://github.com/ClickHouse/ClickHouse/pull/24870) ([Azat Khuzhin](https://github.com/azat)) 。
* 在 PostgreSQL 兼容协议中允许 `NULL` 值。关闭了 [#22622](https://github.com/ClickHouse/ClickHouse/issues/22622)。[#24857](https://github.com/ClickHouse/ClickHouse/pull/24857) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了这样一个 bug：在等待变更时，如果变更尚未加载到内存中，可能会向客户端抛出异常 `Mutation was killed`。[#24809](https://github.com/ClickHouse/ClickHouse/pull/24809) ([alesapin](https://github.com/alesapin)).
* 修复了随机生成器状态反序列化中的一个问题，该问题可能导致某些数据类型 (例如 `AggregateFunction(groupArraySample(N), T))`) 出现非确定性行为。[#24538](https://github.com/ClickHouse/ClickHouse/pull/24538) ([tavplubix](https://github.com/tavplubix)).
* 禁止基于其他聚合状态构建 uniqXXXXStates。[#24523](https://github.com/ClickHouse/ClickHouse/pull/24523) ([Raúl Marín](https://github.com/Algunenano)) 。随后通过彻底消除相关问题的根本原因，重新允许这样做。 ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复 `CREATE .. AS SELECT` 查询中使用元组时的问题。[#24464](https://github.com/ClickHouse/ClickHouse/pull/24464) ([Anton Popov](https://github.com/CurtizJ)).
* 修复 `Buffer` 表中总字节数计算的问题。在当前版本的 ClickHouse 中，`total&#95;writes.bytes` 计数器在缓冲区 flush 期间下降过多，导致计数器溢出，并使 `totalBytes` 在 flush 后一段时间内返回大约 17.44 EB 的值。[#24450](https://github.com/ClickHouse/ClickHouse/pull/24450) ([DimasKovas](https://github.com/DimasKovas)).
* 修正了关于 `toWeek` 函数单调性的错误信息。此修复解决了 [#24422](https://github.com/ClickHouse/ClickHouse/issues/24422)。该 bug 是在 [https://github.com/ClickHouse/ClickHouse/pull/5212](https://github.com/ClickHouse/ClickHouse/pull/5212) 中引入的，之后被更智能的分区裁剪器发现。[#24446](https://github.com/ClickHouse/ClickHouse/pull/24446) ([Amos Bird](https://github.com/amosbird)).
* 当用户身份验证由 LDAP 管理时，修复了一个潜在死锁：如果 LDAP 组映射到不存在的本地角色，则在 LDAP 角色 (重新) 映射期间可能发生该问题。[#24431](https://github.com/ClickHouse/ClickHouse/pull/24431) ([Denis Glazachev](https://github.com/traceon)) 。
* 在 "multipart/form-data" 消息中，将边界前面的 CRLF 视为边界的一部分。修复了 [#23905](https://github.com/ClickHouse/ClickHouse/issues/23905)。[#24399](https://github.com/ClickHouse/ClickHouse/pull/24399) ([Ivan](https://github.com/abyss7)) 。
* 修复删除带有 intersect 伪 parts 的分区时出现的问题。在极少数情况下，可能会存在变更版本大于当前块编号的 parts。[#24321](https://github.com/ClickHouse/ClickHouse/pull/24321) ([Amos Bird](https://github.com/amosbird)).
* 修复了将 materialized view 从 Ordinary database 移动到 Atomic database 时的一个 bug (`RENAME TABLE` 查询) 。现在，内部表会随 materialized view 一起移动到新 database。修复了 [#23926](https://github.com/ClickHouse/ClickHouse/issues/23926)。[#24309](https://github.com/ClickHouse/ClickHouse/pull/24309) ([tavplubix](https://github.com/tavplubix)).
* 允许空 HTTP 请求头。修复了 [#23901](https://github.com/ClickHouse/ClickHouse/issues/23901)。[#24285](https://github.com/ClickHouse/ClickHouse/pull/24285) ([Ivan](https://github.com/abyss7)) 。
* 修复了 Memory 表中变更 (ALTER UPDATE/DELETE) 的正确处理问题。关闭 [#24274](https://github.com/ClickHouse/ClickHouse/issues/24274)。[#24275](https://github.com/ClickHouse/ClickHouse/pull/24275) ([flynn](https://github.com/ucasfl)) 。
* 使 JOIN 输出中的 LowCardinality 列属性与输入保持一致，关闭 [#23351](https://github.com/ClickHouse/ClickHouse/issues/23351) 和 [#20315](https://github.com/ClickHouse/ClickHouse/issues/20315)。[#24061](https://github.com/ClickHouse/ClickHouse/pull/24061) ([Vladimir](https://github.com/vdimir)).
* 针对 Kafka 表的修复。修复了故障转移行为中的一个缺陷：当 `Engine = Kafka` 时，如果同一消费者此前的分配为空，则无法开始消费。关闭 [#21118](https://github.com/ClickHouse/ClickHouse/issues/21118)。[#21267](https://github.com/ClickHouse/ClickHouse/pull/21267) ([filimonov](https://github.com/filimonov)) 。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 在 CI 中添加 `darwin-aarch64` (Mac M1 / Apple Silicon) 构建 [#25560](https://github.com/ClickHouse/ClickHouse/pull/25560) ([Ivan](https://github.com/abyss7)) ，并将相关链接加入文档和网站 ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 新增跨平台将二进制资源嵌入可执行文件的功能，并已在 Illumos 上验证可用。[#25146](https://github.com/ClickHouse/ClickHouse/pull/25146) ([bnaecker](https://github.com/bnaecker)) 。
* 在压力测试中添加与 join 相关的选项，以改进模糊测试。[#25200](https://github.com/ClickHouse/ClickHouse/pull/25200) ([Vladimir](https://github.com/vdimir)) 。
* 在 osx 上启用带 S3 模块的构建 [#25217](https://github.com/ClickHouse/ClickHouse/issues/25217)。[#25218](https://github.com/ClickHouse/ClickHouse/pull/25218) ([kevin wan](https://github.com/MaxWk)) 。
* 添加覆盖 JDBC bridge 的集成测试用例。[#25047](https://github.com/ClickHouse/ClickHouse/pull/25047) ([Zhichun Wu](https://github.com/zhicwu)) 。
* 集成测试 configuration 对字典有特殊处理。移除了其余字典的手动设置。[#24728](https://github.com/ClickHouse/ClickHouse/pull/24728) ([Ilya Yatsishin](https://github.com/qoega)) 。
* 为 YAMLParser 类添加 libfuzzer 测试。[#24480](https://github.com/ClickHouse/ClickHouse/pull/24480) ([BoloniniD](https://github.com/BoloniniD)) 。
* 现在使用 Ubuntu 20.04 运行集成测试，运行集成测试所用的 docker-compose 版本已更新至 1.28.2。环境变量现在可在 docker-compose 中生效。重构 test\_dictionaries\_all\_layouts\_separate\_sources 以支持并行运行。[#20393](https://github.com/ClickHouse/ClickHouse/pull/20393) ([Ilya Yatsishin](https://github.com/qoega)) 。
* 修复安装脚本中的 TOCTOU 错误。[#25277](https://github.com/ClickHouse/ClickHouse/pull/25277) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。

<div id="clickhouse-release-216-2021-06-05">
  ### ClickHouse 版本发布 21.6，2021-06-05
</div>

<div id="backward-incompatible-change-3">
  #### 向后不兼容的变更
</div>

* uniqState / uniqHLL12State / uniqCombinedState / uniqCombined64State 生成的状态与 `UUID` 类型不兼容。[#33607](https://github.com/ClickHouse/ClickHouse/issues/33607)。

<div id="upgrade-notes">
  #### 升级说明
</div>

* `zstd` 压缩库已更新至 v1.5.0。你可能会在复制过程中看到“checksum does not match”消息。这是由于压缩算法更新所致，属于预期现象，可以忽略。这些消息仅供提示，并不表示存在任何异常行为。
* 设置 `compile_expressions` 现已默认启用。尽管它已在多种场景下经过充分测试，但如果你在服务器上发现任何异常行为，可以尝试关闭该设置。
* `UUID` 类型的值不能与整数进行比较。例如，不要写 `uuid != 0`，而应写成 `uuid != '00000000-0000-0000-0000-000000000000'`。

<div id="new-feature-3">
  #### 新特性
</div>

* 新增类似 Postgres 的类型转换运算符 (`::`) 。例如：`[1, 2]::Array(UInt8)`、`0.1::Decimal(4, 4)`、`number::UInt16`。[#23871](https://github.com/ClickHouse/ClickHouse/pull/23871) ([Anton Popov](https://github.com/CurtizJ)) 。
* 使大整数达到生产可用状态。新增对 `UInt128` 数据类型的支持。修复 `Decimal256` 数据类型的已知问题。支持在字典中使用大整数。`gcd`/`lcm` 函数现已支持大整数。支持在数组搜索和条件函数中使用大整数。支持 `LowCardinality(UUID)`。在 `generateRandom` 表函数和 `clickhouse-obfuscator` 中支持大整数。修复从标量子查询返回 `UUID` 时的错误。此项修复了 [#7834](https://github.com/ClickHouse/ClickHouse/issues/7834)。此项修复了 [#23936](https://github.com/ClickHouse/ClickHouse/issues/23936)。此项修复了 [#4176](https://github.com/ClickHouse/ClickHouse/issues/4176)。此项修复了 [#24018](https://github.com/ClickHouse/ClickHouse/issues/24018)。向后不兼容的变更：`UUID` 类型的值不能与整数比较。例如，不要写 `uuid != 0`，而应写成 `uuid != '00000000-0000-0000-0000-000000000000'`。[#23631](https://github.com/ClickHouse/ClickHouse/pull/23631) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 支持在 `Arrow`、`Parquet` 和 `ORC` 格式中插入和查询 `Array` 数据类型。[#21770](https://github.com/ClickHouse/ClickHouse/pull/21770) ([taylor12805](https://github.com/taylor12805)).
* 支持表注释。已关闭 [#23225](https://github.com/ClickHouse/ClickHouse/issues/23225)。[#23548](https://github.com/ClickHouse/ClickHouse/pull/23548) ([flynn](https://github.com/ucasFL)) 。
* 支持在 `clickhouse-local` 中通过 DDL 查询创建字典。关闭 [#22354](https://github.com/ClickHouse/ClickHouse/issues/22354)。新增对 `DETACH DICTIONARY PERMANENTLY` 的支持。为 `Atomic` 数据库引擎新增对 `EXCHANGE DICTIONARIES` 的支持。新增支持使用 `RENAME DICTIONARY` 在数据库之间移动字典。[#23436](https://github.com/ClickHouse/ClickHouse/pull/23436) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增聚合函数 `uniqTheta`，以支持 ClickHouse 中的 [Theta Sketch](https://datasketches.apache.org/docs/Theta/ThetaSketchFramework.html)。[#23894](https://github.com/ClickHouse/ClickHouse/pull/23894)。[#22609](https://github.com/ClickHouse/ClickHouse/pull/22609) ([Ping Yu](https://github.com/pingyu)) 。
* 新增函数 `splitByRegexp`。[#24077](https://github.com/ClickHouse/ClickHouse/pull/24077) ([abel-cheng](https://github.com/abel-cheng)) 。
* 新增函数 `arrayProduct`，该函数接受一个数组参数，并返回数组中所有元素的乘积。关闭 [#21613](https://github.com/ClickHouse/ClickHouse/issues/21613)。[#23782](https://github.com/ClickHouse/ClickHouse/pull/23782) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 在 `system.stack_trace` 中新增 `thread_name` 列。该改动修复了 [#23256](https://github.com/ClickHouse/ClickHouse/issues/23256)。[#24124](https://github.com/ClickHouse/ClickHouse/pull/24124) ([abel-cheng](https://github.com/abel-cheng)) 。
* 如果 `insert_null_as_default` = 1，则在 `INSERT ... SELECT` 和 `INSERT ... SELECT ... UNION ALL ...` 查询中插入默认值而不是 NULL。关闭 [#22832](https://github.com/ClickHouse/ClickHouse/issues/22832)。[#23524](https://github.com/ClickHouse/ClickHouse/pull/23524) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 为 `clickhouse-local` 新增 `--progress` 选项，以显示进度。[#23196](https://github.com/ClickHouse/ClickHouse/pull/23196) ([Egor Savin](https://github.com/Amesaru)) 。
* 为 `http` 字典源添加了对 HTTP 压缩 (由 `Content-Encoding` HTTP 请求头决定) 的支持。此更改修复了 [#8912](https://github.com/ClickHouse/ClickHouse/issues/8912)。[#23946](https://github.com/ClickHouse/ClickHouse/pull/23946) ([FArthur-cmd](https://github.com/FArthur-cmd))。
* 新增了 `SYSTEM QUERY RELOAD MODEL`、`SYSTEM QUERY RELOAD MODELS`。解决了 [#18722](https://github.com/ClickHouse/ClickHouse/issues/18722)。[#23182](https://github.com/ClickHouse/ClickHouse/pull/23182) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 `EXPLAIN PLAN` 查询新增设置 `json` (布尔值，默认值为 0) 。启用后，查询输出将为单个 `JSON` 行。建议使用 `TSVRaw` 格式，以避免不必要的转义。[#23082](https://github.com/ClickHouse/ClickHouse/pull/23082) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 向 `EXPLAIN PIPELINE` 查询添加设置项 `indexes` (布尔值，默认禁用) 。启用后，将显示已使用的索引，以及每个已应用索引过滤掉的 parts 数量和粒度数量。支持 `MergeTree*` 表。[#22352](https://github.com/ClickHouse/ClickHouse/pull/22352) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* LDAP：实现了用户 DN 检测功能，用于将 Active Directory 组映射到 ClickHouse 角色时。[#22228](https://github.com/ClickHouse/ClickHouse/pull/22228) ([Denis Glazachev](https://github.com/traceon)) 。
* 新的聚合函数 `deltaSumTimestamp`：通过存储时间戳，在 merge 期间保持顺序的同时，对连续行之间的差值进行求和。[#21888](https://github.com/ClickHouse/ClickHouse/pull/21888) ([Russ Frank](https://github.com/rf)).
* 为 S3 新增了一个安全性较低的 IMDS 凭证提供程序，可在 Docker 下正常工作。[#21852](https://github.com/ClickHouse/ClickHouse/pull/21852) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 重新加入 `indexHint` 函数。这是为了解决 [#21238](https://github.com/ClickHouse/ClickHouse/issues/21238)。此更改回滚了 [#9542](https://github.com/ClickHouse/ClickHouse/pull/9542)，并修复了 [#9540](https://github.com/ClickHouse/ClickHouse/issues/9540)。[#21304](https://github.com/ClickHouse/ClickHouse/pull/21304) ([Amos Bird](https://github.com/amosbird)) 。

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 为 `MergeTree*` 表新增 `PROJECTION` 支持。[#20202](https://github.com/ClickHouse/ClickHouse/pull/20202) ([Amos Bird](https://github.com/amosbird)) 。

<div id="performance-improvement">
  #### 性能改进
</div>

* 默认启用 `compile_expressions` 设置。启用后，简单函数和运算符的组合会在运行时通过 LLVM 编译为原生代码。[#8482](https://github.com/ClickHouse/ClickHouse/pull/8482) ([Maksim Kita](https://github.com/kitaisreal), [alexey-milovidov](https://github.com/alexey-milovidov))。注意：如果你遇到问题，请关闭此选项。
* 更新 `re2` 库，提升了正则表达式匹配性能。此 PR 还增加了对 gcc-11 的兼容性。[#24196](https://github.com/ClickHouse/ClickHouse/pull/24196) ([Raúl Marín](https://github.com/Algunenano))。
* ORC 输入格式改为按 stripe 读取，而不是一次性将整个表读入内存；在文件很大时，后者会占用大量内存。[#23102](https://github.com/ClickHouse/ClickHouse/pull/23102) ([Chao Ma](https://github.com/godliness))。
* 将查询中的聚合函数 `sum`、`count` 和 `avg` 融合为单个聚合函数。该优化由 `optimize_fuse_sum_count_avg` 设置控制，通过新的聚合函数 `sumCount` 实现。该函数返回一个包含两个字段的 Tuple：`sum` 和 `count`。[#21337](https://github.com/ClickHouse/ClickHouse/pull/21337) ([hexiaoting](https://github.com/hexiaoting))。
* 将 `zstd` 更新到 v1.5.0。压缩性能提升了几个百分点。[#24135](https://github.com/ClickHouse/ClickHouse/pull/24135) ([Raúl Marín](https://github.com/Algunenano))。注意：你可能会在复制过程中看到“checksum does not match”消息。由于压缩算法更新，这是预期现象，可以忽略。
* 提升了 `Buffer` 表的性能：`Buffer` engine 不再为 total\_bytes/total\_rows 获取锁。[#24066](https://github.com/ClickHouse/ClickHouse/pull/24066) ([Azat Khuzhin](https://github.com/azat))。
* 恢复了对 hashed/sparse\_hashed 字典的预分配支持。[#23979](https://github.com/ClickHouse/ClickHouse/pull/23979) ([Azat Khuzhin](https://github.com/azat))。
* 默认启用 `async_socket_for_remote` (在查询大规模扇出的分布式表时可减少线程数) 。[#23683](https://github.com/ClickHouse/ClickHouse/pull/23683) ([Nikolai Kochetov](https://github.com/KochetovNicolai))。

<div id="improvement">
  #### 改进
</div>

* 向 MergeTree 表家族添加 `_partition_value` 虚拟列。它可用于以确定性方式裁剪分区。这是实现用于变更操作的分区匹配器所必需的。[#23673](https://github.com/ClickHouse/ClickHouse/pull/23673) ([Amos Bird](https://github.com/amosbird)).
* 新增了用于 S3 存储和磁盘的 `region` 参数。[#23846](https://github.com/ClickHouse/ClickHouse/pull/23846) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 允许为不同的日志通道配置不同的日志级别。解决了 [#19569](https://github.com/ClickHouse/ClickHouse/issues/19569)。[#23857](https://github.com/ClickHouse/ClickHouse/pull/23857) ([filimonov](https://github.com/filimonov)) 。
* 如果在 `DateTime` 运算中未显式指定 timezone，则保留默认 timezone。 例如，如果给一个不带 timezone 的 `DateTime` 类型值加上一秒，它仍然是不带 timezone 的 `DateTime`。在之前的版本中，默认 timezone 的值会被显式写入返回的数据类型，因此会变成 DateTime('something')。这解决了 [#4854](https://github.com/ClickHouse/ClickHouse/issues/4854)。[#23392](https://github.com/ClickHouse/ClickHouse/pull/23392) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 允许用户为 `MySQL` 存储指定空字符串，而不是数据库名。查询将使用默认 database。在之前的版本中，这仅适用于 SELECT 查询，现在也增加了对 INSERT 的支持。此更改关闭了 [#19281](https://github.com/ClickHouse/ClickHouse/issues/19281)。这在配合 `Sphinx` 或其他兼容 MySQL 的外部数据库使用时会很有帮助。[#23319](https://github.com/ClickHouse/ClickHouse/pull/23319) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了 `quantile(s)TDigest`。根据 tdunning/t-digest 3.2+，增加了对单例质心的特殊处理。还修复了该算法早期版本实现中质心过度压缩的问题。[#23314](https://github.com/ClickHouse/ClickHouse/pull/23314) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 函数 `now64` 现已支持可选的时区参数。[#24091](https://github.com/ClickHouse/ClickHouse/pull/24091) ([Vasily Nemkov](https://github.com/Enmk)) 。
* 修复了这样一种情况：在 clickhouse-client 的 interactive mode 下，如果进度条出现在数据中间，可能会覆盖终端中部分可见数据。此更改关闭了 [#19283](https://github.com/ClickHouse/ClickHouse/issues/19283)。[#23050](https://github.com/ClickHouse/ClickHouse/pull/23050) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了 simdjson 中因内存分配失败导致的崩溃。[https://github.com/simdjson/simdjson/pull/1567](https://github.com/simdjson/simdjson/pull/1567) 。由于这是一个极为罕见的 bug，因此将其归类为改进。[#24147](https://github.com/ClickHouse/ClickHouse/pull/24147) ([Amos Bird](https://github.com/amosbird)) 。
* 在存储关闭前保留字典 (这样可避免在 `Buffer` 引擎最终 flush 期间服务器关闭时，出现可能的 `external dictionary 'DICT' not found` 错误) 。[#24068](https://github.com/ClickHouse/ClickHouse/pull/24068) ([Azat Khuzhin](https://github.com/azat)).
* 在关闭表 (同一数据库内) 之前，先 flush `Buffer` 表，以避免因底层表已被 detached 而导致块被丢弃 (并在日志中出现 `Destination table default.a_data_01870 doesn't exist. Block of data is discarded` 错误) 。[#24067](https://github.com/ClickHouse/ClickHouse/pull/24067) ([Azat Khuzhin](https://github.com/azat)).
* 现在，`prefer_column_name_to_alias = 1` 也会在 `GROUP BY`、`HAVING` 和 `ORDER BY` 中优先使用列名。此更改修复了 [#23882](https://github.com/ClickHouse/ClickHouse/issues/23882)。[#24022](https://github.com/ClickHouse/ClickHouse/pull/24022) ([Amos Bird](https://github.com/amosbird)) 。
* 新增了对 `DateTime64` 类型的 `ORDER BY WITH FILL` 的支持。[#24016](https://github.com/ClickHouse/ClickHouse/pull/24016) ([kevin wan](https://github.com/MaxWk)) 。
* 支持将 `DateTime64` 作为 `ReplacingMergeTree` 中的版本列。[#23992](https://github.com/ClickHouse/ClickHouse/pull/23992) ([kevin wan](https://github.com/MaxWk)) 。
* 在服务器启动时记录操作系统名称、内核版本和 CPU 架构等信息。[#23988](https://github.com/ClickHouse/ClickHouse/pull/23988) ([Azat Khuzhin](https://github.com/azat)) 。
* 支持为 `postgresql` 字典源指定表 schema。关闭 [#23958](https://github.com/ClickHouse/ClickHouse/issues/23958)。[#23980](https://github.com/ClickHouse/ClickHouse/pull/23980) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 为 `Enum` 元素名称添加提示 (在出现拼写错误时提供名称建议) 。关闭 [#17112](https://github.com/ClickHouse/ClickHouse/issues/17112)。[#23919](https://github.com/ClickHouse/ClickHouse/pull/23919) ([flynn](https://github.com/ucasFL)).
* 为字典统计命中率 (即找到该值的百分比，参见 `system.dictionaries` 中的 `found_rate`) 。[#23916](https://github.com/ClickHouse/ClickHouse/pull/23916) ([Azat Khuzhin](https://github.com/azat)) 。
* 支持通过表设置 `rabbitmq_queue_settings_list` 添加特定的队列设置。 (解决了 [#23737](https://github.com/ClickHouse/ClickHouse/issues/23737) 和 [#23918](https://github.com/ClickHouse/ClickHouse/issues/23918)) 。允许用户完全控制 RabbitMQ 的设置：如果将表设置 `rabbitmq_queue_consume` 设为 `1`，RabbitMQ 表引擎将只连接到指定队列，不会执行任何 RabbitMQ 消费者端的设置操作，例如声明 exchange、队列和绑定。 (解决了 [#21757](https://github.com/ClickHouse/ClickHouse/issues/21757)) 。在删除 RabbitMQ 表时增加了适当的清理逻辑：删除该表声明的队列以及所有已绑定的 exchange，但前提是它们由该表创建。[#23887](https://github.com/ClickHouse/ClickHouse/pull/23887) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 将 `broken_data_files`/`broken_data_compressed_bytes` 添加到 `system.distribution_queue`。新增一项指标，用于统计异步插入到分布式表且已标记为损坏的文件数量 (`BrokenDistributedFilesToInsert`) 。[#23885](https://github.com/ClickHouse/ClickHouse/pull/23885) ([Azat Khuzhin](https://github.com/azat)) 。
* 查询 `system.tables` 现已不再经过 ZooKeeper。 [#23793](https://github.com/ClickHouse/ClickHouse/pull/23793) ([Fuwang Hu](https://github.com/fuwhu)).
* 使 `lock_acquire_timeout_for_background_operations` 设置对 `OPTIMIZE` 查询生效。 [#23623](https://github.com/ClickHouse/ClickHouse/pull/23623) ([Azat Khuzhin](https://github.com/azat)).
* 现可通过新的 `SYSTEM RESTART DISK` SQL 命令在运行时更改 `S3` 磁盘设置。[#23429](https://github.com/ClickHouse/ClickHouse/pull/23429) ([Pavel Kovalenko](https://github.com/Jokser)).
* 如果用户误将 `max_distributed_connections` 设为零，导致配置错误，那么对 `Distributed` 表的每个查询都会抛出异常，消息中包含 "logical error"。但这实际上是预期行为，而不是逻辑错误，因此该异常消息略显不准确。它还会触发我们 CI 环境中的检查，而该检查旨在确保永远不会出现逻辑错误。现在，我们会将错误配置为零的 `max_distributed_connections` 视为最小可能值 (一) 。[#23348](https://github.com/ClickHouse/ClickHouse/pull/23348) ([Azat Khuzhin](https://github.com/azat)).
* 默认禁用 `min_bytes_to_use_mmap_io`。[#23322](https://github.com/ClickHouse/ClickHouse/pull/23322) ([Azat Khuzhin](https://github.com/azat)) 。
* 支持 `LowCardinality` 在使用 `join_use_nulls` 时可为空，关闭 [#15101](https://github.com/ClickHouse/ClickHouse/issues/15101)。[#23237](https://github.com/ClickHouse/ClickHouse/pull/23237) ([vdimir](https://github.com/vdimir)) 。
* 新增了将 `MergeTree` parts 恢复到 `S3` 磁盘的 `detached` 目录中的功能。[#23112](https://github.com/ClickHouse/ClickHouse/pull/23112) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* S3 中 HTTP 连接中断后的重试。[#22988](https://github.com/ClickHouse/ClickHouse/pull/22988) ([Vladimir Chebotarev](https://github.com/excitoon)).
* 为 MySQL 表引擎、字典源以及 MaterializeMySQL 的小规模数据拉取新增了设置 `external_storage_max_read_rows` 和 `external_storage_max_read_rows`。[#22697](https://github.com/ClickHouse/ClickHouse/pull/22697) ([TCeason](https://github.com/TCeason)) 。
* `MaterializeMySQL` (Experimental 功能) ：此前由于 SQL 不兼容，不支持 MySQL 5.7.9。现已将 MySQL 参数校验交由 MaterializeMySQL 负责。[#23413](https://github.com/ClickHouse/ClickHouse/pull/23413) ([TCeason](https://github.com/TCeason)) 。
* 支持读取分布式表的子列。[#24472](https://github.com/ClickHouse/ClickHouse/pull/24472) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了在 `CREATE .. AS SELECT` 查询中使用元组时的问题。[#24464](https://github.com/ClickHouse/ClickHouse/pull/24464) ([Anton Popov](https://github.com/CurtizJ)) 。
* 支持 `Kafka` 表中的 `Parquet` 格式。[#23412](https://github.com/ClickHouse/ClickHouse/pull/23412) ([Chao Ma](https://github.com/godliness)) 。

<div id="bug-fixes">
  #### 问题修复
</div>

* 当 modulo 函数用于分区键和主键时，使用旧版实现。关闭了 [#23508](https://github.com/ClickHouse/ClickHouse/issues/23508)。[#24157](https://github.com/ClickHouse/ClickHouse/pull/24157) ([Kseniia Sumarokova](https://github.com/kssenii)) 。这也是之前版本中向后不兼容的一个原因。
* 修复了查询 `SYSTEM RESTART REPLICA` 或 `SYSTEM SYNC REPLICA` 被无限处理时的行为问题。该问题是在 RAM 极其有限的服务器上发现的。[#24457](https://github.com/ClickHouse/ClickHouse/pull/24457) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 修复了 `toWeek` 函数单调性错误的问题。此修复解决了 [#24422](https://github.com/ClickHouse/ClickHouse/issues/24422)。该缺陷是在 [#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) 中引入的，之后因分区裁剪器变得更智能而暴露出来。[#24446](https://github.com/ClickHouse/ClickHouse/pull/24446) ([Amos Bird](https://github.com/amosbird)).
* 修复带有 intersect 虚假 parts 的 drop partition 问题。在极少数情况下，可能存在变更版本高于当前块号的 parts。[#24321](https://github.com/ClickHouse/ClickHouse/pull/24321) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了使用 `RENAME TABLE` 查询将 materialized view 从 Ordinary database 移动到 Atomic database 时的一个问题。现在，内表会随 materialized view 一起移动到新 database 中。修复了 [#23926](https://github.com/ClickHouse/ClickHouse/issues/23926)。[#24309](https://github.com/ClickHouse/ClickHouse/pull/24309) ([tavplubix](https://github.com/tavplubix)) 。
* 允许客户端请求中使用空的 HTTP 请求头。修复了 [#23901](https://github.com/ClickHouse/ClickHouse/issues/23901)。[#24285](https://github.com/ClickHouse/ClickHouse/pull/24285) ([Ivan](https://github.com/abyss7)).
* 将 `max_threads` 设置为 `1`，以修复 `Memory` 表的变更失败问题。关闭 [#24274](https://github.com/ClickHouse/ClickHouse/issues/24274)。[#24275](https://github.com/ClickHouse/ClickHouse/pull/24275) ([flynn](https://github.com/ucasFL)).
* 修复了 `Memory` 表实现中的一个拼写错误，此问题是在 [#15127](https://github.com/ClickHouse/ClickHouse/issues/15127) 中引入的。关闭 [#24192](https://github.com/ClickHouse/ClickHouse/issues/24192)。[#24193](https://github.com/ClickHouse/ClickHouse/pull/24193) ([张中南](https://github.com/plugine)).
* 修复了在查询执行期间 `HDFS` 不可访问时导致服务器异常终止的问题。关闭 [#24117](https://github.com/ClickHouse/ClickHouse/issues/24117)。[#24191](https://github.com/ClickHouse/ClickHouse/pull/24191) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了在使用常量条件更新 `Nested` 列时发生崩溃的问题。[#24183](https://github.com/ClickHouse/ClickHouse/pull/24183) ([hexiaoting](https://github.com/hexiaoting))。
* 修复了 RBAC 在高负载下可能出现的竞态条件。此 PR 修复了 [#24090](https://github.com/ClickHouse/ClickHouse/issues/24090)、[#24134](https://github.com/ClickHouse/ClickHouse/issues/24134)、[#24176](https://github.com/ClickHouse/ClickHouse/pull/24176) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了一个罕见 bug：该 bug 可能导致表仅部分初始化却仍能处理写请求 (insert/alter 等) 。现在，这类表将处于 readonly 模式。[#24122](https://github.com/ClickHouse/ClickHouse/pull/24122) ([alesapin](https://github.com/alesapin)) 。
* 修复了一个问题：使用 `SELECT xxx FINAL` 时，`EXPLAIN PIPELINE` 会显示错误的管道。([hexiaoting](https://github.com/hexiaoting)).
* 修复了在 `WHERE` 中使用 const `DateTime` 值与 `DateTime64` 列比较时的问题。[#24100](https://github.com/ClickHouse/ClickHouse/pull/24100) ([Vasily Nemkov](https://github.com/Enmk)) 。
* 修复 merge JOIN 中的崩溃，关闭 [#24010](https://github.com/ClickHouse/ClickHouse/issues/24010)。[#24013](https://github.com/ClickHouse/ClickHouse/pull/24013) ([vdimir](https://github.com/vdimir)).
* 某些 `ALTER PARTITION` 查询可能会在复制队列中触发 `Part A intersects previous part B` 和 `Unexpected merged part C intersecting drop range D` 错误。现已修复。修复了 [#23296](https://github.com/ClickHouse/ClickHouse/issues/23296)。[#23997](https://github.com/ClickHouse/ClickHouse/pull/23997) ([tavplubix](https://github.com/tavplubix)) 。
* 修复外部 GROUP BY 和溢出行导致的 SIGSEGV 问题 (即类似 `SELECT FROM GROUP BY WITH TOTALS SETTINGS max_bytes_before_external_group_by>0, max_rows_to_group_by>0, group_by_overflow_mode='any', totals_mode='before_having'` 的查询) 。[#23962](https://github.com/ClickHouse/ClickHouse/pull/23962) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了源中存在重复项时 `CACHE` 字典的键指标统计问题 (会导致 `DictCacheKeysRequestedMiss` 溢出) 。[#23929](https://github.com/ClickHouse/ClickHouse/pull/23929) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复 `PostgreSQL` 引擎连接池的实现问题。关闭 [#23897](https://github.com/ClickHouse/ClickHouse/issues/23897)。[#23909](https://github.com/ClickHouse/ClickHouse/pull/23909) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了 `distributed_group_by_no_merge = 2` 与 `GROUP BY` 以及由普通函数包裹的聚合函数配合使用时的问题 (该问题曾在 [#23546](https://github.com/ClickHouse/ClickHouse/issues/23546) 中被破坏) 。当有人尝试将 `distributed_group_by_no_merge = 2` 与窗口函数一起使用时，会抛出异常。对包含窗口函数的查询禁用 `optimize_distributed_group_by_sharding_key`。 [#23906](https://github.com/ClickHouse/ClickHouse/pull/23906) ([Azat Khuzhin](https://github.com/azat)) 。
* 针对 `s3` 表函数的一项修复：改进了对 HTTP 错误的处理。此前，HTTP 错误的响应体一直会被忽略。[#23844](https://github.com/ClickHouse/ClickHouse/pull/23844) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 对 `s3` 表函数的修复：更好地处理 URI。修复了与包含 `+` 符号的 URL 不兼容的问题，此前无法读取具有此类键的数据。[#23822](https://github.com/ClickHouse/ClickHouse/pull/23822) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 修复了在查询使用 `GLOBAL IN/JOIN` 和 `use_hedged_requests` 时出现的错误 `Can't initialize pipeline with empty pipe`。修复 [#23431](https://github.com/ClickHouse/ClickHouse/issues/23431)。[#23805](https://github.com/ClickHouse/ClickHouse/pull/23805) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 `CLEAR COLUMN` 在被 materialized view 引用时无法生效的问题。关闭 [#23764](https://github.com/ClickHouse/ClickHouse/issues/23764)。[#23781](https://github.com/ClickHouse/ClickHouse/pull/23781) ([flynn](https://github.com/ucasFL)) 。
* 修复了在使用 `Values` 格式从 HDFS 读取时发生的堆内存释放后继续使用问题。[#23761](https://github.com/ClickHouse/ClickHouse/pull/23761) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 避免在向 Distributed 执行 INSERT 时出现可能的 “Cannot schedule a task” 错误 (如果此前曾发生过某些异常) 。[#23744](https://github.com/ClickHouse/ClickHouse/pull/23744) ([Azat Khuzhin](https://github.com/azat)).
* 修复了恢复已失效的 `ReplicatedMergeTree` 副本时的一个 bug。如果在副本停机期间执行了 `ALTER` 查询，某些元数据更新可能会被该失效副本忽略。[#23742](https://github.com/ClickHouse/ClickHouse/pull/23742) ([tavplubix](https://github.com/tavplubix)).
* 修复了 `Join` 与 `WITH TOTALS` 相关的一个 bug，关闭 [#17718](https://github.com/ClickHouse/ClickHouse/issues/17718)。[#23549](https://github.com/ClickHouse/ClickHouse/pull/23549) ([vdimir](https://github.com/vdimir))。
* 修复了包含 `UNION` 的查询在过滤下推优化后可能出现的 `Block structure mismatch` 错误。修复 [#23029](https://github.com/ClickHouse/ClickHouse/issues/23029)。[#23359](https://github.com/ClickHouse/ClickHouse/pull/23359) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 在启用设置 `optimize_skip_unused_shards_rewrite_in` 时添加类型转换。此更改修复了 MSan 报告。[#23219](https://github.com/ClickHouse/ClickHouse/pull/23219) ([Azat Khuzhin](https://github.com/azat)).
* 在更新嵌套子列时添加了缺失的检查，关闭问题：[#22353](https://github.com/ClickHouse/ClickHouse/issues/22353)。[#22503](https://github.com/ClickHouse/ClickHouse/pull/22503) ([hexiaoting](https://github.com/hexiaoting)) 。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 支持在 Illumos 上构建。[#24144](https://github.com/ClickHouse/ClickHouse/pull/24144)。新增对 Solaris 衍生操作系统的构建支持。[#23746](https://github.com/ClickHouse/ClickHouse/pull/23746) ([bnaecker](https://github.com/bnaecker)).
* 为哈希表新增更多基准测试，包括 Google 的 Swiss Table (在我们的特定使用场景中，它似乎比 ClickHouse 哈希映射更慢) 。[#24111](https://github.com/ClickHouse/ClickHouse/pull/24111) ([Maksim Kita](https://github.com/kitaisreal)).
* 将 librdkafka 从 1.6.0-RC3 更新至 1.6.1。[#23874](https://github.com/ClickHouse/ClickHouse/pull/23874) ([filimonov](https://github.com/filimonov)).
* 始终显式启用 `asynchronous-unwind-tables`。这可能会修复 AArch64 上的查询分析器问题。[#23602](https://github.com/ClickHouse/ClickHouse/pull/23602) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 避免构建过程对区域设置和文件系统顺序产生潜在依赖。从而实现可复现构建。[#23600](https://github.com/ClickHouse/ClickHouse/pull/23600) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 消除了构建中的一个非确定性来源。现在，不同时间进行的构建会生成字节级完全一致的二进制文件。部分解决了 [#22113](https://github.com/ClickHouse/ClickHouse/issues/22113)。[#23559](https://github.com/ClickHouse/ClickHouse/pull/23559) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 新增一个用于对 (Zoo)Keeper 进行基准测试的简单工具。[#23038](https://github.com/ClickHouse/ClickHouse/pull/23038) ([alesapin](https://github.com/alesapin)).

<div id="clickhouse-release-215-2021-05-20">
  ## ClickHouse 21.5 发布，2021-05-20
</div>

<div id="backward-incompatible-change">
  #### 向后不兼容变更
</div>

* 当整数无法在浮点数据类型中被精确表示时，调整整数与浮点数的比较方式。在新版本中，由于会产生舍入误差，比较将返回 false。Example：`9223372036854775808.0 != 9223372036854775808`，因为数字 `9223372036854775808` 无法被浮点数精确表示 (并且 `9223372036854775808.0` 会被舍入为 `9223372036854776000.0`) 。但在之前的版本中，比较会认为两者相等，因为如果将浮点数 `9223372036854776000.0` 转换回 UInt64，会得到 `9223372036854775808`。作为参考，Python 语言也将这两个数视为相等。但这种行为依赖于 CPU 型号 (某些超出范围的数字在 AMD64 和 AArch64 上会得到不同结果) ，因此我们将比较逻辑改得更加精确。只有当整数能够在浮点类型中被精确表示时，才会将整数和浮点数视为相等。[#22595](https://github.com/ClickHouse/ClickHouse/pull/22595) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 移除对单个 `Tuple` 参数的 `argMin` 和 `argMax` 支持。该代码不具备内存安全性。这个功能是误加的，而且容易让人困惑。后续可能会以不同名称重新引入这些函数。此更改修复了 [#22384](https://github.com/ClickHouse/ClickHouse/issues/22384) 并回退了 [#17359](https://github.com/ClickHouse/ClickHouse/issues/17359)。[#23393](https://github.com/ClickHouse/ClickHouse/pull/23393) ([alexey-milovidov](https://github.com/alexey-milovidov)).

<div id="new-feature">
  #### 新功能
</div>

* 新增函数 `dictGetChildren(dictionary, key)`、`dictGetDescendants(dictionary, key, level)`。函数 `dictGetChildren` 以索引数组形式返回所有子节点，是 `dictGetHierarchy` 的反向操作。函数 `dictGetDescendants` 返回所有后代节点，相当于递归应用 `dictGetChildren` `level` 次。`level` 值为 0 时等同于无穷大。提升了 `dictGetHierarchy`、`dictIsIn` 函数的性能。关闭 [#14656](https://github.com/ClickHouse/ClickHouse/issues/14656)。[#22096](https://github.com/ClickHouse/ClickHouse/pull/22096) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增函数 `dictGetOrNull`。它的行为与 `dictGet` 类似，但当在字典中找不到键时会返回 `NULL`。关闭 [#22375](https://github.com/ClickHouse/ClickHouse/issues/22375)。[#22413](https://github.com/ClickHouse/ClickHouse/pull/22413) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增表函数 `s3Cluster`，允许在指定集群的每个节点上并行处理来自 `s3` 的文件。[#22012](https://github.com/ClickHouse/ClickHouse/pull/22012) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 在 MySQL/PostgreSQL 表引擎 / 表函数中新增对副本和分片的支持。你可以编写 `SELECT * FROM mysql('host{1,2}-{1|2}', ...)`。关闭 [#20969](https://github.com/ClickHouse/ClickHouse/issues/20969)。[#22217](https://github.com/ClickHouse/ClickHouse/pull/22217) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 新增 `ALTER TABLE ... FETCH PART ...` 查询。它与 `FETCH PARTITION` 类似，但只拉取一个分片。[#22706](https://github.com/ClickHouse/ClickHouse/pull/22706) ([turbo jason](https://github.com/songenjie)).
* 新增设置 `max_distributed_depth`，用于限制对 `Distributed` 表的递归查询深度。关闭 [#20229](https://github.com/ClickHouse/ClickHouse/issues/20229)。[#21942](https://github.com/ClickHouse/ClickHouse/pull/21942) ([flynn](https://github.com/ucasFL)).

<div id="performance-improvement">
  #### 性能改进
</div>

* 通过针对 AVX2 的动态分发提升了 `intDiv` 的性能。此更改修复了 [#22314](https://github.com/ClickHouse/ClickHouse/issues/22314)。[#23000](https://github.com/ClickHouse/ClickHouse/pull/23000) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 提升了从 `ArrowStream` 输入格式读取非本地文件源 (例如 URL) 时的性能。[#22673](https://github.com/ClickHouse/ClickHouse/pull/22673) ([nvartolomei](https://github.com/nvartolomei)) 。
* 通过 Native 协议与 localhost 交互时 (使用 clickhouse-client，或在分布式查询中进行 server 到 server 通信) ，现在默认禁用压缩。这可能会提升某些导入/导出操作的性能。此更改修复了 [#22234](https://github.com/ClickHouse/ClickHouse/issues/22234)。[#22237](https://github.com/ClickHouse/ClickHouse/pull/22237) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 对于分布式查询，在 IN 子句右侧排除不属于当前 shard 的值 (由 `optimize_skip_unused_shards_rewrite_in` 控制，默认启用，但仍需启用 `optimize_skip_unused_shards`) 。[#21511](https://github.com/ClickHouse/ClickHouse/pull/21511) ([Azat Khuzhin](https://github.com/azat)) 。
* 提升了在类 File 的表引擎以及 Parquet、Arrow、ORC 等列式 format 下读取部分列时的性能。此更改修复了 [#issue:20129](https://github.com/ClickHouse/ClickHouse/issues/20129)。[#21302](https://github.com/ClickHouse/ClickHouse/pull/21302) ([keenwolf](https://github.com/keen-wolf)) 。
* 允许像 21.1 版本之前一样，将更多条件下推到 `PREWHERE` (调整了内部启发式规则) 。下推的条件过少可能会导致性能下降。[#23397](https://github.com/ClickHouse/ClickHouse/pull/23397) ([Anton Popov](https://github.com/CurtizJ)) 。
* 提升了 ODBC 连接的性能，并修复了积压问题中所有尚未解决的问题。使用 `nanodbc` 库替代 `Poco::ODBC`。修复了 [#9678](https://github.com/ClickHouse/ClickHouse/issues/9678)。为 ODBC 表引擎新增了对 DateTime64 和 Decimal\* 的支持。修复了 [#21961](https://github.com/ClickHouse/ClickHouse/issues/21961)。修复了西里尔文本被截断的问题。修复了 [#16246](https://github.com/ClickHouse/ClickHouse/issues/16246)。为 ODBC bridge 添加了连接池。[#21972](https://github.com/ClickHouse/ClickHouse/pull/21972) ([Kseniia Sumarokova](https://github.com/kssenii)) 。

<div id="improvement">
  #### 改进
</div>

* 默认将 `max_uri_size` (HTTP 接口中 URL 的最大长度) 提高到 1 MiB。此更改解决了 [#21197](https://github.com/ClickHouse/ClickHouse/issues/21197)。[#22997](https://github.com/ClickHouse/ClickHouse/pull/22997) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 将 `background_fetches_pool_size` 设置为 `8`，更适合经常进行小批量插入或 ZooKeeper 集群较慢的生产环境。[#22945](https://github.com/ClickHouse/ClickHouse/pull/22945) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* FlatDictionary 新增了 `initial_array_size` 和 `max_array_size` 选项。[#22521](https://github.com/ClickHouse/ClickHouse/pull/22521) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增设置 `non_replicated_deduplication_window`，用于对非复制表 MergeTree 的插入进行去重。[#22514](https://github.com/ClickHouse/ClickHouse/pull/22514) ([alesapin](https://github.com/alesapin)).
* 在配置重新加载时更新 `CatBoost` 模型配置的路径。[#22434](https://github.com/ClickHouse/ClickHouse/pull/22434) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 在字典中新增了对 `Decimal256` 类型的支持。`Decimal256` 是 Experimental 功能。关闭了 [#20979](https://github.com/ClickHouse/ClickHouse/issues/20979)。[#22960](https://github.com/ClickHouse/ClickHouse/pull/22960) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 默认启用 `async_socket_for_remote` (为分布式查询使用更少的操作系统线程) 。[#23683](https://github.com/ClickHouse/ClickHouse/pull/23683) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 `quantile(s)TDigest`。按照 tdunning/t-digest 3.2+ 的规则，为 singleton 质心添加了特殊处理；同时还修复了该算法早期版本实现中质心过度压缩的问题。[#23314](https://github.com/ClickHouse/ClickHouse/pull/23314) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 使函数名 `unhex` 对大小写不敏感，以兼容 MySQL。[#23229](https://github.com/ClickHouse/ClickHouse/pull/23229) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 实现了函数 `arrayHasAny`、`arrayHasAll`、`has`、`indexOf`、`countEqual` 在 Array 元素类型不同这一通用情况下的支持。在之前的版本中，函数 `arrayHasAny`、`arrayHasAll` 会返回 false，而 `has`、`indexOf`、`countEqual` 则会抛出异常。同时，还为 `has` 及类似函数增加了对 `Decimal` 和大整数类型的支持。此项改进关闭了 [#20272](https://github.com/ClickHouse/ClickHouse/issues/20272)。[#23044](https://github.com/ClickHouse/ClickHouse/pull/23044) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 提高了函数 `extractAllGroupsHorizontal` 返回结果中最大匹配数的上限。[#23036](https://github.com/ClickHouse/ClickHouse/pull/23036) ([Vasily Nemkov](https://github.com/Enmk)).
* 对于单节点集群，不执行 `optimize_skip_unused_shards`。[#22999](https://github.com/ClickHouse/ClickHouse/pull/22999) ([Azat Khuzhin](https://github.com/azat)) 。
* 新增了通过 SSL 运行 clickhouse-keeper (ZooKeeper 的 Experimental 即插即用替代方案) 的能力。配置项 `keeper_server.tcp_port_secure` 可用于客户端与 keeper-server 之间的安全通信。`keeper_server.raft_configuration.secure` 可用于启用节点之间的内部安全通信。[#22992](https://github.com/ClickHouse/ClickHouse/pull/22992) ([alesapin](https://github.com/alesapin)) 。
* 为 `Buffer` 表新增了仅在后台刷写缓冲区的功能。[#22986](https://github.com/ClickHouse/ClickHouse/pull/22986) ([Azat Khuzhin](https://github.com/azat)) 。
* 在带有 NULL 的 WHERE 条件下从 MergeTree 表中查询时，极少数情况下会抛出异常。此修复已关闭 [#20019](https://github.com/ClickHouse/ClickHouse/issues/20019)。[#22978](https://github.com/ClickHouse/ClickHouse/pull/22978) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了 AWS 的 Poco HTTP Client 中的错误处理。[#22973](https://github.com/ClickHouse/ClickHouse/pull/22973) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) 。
* 为 `ReplicatedMergeTree` 遵循 `max_part_removal_threads` 设置。[#22971](https://github.com/ClickHouse/ClickHouse/pull/22971) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了 MergeTree settings 中 inactive\_parts\_to\_throw\_insert = 0 且 inactive\_parts\_to\_delay\_insert > 0 时一个较少见的特殊情况。 [#22947](https://github.com/ClickHouse/ClickHouse/pull/22947) ([Azat Khuzhin](https://github.com/azat)).
* `dateDiff` 现在可与 `DateTime64` 参数配合使用 (即使值超出了 `DateTime` 的范围) [#22931](https://github.com/ClickHouse/ClickHouse/pull/22931) ([Vasily Nemkov](https://github.com/Enmk)) 。
* MaterializeMySQL (实验性功能) ：新增了对包含视图的 MySQL 数据库进行复制且不会失败的能力。这是通过忽略这些视图来实现的。[#22760](https://github.com/ClickHouse/ClickHouse/pull/22760) ([Christian](https://github.com/cfroystad)) 。
* 允许通过 PostgreSQL 协议使用 RBAC row policy。修复了 [#22658](https://github.com/ClickHouse/ClickHouse/issues/22658)。默认情况下，配置中已启用 PostgreSQL 协议。[#22755](https://github.com/ClickHouse/ClickHouse/pull/22755) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 新增指标，用于跟踪等待 Buffer 层锁时所耗费的时间。 [#22725](https://github.com/ClickHouse/ClickHouse/pull/22725) ([Azat Khuzhin](https://github.com/azat)).
* 允许在 VIEW 定义中使用 CTE。此更改修复了 [#22491](https://github.com/ClickHouse/ClickHouse/issues/22491)。[#22657](https://github.com/ClickHouse/ClickHouse/pull/22657) ([Amos Bird](https://github.com/amosbird))。
* 如果前一个程序在终端中留下了乱码，`clickhouse-client` 将清除屏幕其余内容并显示光标。此更改关闭了 [#16518](https://github.com/ClickHouse/ClickHouse/issues/16518)。[#22634](https://github.com/ClickHouse/ClickHouse/pull/22634) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 使 `round` 函数在非 x86\_64 平台上的行为保持一致。采用四舍六入五成双 (Banker's rounding) 舍入。[#22582](https://github.com/ClickHouse/ClickHouse/pull/22582) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 正确检查由分布式表发送的数据块结构。[#22325](https://github.com/ClickHouse/ClickHouse/pull/22325) ([Azat Khuzhin](https://github.com/azat)) 。
* 允许将 Kafka 错误写入 Kafka 引擎的虚拟列中，由 `kafka_handle_error_mode` 设置控制。[#21850](https://github.com/ClickHouse/ClickHouse/pull/21850) ([fastio](https://github.com/fastio)) 。
* 为 `visitParam/visitParamExtract{UInt, Int, Bool, Float, Raw, String}` 新增别名 `simpleJSONExtract/simpleJSONHas`。修复了 [#21383](https://github.com/ClickHouse/ClickHouse/issues/21383)。[#21519](https://github.com/ClickHouse/ClickHouse/pull/21519) ([fastio](https://github.com/fastio)).
* 为 library 字典源新增 `clickhouse-library-bridge`。关闭 [#9502](https://github.com/ClickHouse/ClickHouse/issues/9502)。[#21509](https://github.com/ClickHouse/ClickHouse/pull/21509) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 禁止删除被 materialized view 引用的列。关闭了 [#21164](https://github.com/ClickHouse/ClickHouse/issues/21164)。[#21303](https://github.com/ClickHouse/ClickHouse/pull/21303) ([flynn](https://github.com/ucasFL)) 。
* 支持动态服务器间凭据 (可在不停机的情况下轮换凭据) 。[#14113](https://github.com/ClickHouse/ClickHouse/pull/14113) ([johnskopis](https://github.com/johnskopis)).
* 新增对 Kafka 存储的支持，可处理采用 `Arrow` 和 `ArrowStream` 格式的消息。[#23415](https://github.com/ClickHouse/ClickHouse/pull/23415) ([Chao Ma](https://github.com/godliness)) 。
* 修复了异常消息中缺失的分号。用户可能会觉得这条异常消息不太好读。[#23208](https://github.com/ClickHouse/ClickHouse/pull/23208) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了某些与 `LowCardinality` 类型相关的异常消息中缺少空格的问题。[#23207](https://github.com/ClickHouse/ClickHouse/pull/23207) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 在 `Markdown` 格式中，表格单元格里的某些值曾被格式化为居中对齐。现在已不再如此。[#23096](https://github.com/ClickHouse/ClickHouse/pull/23096) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 移除 clickhouse-client 建议中的非必要细节。此更改修复了 [#22158](https://github.com/ClickHouse/ClickHouse/issues/22158)。[#23040](https://github.com/ClickHouse/ClickHouse/pull/23040) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修正了 system.dictionaries 中 `bytes_allocated` 字段在 sparse\_hashed 字典里的计算。 [#22867](https://github.com/ClickHouse/ClickHouse/pull/22867) ([Azat Khuzhin](https://github.com/azat)).
* 修复了从 MergeTree 反向读取时近似总行数统计的问题。[#22726](https://github.com/ClickHouse/ClickHouse/pull/22726) ([Azat Khuzhin](https://github.com/azat)).
* 修复了一种情况：此前可能会将字典配置为使用指向自身的 ClickHouse 源，从而导致无限循环。关闭 [#14314](https://github.com/ClickHouse/ClickHouse/issues/14314)。[#22479](https://github.com/ClickHouse/ClickHouse/pull/22479) ([Maksim Kita](https://github.com/kitaisreal)) 。

<div id="bug-fixes">
  #### 问题修复
</div>

* 对对冲请求进行了多项修复。修复了在启用设置 `use_hedged_requests` 时，包含 `GLOBAL IN/JOIN` 的查询出现的 `Can't initialize pipeline with empty pipe` 错误。修复了 [#23431](https://github.com/ClickHouse/ClickHouse/issues/23431)。[#23805](https://github.com/ClickHouse/ClickHouse/pull/23805) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。修复了对冲连接中的一个竞态条件，该问题会导致崩溃。此修复解决了 [#22161](https://github.com/ClickHouse/ClickHouse/issues/22161)。[#22443](https://github.com/ClickHouse/ClickHouse/pull/22443) ([Kruglov Pavel](https://github.com/Avogar)) 。修复了从远程查询接收到 `unknown packet` 时可能发生的崩溃问题 (启用 `async_socket_for_remote` 时) 。修复了 [#21167](https://github.com/ClickHouse/ClickHouse/issues/21167)。[#23309](https://github.com/ClickHouse/ClickHouse/pull/23309) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了在禁用 `input_format_with_names_use_header ` 设置时丢弃 CSVWithNames 格式全部输入数据的问题。此修复解决了 [#22406](https://github.com/ClickHouse/ClickHouse/issues/22406)。[#23202](https://github.com/ClickHouse/ClickHouse/pull/23202) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复了远程 JDBC bridge 连接超时的问题。关闭了 [#9609](https://github.com/ClickHouse/ClickHouse/issues/9609)。[#23771](https://github.com/ClickHouse/ClickHouse/pull/23771) ([Maksim Kita](https://github.com/kitaisreal), [alexey-milovidov](https://github.com/alexey-milovidov)).
* 如果指定了 `update_field`，则修复 `complex_key_hashed` 的 initial load 逻辑。关闭 [#23800](https://github.com/ClickHouse/ClickHouse/issues/23800)。[#23824](https://github.com/ClickHouse/ClickHouse/pull/23824) ([Maksim Kita](https://github.com/kitaisreal)).
* 修复了当 `PREWHERE` 和行级策略过滤器同时生效且结果为空时发生的崩溃。[#23763](https://github.com/ClickHouse/ClickHouse/pull/23763) ([Amos Bird](https://github.com/amosbird)) 。
* 避免在向 Distributed 执行 INSERT 时出现可能的“无法调度任务”错误 (在发生某些异常的情况下) 。[#23744](https://github.com/ClickHouse/ClickHouse/pull/23744) ([Azat Khuzhin](https://github.com/azat)).
* 在聚合函数 `mannWhitneyUTest` 中，针对两个样本中的值完全相同的情况，新增了异常处理。此修复解决了 [#23646](https://github.com/ClickHouse/ClickHouse/issues/23646)。[#23654](https://github.com/ClickHouse/ClickHouse/pull/23654) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复了通过 HTTP 插入数据时因异常引发的服务器故障。此修复对应 [#23512](https://github.com/ClickHouse/ClickHouse/issues/23512)。[#23643](https://github.com/ClickHouse/ClickHouse/pull/23643) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复了对某些包含转义序列的 `LIKE` 表达式的误判。[#23610](https://github.com/ClickHouse/ClickHouse/pull/23610) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了 restart / stop 命令挂起的问题。关闭了 [#20214](https://github.com/ClickHouse/ClickHouse/issues/20214)。[#23552](https://github.com/ClickHouse/ClickHouse/pull/23552) ([filimonov](https://github.com/filimonov)).
* 修复了在 select 查询包含多个 JOIN 时 `COLUMNS` 匹配器的问题。关闭 [#22736](https://github.com/ClickHouse/ClickHouse/issues/22736)。[#23501](https://github.com/ClickHouse/ClickHouse/pull/23501) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了一个崩溃问题：当某列本身被用作 `ReplacingMergeTree` 的参数时，修改该列的默认值会导致崩溃。[#23483](https://github.com/ClickHouse/ClickHouse/pull/23483) ([hexiaoting](https://github.com/hexiaoting))。
* 修复了 `ReplacingMergeTree` 在垂直合并中的一些边界情况问题。在极少数情况下，这些问题可能会导致合并失败，并抛出诸如 `Incomplete granules are not allowed while blocks are granules size` 之类的异常。[#23459](https://github.com/ClickHouse/ClickHouse/pull/23459) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了一个问题：不允许将空数组字面量转换为维度大于 1 的数组，例如 `CAST([] AS Array(Array(String)))`。已关闭 [#14476](https://github.com/ClickHouse/ClickHouse/issues/14476)。[#23456](https://github.com/ClickHouse/ClickHouse/pull/23456) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了一个 bug：重置计数器后，`deltaSum` 聚合函数会产生不正确的结果。[#23437](https://github.com/ClickHouse/ClickHouse/pull/23437) ([Russ Frank](https://github.com/rf)).
* 修复了在多磁盘配置下创建 ReplicatedMergeTree 表未成功时出现的 `Cannot unlink file` 错误。此修复关闭了 [#21755](https://github.com/ClickHouse/ClickHouse/issues/21755)。[#23433](https://github.com/ClickHouse/ClickHouse/pull/23433) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了基于虚拟列进行分区裁剪时生成不兼容常量表达式的问题。此修复对应于 [https://github.com/ClickHouse/ClickHouse/pull/21401#discussion\&#95;r611888913。](https://github.com/ClickHouse/ClickHouse/pull/21401#discussion\&#95;r611888913。) [#23366](https://github.com/ClickHouse/ClickHouse/pull/23366) ([Amos Bird](https://github.com/amosbird)).
* 修复了在将 join\_algorithm 设置为 'auto' 且使用字典执行 Join 时发生的崩溃问题。关闭了 [#23002](https://github.com/ClickHouse/ClickHouse/issues/23002)。[#23312](https://github.com/ClickHouse/ClickHouse/pull/23312) ([Vladimir](https://github.com/vdimir)).
* 在分区裁剪期间，不要放宽 NOT 条件。这修复了 [#23305](https://github.com/ClickHouse/ClickHouse/issues/23305) 和 [#21539](https://github.com/ClickHouse/ClickHouse/issues/21539)。[#23310](https://github.com/ClickHouse/ClickHouse/pull/23310) ([Amos Bird](https://github.com/amosbird))。
* 修复了在后台清理旧块时极少发生的竞态条件。如果某个块距离去重窗口末端过近，可能会导致该块未被去重。[#23301](https://github.com/ClickHouse/ClickHouse/pull/23301) ([tavplubix](https://github.com/tavplubix)).
* 修复了在创建和删除 ReplicatedMergeTree 表时极少出现的一种 (分布式) 竞态条件。该问题可能会导致在尝试创建复制表时抛出诸如 `node doesn't exist` 之类的异常。修复了 [#21419](https://github.com/ClickHouse/ClickHouse/issues/21419)。[#23294](https://github.com/ClickHouse/ClickHouse/pull/23294) ([tavplubix](https://github.com/tavplubix)).
* 修复了在主键不是第一个属性时，无法通过 DDL 创建 simple key 字典的问题。修复 [#23236](https://github.com/ClickHouse/ClickHouse/issues/23236)。[#23262](https://github.com/ClickHouse/ClickHouse/pull/23262) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了当表中存在许多很长的列名时，从 ODBC 读取数据的问题。关闭 [#8853](https://github.com/ClickHouse/ClickHouse/issues/8853)。[#23215](https://github.com/ClickHouse/ClickHouse/pull/23215) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* MaterializeMySQL (实验性功能) ：修复了从 `MaterializeMySQL` 中按键列条件查询时出现的 `Not found column` 错误。修复 [#22432](https://github.com/ClickHouse/ClickHouse/issues/22432)。[#23200](https://github.com/ClickHouse/ClickHouse/pull/23200) ([tavplubix](https://github.com/tavplubix)) 。
* 修正在子查询被优化为常量时的别名处理问题。修复了 [#22924](https://github.com/ClickHouse/ClickHouse/issues/22924)。修复了 [#10401](https://github.com/ClickHouse/ClickHouse/issues/10401)。[#23191](https://github.com/ClickHouse/ClickHouse/pull/23191) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 如果在默认 profile 中启用了 `data_type_default_nullable` 设置，服务器可能无法启动；该问题已修复。修复了 [#22573](https://github.com/ClickHouse/ClickHouse/issues/22573)。[#23185](https://github.com/ClickHouse/ClickHouse/pull/23185) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了一个在关闭过程中发生的崩溃，原因是当前连接计数有误。[#23154](https://github.com/ClickHouse/ClickHouse/pull/23154) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了将 materialized view 从 Atomic 数据库中分离并重新附加后，从中查询时出现的 `Table .inner_id... doesn't exist` 错误。[#23047](https://github.com/ClickHouse/ClickHouse/pull/23047) ([tavplubix](https://github.com/tavplubix)).
* 修复了子查询使用 `untuple` 时可能出现的错误 `Cannot find column in ActionsDAG result`。修复 [#22290](https://github.com/ClickHouse/ClickHouse/issues/22290)。[#22991](https://github.com/ClickHouse/ClickHouse/pull/22991) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了值可为空的 `Map` 类型常量列的使用问题。[#22939](https://github.com/ClickHouse/ClickHouse/pull/22939) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了 `DateTime64` 上的 `formatDateTime()` 和 `&quot;%C&quot;` 格式说明符；修复了在大值和非零标度情况下的 `toDateTime64()`。[#22937](https://github.com/ClickHouse/ClickHouse/pull/22937) ([Vasily Nemkov](https://github.com/Enmk)) 。
* 修复了 `mannWhitneyUTest` 和 `rankCorr` 与窗口函数一起使用时导致的崩溃问题。此修复解决了 [#22728](https://github.com/ClickHouse/ClickHouse/issues/22728)。[#22876](https://github.com/ClickHouse/ClickHouse/pull/22876) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* LIVE VIEW (实验性功能) ：修复了在 `TemporaryLiveViewCleaner` 中并发执行 TEMPORARY LIVE VIEW 的 DROP/CREATE 操作时可能卡住的问题，[见](https://gist.github.com/vzakaznikov/0c03195960fc86b56bfe2bc73a90019e)。[#22858](https://github.com/ClickHouse/ClickHouse/pull/22858) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了在过滤列用于聚合时 `HAVING` 下推失效的问题。[#22763](https://github.com/ClickHouse/ClickHouse/pull/22763) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了在发生 OOM 异常时，Zookeeper 请求可能挂起的问题。修复 [#22438](https://github.com/ClickHouse/ClickHouse/issues/22438)。[#22684](https://github.com/ClickHouse/ClickHouse/pull/22684) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 ReplicatedMergeTree 表引擎在多个副本上等待变更完成的问题。此前，mutation/alter 查询可能会在其他副本上的变更实际执行完成之前就已结束。[#22669](https://github.com/ClickHouse/ClickHouse/pull/22669) ([alesapin](https://github.com/alesapin)).
* 修复了在 SELECT 子句中未选择任何列时，带有嵌套类型的 Log 表引发异常的问题。[#22654](https://github.com/ClickHouse/ClickHouse/pull/22654) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复辅助 AWS 请求长时间无限等待的问题。[#22594](https://github.com/ClickHouse/ClickHouse/pull/22594) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 修复了客户端过早关闭连接时导致的崩溃问题 [#22579](https://github.com/ClickHouse/ClickHouse/issues/22579)。[#22591](https://github.com/ClickHouse/ClickHouse/pull/22591) ([nvartolomei](https://github.com/nvartolomei)).
* `Map` 数据类型 (实验性功能) ：修复了分布式查询中函数 `map` 格式不正确的问题。[#22588](https://github.com/ClickHouse/ClickHouse/pull/22588) ([foolchi](https://github.com/foolchi)) 。
* 修复了 TSV 格式末尾无换行符时空字符串的反序列化问题。此修复解决了 [#20244](https://github.com/ClickHouse/ClickHouse/issues/20244)。如果不升级版本，可采用的临时变通方法是：将 `input_format_null_as_default` 设为零。旧版本中该值默认为零。[#22527](https://github.com/ClickHouse/ClickHouse/pull/22527) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了 Merge Join 算法中对 `LowCardinality` 类型列进行错误类型转换的问题。关闭 [#22386](https://github.com/ClickHouse/ClickHouse/issues/22386) 和 [#22388](https://github.com/ClickHouse/ClickHouse/issues/22388)。[#22510](https://github.com/ClickHouse/ClickHouse/pull/22510) ([Vladimir](https://github.com/vdimir)) 。
* `tokenbf_v1` 全文索引中可能出现缓冲区溢出 (读取时) 。多余的字节不会被使用，但在极少数情况下，读取操作可能会导致崩溃。此修复解决了 [#19233](https://github.com/ClickHouse/ClickHouse/issues/19233)。[#22421](https://github.com/ClickHouse/ClickHouse/pull/22421) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 不再限制 HTTP 分块大小。修复了 [#21907](https://github.com/ClickHouse/ClickHouse/issues/21907)。[#22322](https://github.com/ClickHouse/ClickHouse/pull/22322) ([Ivan](https://github.com/abyss7)).
* 修复了一个 bug：在启用 `optimize_aggregation_in_order` 且表中存在大量 parts 时，会导致数据聚合不充分。略微提升了启用 `optimize_aggregation_in_order` 时的聚合性能。[#21889](https://github.com/ClickHouse/ClickHouse/pull/21889) ([Anton Popov](https://github.com/CurtizJ)).
* 检查表函数 `view` 是否作为列使用。这是对 #20350 的补充。[#21465](https://github.com/ClickHouse/ClickHouse/pull/21465) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了在包含 `JOIN` 和聚合的查询中，使用 `Merge` 引擎的表出现“unknown column”错误的问题。关闭 [#18368](https://github.com/ClickHouse/ClickHouse/issues/18368)，关闭 [#22226](https://github.com/ClickHouse/ClickHouse/issues/22226)。[#21370](https://github.com/ClickHouse/ClickHouse/pull/21370) ([Vladimir](https://github.com/vdimir)) 。
* 修复了下推优化中的名称冲突。该问题会导致在 FULL JOIN 之后出现错误的 `WHERE` 过滤。关闭 [#20497](https://github.com/ClickHouse/ClickHouse/issues/20497)。[#20622](https://github.com/ClickHouse/ClickHouse/pull/20622) ([Vladimir](https://github.com/vdimir)).
* 修复了一个极其罕见的 bug：当使用 `quorum_parallel=1` 执行 quorum insert 时，由于去重机制，实际上并不算真正的 "quorum"。 [#18215](https://github.com/ClickHouse/ClickHouse/pull/18215) ([filimonov](https://github.com/filimonov) - 报告，[alesapin](https://github.com/alesapin) - 修复)。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 在 CI 中并行运行 stateless tests。[#22300](https://github.com/ClickHouse/ClickHouse/pull/22300) ([alesapin](https://github.com/alesapin)).
* 简化 Debian 软件包。此项修复了 [#21698](https://github.com/ClickHouse/ClickHouse/issues/21698)。[#22976](https://github.com/ClickHouse/ClickHouse/pull/22976) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 新增对在 Apple M1 上构建 ClickHouse 的支持。[#21639](https://github.com/ClickHouse/ClickHouse/pull/21639) ([changvvb](https://github.com/changvvb)).
* 修复了 ClickHouse Keeper 在 macOS 上的构建问题。[#22860](https://github.com/ClickHouse/ClickHouse/pull/22860) ([alesapin](https://github.com/alesapin)).
* 修复了 AArch64 平台上的一些测试问题。[#22596](https://github.com/ClickHouse/ClickHouse/pull/22596) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 增加了函数对齐，可能提升性能。[#21431](https://github.com/ClickHouse/ClickHouse/pull/21431) ([Danila Kutenin](https://github.com/danlark1)).
* 调整了一些测试，使其在 amd64 和 aarch64 (qemu) 上输出相同结果。此前结果取决于 CPU 的特定实现行为。[#22590](https://github.com/ClickHouse/ClickHouse/pull/22590) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 仅允许在 x86\_64 上进行查询性能分析。参见 [#15174](https://github.com/ClickHouse/ClickHouse/issues/15174#issuecomment-812954965) 和 [#15638](https://github.com/ClickHouse/ClickHouse/issues/15638#issuecomment-703805337)。此项关闭了 [#15638](https://github.com/ClickHouse/ClickHouse/issues/15638)。[#22580](https://github.com/ClickHouse/ClickHouse/pull/22580) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 允许通过 `USE_INTERNAL_XZ_LIBRARY=OFF` CMake 选项使用未捆绑的 xz (lzma) 进行构建。[#22571](https://github.com/ClickHouse/ClickHouse/pull/22571) ([Kfir Itzhak](https://github.com/mastertheknife)).
* 在 `ppc64le` 上启用内置的 `openldap`。[#22487](https://github.com/ClickHouse/ClickHouse/pull/22487) ([Kfir Itzhak](https://github.com/mastertheknife)).
* 在 `ppc64le` 上禁用不兼容的库 (通常为平台特定库) 。[#22475](https://github.com/ClickHouse/ClickHouse/pull/22475) ([Kfir Itzhak](https://github.com/mastertheknife)).
* 在 CI 中为 ClickHouse Keeper 添加 Jepsen 测试。[#22373](https://github.com/ClickHouse/ClickHouse/pull/22373) ([alesapin](https://github.com/alesapin)).
* 构建支持[堆分析](https://github.com/jemalloc/jemalloc/wiki/Use-Case%3A-Heap-Profiling)的 `jemalloc`。[#22834](https://github.com/ClickHouse/ClickHouse/pull/22834) ([nvartolomei](https://github.com/nvartolomei)).
* 避免 `*Log` 引擎中因从另一个线程解锁 rwlock 而导致的未定义行为。[#22583](https://github.com/ClickHouse/ClickHouse/pull/22583) ([Azat Khuzhin](https://github.com/azat)).
* 通过从同一线程解锁 TinyLog 的 rwlock，修复了未定义行为问题。[#22560](https://github.com/ClickHouse/ClickHouse/pull/22560) ([Azat Khuzhin](https://github.com/azat)).

<div id="clickhouse-release-214">
  ## ClickHouse 21.4 版本发布
</div>

<div id="clickhouse-release-2141-2021-04-12">
  ### ClickHouse 发布 21.4.1 2021-04-12
</div>

<div id="backward-incompatible-change">
  #### 向后不兼容变更
</div>

* `toStartOfIntervalFunction` 现在会将按小时划分的时间间隔对齐到午夜 (在之前的版本中，它们是对齐到 Unix 纪元起点的) 。例如，`toStartOfInterval(x, INTERVAL 11 HOUR)` 会将每天划分为三个时间间隔：`00:00:00..10:59:59`、`11:00:00..21:59:59` 和 `22:00:00..23:59:59`。这种行为更符合实际需求。此更改关闭了 [#9510](https://github.com/ClickHouse/ClickHouse/issues/9510)。[#22060](https://github.com/ClickHouse/ClickHouse/pull/22060) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* graphite rollup 配置中的 `Age` 和 `Precision` 应当随着 retention 的增加而递增。现在会对此进行检查，错误的配置会引发异常。[#21496](https://github.com/ClickHouse/ClickHouse/pull/21496) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) 。
* 修复了 `cutToFirstSignificantSubdomainCustom()`/`firstSignificantSubdomainCustom()` 在自定义顶级域名列表中包含三级及以上域时返回错误结果的问题。对于匹配这些自定义顶级域的输入域名，此前会将三级域视为第一个有效域。现在该问题已修复。如果该函数被用于例如 sharding key，此更改可能会引入不兼容性。[#21946](https://github.com/ClickHouse/ClickHouse/pull/21946) ([Azat Khuzhin](https://github.com/azat)) 。
* 表 `system.dictionaries` 中的列 `keys` 已替换为 `key.names` 和 `key.types` 两列。`system.dictionaries` 表中的 `key.names`、`key.types`、`attribute.names`、`attribute.types` 列不要求先加载字典。[#21884](https://github.com/ClickHouse/ClickHouse/pull/21884) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 现在，处理 `ALTER TABLE ATTACH PART[ITION]` 命令的副本会先在其 `detached/` 文件夹中查找，然后再从其他副本拉取数据。作为实现细节，复制日志中引入了一条新命令 `ATTACH_PART`。分片 会按校验和进行查找和比较。[#18978](https://github.com/ClickHouse/ClickHouse/pull/18978) ([Mike Kot](https://github.com/myrrc)) 。**注意**：
  * `ATTACH PART[ITION]` 查询在集群升级期间可能无法工作。
  * 在新版本中执行 `ALTER ... ATTACH` 查询后，将无法回滚到旧版 ClickHouse，因为旧服务器无法处理复制日志中的 `ATTACH_PART` 条目。
* 在此版本中，空的 `<remote_url_allow_hosts></remote_url_allow_hosts>` 会阻止对所有远程主机的访问，而在之前的版本中它不会产生任何作用。如果你想保留旧行为，并且配置文件中存在空的 `remote_url_allow_hosts` 元素，请将其删除。[#20058](https://github.com/ClickHouse/ClickHouse/pull/20058) ([Vladimir Chebotarev](https://github.com/excitoon)) 。

<div id="new-feature">
  #### 新功能
</div>

* 扩展了 `DateTime64` 的取值范围，使其支持 1925 年至 2283 年的日期。改进了 `DateTime` 在零日期 (`1970-01-01`) 附近的支持。[#9404](https://github.com/ClickHouse/ClickHouse/pull/9404) ([alexey-milovidov](https://github.com/alexey-milovidov)、[Vasily Nemkov](https://github.com/Enmk)) 。并非所有时间和日期函数都能在扩展后的日期范围内正常工作。
* 新增了对预配置用户和 HTTP 请求 (GSS-SPNEGO) 的 Kerberos 身份验证支持。[#14995](https://github.com/ClickHouse/ClickHouse/pull/14995) ([Denis Glazachev](https://github.com/traceon)).
* 添加 `prefer_column_name_to_alias` 设置，以使用原始列名而非别名。这样做是为了更好地兼容常见数据库的别名规则。相关内容见 [#9715](https://github.com/ClickHouse/ClickHouse/issues/9715) 和 [#9887](https://github.com/ClickHouse/ClickHouse/issues/9887)。[#22044](https://github.com/ClickHouse/ClickHouse/pull/22044) ([Amos Bird](https://github.com/amosbird)) 。
* 新增了函数 `dictGetChildren(dictionary, key)`、`dictGetDescendants(dictionary, key, level)`。函数 `dictGetChildren` 以索引数组的形式返回所有子项。它是 `dictGetHierarchy` 的逆变换。函数 `dictGetDescendants` 返回所有后代，相当于将 `dictGetChildren` 递归应用 `level` 次。`level` 的值为 0 时等同于无穷大。关闭了 [#14656](https://github.com/ClickHouse/ClickHouse/issues/14656)。[#22096](https://github.com/ClickHouse/ClickHouse/pull/22096) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增了 `executable_pool` 字典源。解决了 [#14528](https://github.com/ClickHouse/ClickHouse/issues/14528)。[#21321](https://github.com/ClickHouse/ClickHouse/pull/21321) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增表函数 `dictionary`。其工作方式与 `Dictionary` 引擎相同。关闭了 [#21560](https://github.com/ClickHouse/ClickHouse/issues/21560)。[#21910](https://github.com/ClickHouse/ClickHouse/pull/21910) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 支持 `PolygonDictionary` 属性使用 `Nullable` 类型。[#21890](https://github.com/ClickHouse/ClickHouse/pull/21890) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 对于使用 DDL 创建的字典，如果未指定数据库名称，函数 `dictGet` 和 `dictHas` 会使用当前数据库名。已关闭 [#21632](https://github.com/ClickHouse/ClickHouse/issues/21632)。[#21859](https://github.com/ClickHouse/ClickHouse/pull/21859) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增了函数 `dictGetOrNull`。其行为与 `dictGet` 类似，但如果在字典中找不到键，则返回 `NULL`。关闭 [#22375](https://github.com/ClickHouse/ClickHouse/issues/22375)。[#22413](https://github.com/ClickHouse/ClickHouse/pull/22413) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 `ComplexKeyCache`、`SSDCache`、`SSDComplexKeyCache` 字典新增了异步更新功能。为 `Cache`、`ComplexKeyCache`、`SSDCache`、`SSDComplexKeyCache` 字典增加了对 `Nullable` 类型的支持。为 `dictGet`、`dictGetOrDefault` 函数增加了对拉取多个属性的支持。修复了 [#21517](https://github.com/ClickHouse/ClickHouse/issues/21517)。[#20595](https://github.com/ClickHouse/ClickHouse/pull/20595) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 支持 `RangeHashedDictionary` 的 `dictHas` 函数。修复 [#6680](https://github.com/ClickHouse/ClickHouse/issues/6680)。[#19816](https://github.com/ClickHouse/ClickHouse/pull/19816) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 添加函数 `timezoneOf`，用于返回 `DateTime` 或 `DateTime64` 数据类型的时区名称。这并未关闭 [#9959](https://github.com/ClickHouse/ClickHouse/issues/9959)。修复函数名称不一致的问题：添加别名 `timezone` 和 `timeZone`，以及 `toTimezone` 和 `toTimeZone`，还有 `timezoneOf` 和 `timeZoneOf`。[#22001](https://github.com/ClickHouse/ClickHouse/pull/22001) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 为 `CREATE/ALTER USER` 命令新增了可选子句 `GRANTEES`。它用于指定允许从该用户接收授权的用户或角色，前提是该用户自身也已获得所有必需的访问权限，并且带有 grant option。默认使用 `GRANTEES ANY`，这意味着具有 grant option 的用户可以向任何人授予权限。语法：`CREATE USER ... GRANTEES {user | role | ANY | NONE} [,...] [EXCEPT {user | role} [,...]]`。[#21641](https://github.com/ClickHouse/ClickHouse/pull/21641) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 向 `system.clusters` 新增列 `slowdowns_count`。使用对冲请求时，它会显示因该副本响应缓慢而切换到另一个副本的次数。同时还会显示 `system.clusters` 中 `errors_count` 的实际值。[#21480](https://github.com/ClickHouse/ClickHouse/pull/21480) ([Kruglov Pavel](https://github.com/Avogar)).
* 为 `MergeTree*` 引擎添加 `_partition_id` 虚拟列。允许按 `_partition_id` 对分区进行剪枝。添加 `partitionID()` 函数，用于计算分区 ID 字符串。[#21401](https://github.com/ClickHouse/ClickHouse/pull/21401) ([Amos Bird](https://github.com/amosbird)) 。
* 添加函数 `isIPAddressInRange`，用于测试某个 IPv4 或 IPv6 地址是否位于给定的 CIDR 网络前缀内。[#21329](https://github.com/ClickHouse/ClickHouse/pull/21329) ([PHO](https://github.com/depressed-pho)).
* 新增 SQL 命令 `ALTER TABLE 'table_name' UNFREEZE [PARTITION 'part_expr'] WITH NAME 'backup_name'`。该命令用于从所有磁盘中正确删除“已冻结”的分区。[#21142](https://github.com/ClickHouse/ClickHouse/pull/21142) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* 支持对 JOIN 键进行隐式类型转换。[#19885](https://github.com/ClickHouse/ClickHouse/pull/19885) ([Vladimir](https://github.com/vdimir)) 。

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 支持浮点类型的 `RANGE OFFSET` 窗口帧 (用于窗口函数) 。实现了 `lagInFrame`/`leadInFrame` 窗口函数，它们与 `lag`/`lead` 类似，但会遵循窗口帧的范围。当窗口帧为 `between unbounded preceding and unbounded following` 时，它们与 `lag`/`lead` 完全相同。此项变更关闭了 [#5485](https://github.com/ClickHouse/ClickHouse/issues/5485)。[#21895](https://github.com/ClickHouse/ClickHouse/pull/21895) ([Alexander Kuzmenkov](https://github.com/akuzm)) 。
* 基于 S3 存储的 `ReplicatedMergeTree` 支持零拷贝复制。[#16240](https://github.com/ClickHouse/ClickHouse/pull/16240) ([ianton-ru](https://github.com/ianton-ru)) 。
* 新增将现有 S3 磁盘迁移到具备备份恢复能力的 schema 的功能。[#22070](https://github.com/ClickHouse/ClickHouse/pull/22070) ([Pavel Kovalenko](https://github.com/Jokser)) 。

<div id="performance-improvement">
  #### 性能改进
</div>

* 在 `clickhouse-local` 以及其他场景中支持并行格式化。[#21630](https://github.com/ClickHouse/ClickHouse/pull/21630) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 支持对 `CSVWithNames` 和 `TSVWithNames` 格式进行并行解析。此项变更关闭了 [#21085](https://github.com/ClickHouse/ClickHouse/issues/21085)。[#21149](https://github.com/ClickHouse/ClickHouse/pull/21149) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 对 64 MiB 及以上的文件范围启用 mmap IO 读取 (设置 `min_bytes_to_use_mmap_io`) 。这可能带来一定的性能提升。[#22326](https://github.com/ClickHouse/ClickHouse/pull/22326) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 为使用 `min_bytes_to_use_mmap_io` 设置读取的文件添加缓存。通过避免频繁调用 mmap/munmap 及其导致的缺页错误，当该设置值较小时，可带来显著 (2 倍及以上) 的性能提升。请注意，mmap IO 有一些明显缺点，使其在生产环境中的可靠性较低 (例如磁盘故障时可能卡住或触发 SIGBUS；内存使用也较难控制) 。尽管如此，它在基准测试中表现不错。[#22206](https://github.com/ClickHouse/ClickHouse/pull/22206) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 在使用 codec `NONE` 时，避免不必要的数据拷贝。请注意，codec `NONE` 在大多数情况下都没什么用——建议始终使用压缩 (默认是 `LZ4`) 。与普遍看法相反，禁用压缩未必会提升性能 (甚至可能适得其反) 。`NONE` codec 在某些情况下有用：- 当数据不可压缩时；- 用于合成基准测试。[#22145](https://github.com/ClickHouse/ClickHouse/pull/22145) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 在 `max_rows_to_group_by` 较小且 `group_by_overflow_mode='any'` 时，`GROUP BY` 性能更快。[#21856](https://github.com/ClickHouse/ClickHouse/pull/21856) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
* 优化了 `SELECT ... FINAL ... WHERE` 这类查询的性能。现在，在带有 `FINAL` 的查询中，位于排序键中的列也可以下推到 `PREWHERE`。[#21830](https://github.com/ClickHouse/ClickHouse/pull/21830) ([foolchi](https://github.com/foolchi)).
* 通过将 `memcpy` 替换为另一种实现提升了性能。此项变更关闭了 [#18583](https://github.com/ClickHouse/ClickHouse/issues/18583)。[#21520](https://github.com/ClickHouse/ClickHouse/pull/21520) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 提升了按排序键顺序进行聚合的性能 (启用设置 `optimize_aggregation_in_order` 时) 。[#19401](https://github.com/ClickHouse/ClickHouse/pull/19401) ([Anton Popov](https://github.com/CurtizJ)).

<div id="improvement">
  #### 改进
</div>

* 为 PostgreSQL 表/数据库引擎和字典源添加连接池。此项改动应可修复 [#21444](https://github.com/ClickHouse/ClickHouse/issues/21444)。[#21839](https://github.com/ClickHouse/ClickHouse/pull/21839) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 支持在 Postgres 存储/表函数中使用非默认表 schema。关闭 [#21701](https://github.com/ClickHouse/ClickHouse/issues/21701)。[#21711](https://github.com/ClickHouse/ClickHouse/pull/21711) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 支持为 Postgres 字典源设置副本优先级。[#21710](https://github.com/ClickHouse/ClickHouse/pull/21710) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 引入了一个新的 MergeTree 设置 `min_bytes_to_rebalance_partition_over_jbod`，可将新的 parts 以更均衡的方式分配到 JBOD 卷中的不同磁盘上。[#16481](https://github.com/ClickHouse/ClickHouse/pull/16481) ([Amos Bird](https://github.com/amosbird)) 。
* 在 `system.query_log` 中，为相应查询的 `query_kind` 列新增了 `Grant`、`Revoke` 和 `System` 取值。[#21102](https://github.com/ClickHouse/ClickHouse/pull/21102) ([Vasily Nemkov](https://github.com/Enmk)) 。
* 允许为复制所使用的 HTTP 连接单独自定义超时时间，而不受其他 HTTP 超时设置的影响。[#20088](https://github.com/ClickHouse/ClickHouse/pull/20088) ([nvartolomei](https://github.com/nvartolomei)).
* 如果 server 在写入块时发生异常，client 端的异常消息将更清晰。此前版本中，client 可能会收到带有误导性的信息，例如 `Data compressed with different methods`。[#22427](https://github.com/ClickHouse/ClickHouse/pull/22427) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了在拉取分片失败后可能出现的 `Directory tmp_fetch_XXX already exists` 错误。如果临时拉取目录已存在，则将其删除。修复了 [#14197](https://github.com/ClickHouse/ClickHouse/issues/14197)。[#22411](https://github.com/ClickHouse/ClickHouse/pull/22411) ([nvartolomei](https://github.com/nvartolomei)) 。
* 修复了函数 `range` 在使用 `UInt256` 参数时触发的 MSan 报告问题 (对大整数的支持仍处于 Experimental 阶段) 。此修复关闭了 [#22157](https://github.com/ClickHouse/ClickHouse/issues/22157)。[#22387](https://github.com/ClickHouse/ClickHouse/pull/22387) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 向 `system.processes` 表添加 `current_database` 列。该列包含该查询当前使用的数据库。[#22365](https://github.com/ClickHouse/ClickHouse/pull/22365) ([Alexander Kuzmenkov](https://github.com/akuzm)) 。
* 为 `clickhouse-client` 添加不区分大小写的历史记录搜索/导航功能以及子词移动功能。[#22105](https://github.com/ClickHouse/ClickHouse/pull/22105) ([Amos Bird](https://github.com/amosbird)) 。
* 如果由 NULL 组成的 Tuple (例如 `(NULL, NULL)`) 位于 `IN` 运算符的左侧，而右侧是由非 NULL 值组成的 Tuple，例如 `SELECT (NULL, NULL) IN ((0, 0), (3, 1))`，则返回 0，而不是因类型不兼容而抛出异常。该表达式也可能由于对类似 `SELECT (NULL, NULL) = (8, 0) OR (NULL, NULL) = (3, 2) OR (NULL, NULL) = (0, 0) OR (NULL, NULL) = (3, 1)` 这样的语句进行优化而出现。此修复关闭了 [#22017](https://github.com/ClickHouse/ClickHouse/issues/22017)。[#22063](https://github.com/ClickHouse/ClickHouse/pull/22063) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 将 simdjson 的版本更新为 0.9.1。这修复了 [#21984](https://github.com/ClickHouse/ClickHouse/issues/21984)。[#22057](https://github.com/ClickHouse/ClickHouse/pull/22057) ([Vitaly Baranov](https://github.com/vitlibar)).
* 为 `CONNECTION_ID()` 和 `VERSION()` 函数添加了不区分大小写的别名。此项修复解决了 [#22028](https://github.com/ClickHouse/ClickHouse/issues/22028)。[#22042](https://github.com/ClickHouse/ClickHouse/pull/22042) ([Eugene Klimov](https://github.com/Slach)) 。
* 为 `windowFunnel` 函数新增 `strict_increase` 选项，使每个事件只计算一次 (修复 [#21835](https://github.com/ClickHouse/ClickHouse/issues/21835)) 。[#22025](https://github.com/ClickHouse/ClickHouse/pull/22025) ([Vladimir](https://github.com/vdimir)).
* 如果 `MergeTree` 表的分区键不包含 `Date` 或 `DateTime` 列，而恰好包含一个 `DateTime64` 列，则在 `system.parts` 和 `system.parts_columns` 表的 `min_time` 和 `max_time` 列中显示其值。向 `system.parts_columns` 表添加 `min_time` 和 `max_time` 列 (此前这与 `system.parts` 表不一致) 。这修复了 [#18244](https://github.com/ClickHouse/ClickHouse/issues/18244)。[#22011](https://github.com/ClickHouse/ClickHouse/pull/22011) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在 `clickhouse-copier` 中支持 `replication_alter_partitions_sync=1` 设置，用于将分区从辅助表移动到目标端。缩短了默认超时时间。修复了 [#21911](https://github.com/ClickHouse/ClickHouse/issues/21911)。[#21912](https://github.com/ClickHouse/ClickHouse/pull/21912) ([turbo jason](https://github.com/songenjie)) 。
* 在系统表中显示 `EmbeddedRocksDB` 表的数据目录路径。[#21903](https://github.com/ClickHouse/ClickHouse/pull/21903) ([tavplubix](https://github.com/tavplubix)) 。
* 新增 profile 事件 `HedgedRequestsChangeReplica`，将读取数据超时从秒改为毫秒。[#21886](https://github.com/ClickHouse/ClickHouse/pull/21886) ([Kruglov Pavel](https://github.com/Avogar)) 。
* DiskS3 (仍在开发中的实验性功能) 。修复了一个问题：如果目标目录非空且使用了缓存磁盘，则目录无法移动。[#21837](https://github.com/ClickHouse/ClickHouse/pull/21837) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* 改进了 Web UI 中 `Array` 和 `Map` 数据类型的显示格式。[#21798](https://github.com/ClickHouse/ClickHouse/pull/21798) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 仅在配置发生变更时才更新集群。[#21685](https://github.com/ClickHouse/ClickHouse/pull/21685) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 为分布式 DDL 查询传递查询设置和会话设置。将 `distributed_ddl_entry_format_version` 设为 2 以启用此功能。新增 `distributed_ddl_output_mode` 设置。支持的模式：`none`、`throw` (默认) 、`null_status_on_timeout` 和 `never_throw`。对 `Replicated` 数据库引擎进行了多项修复和改进。[#21535](https://github.com/ClickHouse/ClickHouse/pull/21535) ([tavplubix](https://github.com/tavplubix)) 。
* 如果 `PODArray` 实例化时使用的元素大小既不是 16 的约数，也不是 16 的倍数，就可能发生缓冲区溢出。当前发布版本中不存在此类缺陷。[#21533](https://github.com/ClickHouse/ClickHouse/pull/21533) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 为 `system.errors` 新增 `last_error_time`/`last_error_message`/`last_error_stacktrace`/`remote` 列。[#21529](https://github.com/ClickHouse/ClickHouse/pull/21529) ([Azat Khuzhin](https://github.com/azat)) 。
* 为 `visitParam/visitParamExtract{UInt, Int, Bool, Float, Raw, String}` 新增别名 `simpleJSONExtract/simpleJSONHas`。修复了 #21383。[#21519](https://github.com/ClickHouse/ClickHouse/pull/21519) ([fastio](https://github.com/fastio))。
* 新增设置 `optimize_skip_unused_shards_limit`，用于限制 `optimize_skip_unused_shards` 的分片键值数量。 [#21512](https://github.com/ClickHouse/ClickHouse/pull/21512) ([Azat Khuzhin](https://github.com/azat)).
* 改进 `clickhouse-format`：当最后一个查询后有多余空格或注释时，不再抛出异常；并且在格式化带有数据的 `ASTInsertQuery` 时，会尽早抛出带有易读错误信息的异常。[#21311](https://github.com/ClickHouse/ClickHouse/pull/21311) ([flynn](https://github.com/ucasFL)).
* 改进了对 `Map` 数据类型中整数键的支持。[#21157](https://github.com/ClickHouse/ClickHouse/pull/21157) ([Anton Popov](https://github.com/CurtizJ)) 。
* MaterializeMySQL：如果与 MySQL 的连接断开，则尝试重新连接到 MySQL。[#20961](https://github.com/ClickHouse/ClickHouse/pull/20961) ([Håvard Kvålen](https://github.com/havardk)) 。
* 支持在更多场景下将 `CROSS JOIN` 改写为 `INNER JOIN`。[#20392](https://github.com/ClickHouse/ClickHouse/pull/20392) ([Vladimir](https://github.com/vdimir)) 。
* 启用 `optimize_on_insert` 设置后，INSERT 时不会创建空的 parts。修复了 [#20304](https://github.com/ClickHouse/ClickHouse/issues/20304)。[#20387](https://github.com/ClickHouse/ClickHouse/pull/20387) ([Kruglov Pavel](https://github.com/Avogar)) 。
* `MaterializeMySQL`：为 `_version` 列新增 minmax 跳过索引。[#20382](https://github.com/ClickHouse/ClickHouse/pull/20382) ([Stig Bakken](https://github.com/stigsb)) 。
* 为 `clickhouse-format` 新增 `--backslash` 选项，可在格式化后的查询每行末尾添加反斜杠。[#21494](https://github.com/ClickHouse/ClickHouse/pull/21494) ([flynn](https://github.com/ucasFL)) 。
* 现在，当我们尝试对已被覆盖的分片执行变更操作时，ClickHouse 不会再抛出 `LOGICAL_ERROR` 异常。修复了 [#22013](https://github.com/ClickHouse/ClickHouse/issues/22013)。[#22291](https://github.com/ClickHouse/ClickHouse/pull/22291) ([alesapin](https://github.com/alesapin)) 。

<div id="bug-fixes">
  #### 问题修复
</div>

* 在 `HedgedConnections` 中，在取消数据包接收器之前先将套接字从 epoll 中移除，以避免可能出现的竞态。修复了 [#22161](https://github.com/ClickHouse/ClickHouse/issues/22161)。[#22443](https://github.com/ClickHouse/ClickHouse/pull/22443) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 在并行解析例程中补充 (缺失的) 内存统计。在先前版本中，当结果集包含非常大的数据块时，可能会发生 OOM。此修复关闭了 [#22008](https://github.com/ClickHouse/ClickHouse/issues/22008)。[#22425](https://github.com/ClickHouse/ClickHouse/pull/22425) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了这样一个异常：当 `SELECT` 带有常量 `WHERE` 条件，且源表中存在列名为数字的列时，可能会触发该异常。[#22270](https://github.com/ClickHouse/ClickHouse/pull/22270) ([LiuNeng](https://github.com/liuneng1994)).
* 修复在 `use_hedged_requests=0` 且 `async_socket_for_remote=1` 时无法取消查询的问题。[#22183](https://github.com/ClickHouse/ClickHouse/pull/22183) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复 `InterserverIOHTTPHandler` 中未被捕获的异常。[#22146](https://github.com/ClickHouse/ClickHouse/pull/22146) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在配置中没有 `http_port` 时 Docker 入口点的问题。[#22132](https://github.com/ClickHouse/ClickHouse/pull/22132) ([Ewout](https://github.com/devwout)) 。
* 修复了 `JOIN` 与 `TOTALS` 及 `arrayJoin` 一起使用时出现的错误 `Invalid number of rows in Chunk`。已关闭 [#19303](https://github.com/ClickHouse/ClickHouse/issues/19303)。[#22129](https://github.com/ClickHouse/ClickHouse/pull/22129) ([Vladimir](https://github.com/vdimir)).
* 修复了此前用于从 Kafka 轮询消息的后台线程池名称。使用异常线程池的 Kafka 引擎将无法从消息队列消费消息。[#22122](https://github.com/ClickHouse/ClickHouse/pull/22122) ([fastio](https://github.com/fastio)).
* 修复了 `ReplicatedMergeTree` 表引擎中 `OPTIMIZE` 和 `ALTER` 查询等待的问题。现在，当表处于 detached 状态或重启后，查询将不会再挂起。[#22118](https://github.com/ClickHouse/ClickHouse/pull/22118) ([alesapin](https://github.com/alesapin)).
* 为存在缺陷的 Linux 内核禁用 `async_socket_for_remote`/`use_hedged_requests`。[#22109](https://github.com/ClickHouse/ClickHouse/pull/22109) ([Azat Khuzhin](https://github.com/azat)) 。
* Docker 入口点：避免在 `LOG_PATH` 为空时对 `.` 执行 chown。关闭 [#22100](https://github.com/ClickHouse/ClickHouse/issues/22100)。[#22102](https://github.com/ClickHouse/ClickHouse/pull/22102) ([filimonov](https://github.com/filimonov)) 。
* 函数 `decrypt` 此前缺少对以 `AEAD` 模式加密的数据最小长度的检查。此修复关闭了 [#21897](https://github.com/ClickHouse/ClickHouse/issues/21897)。[#22064](https://github.com/ClickHouse/ClickHouse/pull/22064) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在极少数情况下，`CollapsingMergeTree` 的合并可能会生成包含 `index_granularity + 1` 行的粒度。因此，在 [#18928](https://github.com/ClickHouse/ClickHouse/issues/18928) 中添加的内部检查 (影响 21.2 和 21.3) 可能会因报错 `Incomplete granules are not allowed while blocks are granules size` 而失败。该错误会导致 parts 无法合并。[#21976](https://github.com/ClickHouse/ClickHouse/pull/21976) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 已回退 [#15454](https://github.com/ClickHouse/ClickHouse/issues/15454) 中的更改，该更改在加载哈希类型的外部字典时可能导致内存使用量显著增加。此更改修复了 [#21935](https://github.com/ClickHouse/ClickHouse/issues/21935)。[#21948](https://github.com/ClickHouse/ClickHouse/pull/21948) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 防止对冲连接发生重叠 (`Unknown packet 9 from server` 错误) 。[#21941](https://github.com/ClickHouse/ClickHouse/pull/21941) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在某些情况下无法读取内容类型为 "multipart/form-data" 的 HTTP POST 请求的问题。[#21936](https://github.com/ClickHouse/ClickHouse/pull/21936) ([Ivan](https://github.com/abyss7)) 。
* 修复了以下问题：当查询包含窗口函数并应用按主键顺序读取优化时，`ORDER BY` 结果会出错。修复 [#21828](https://github.com/ClickHouse/ClickHouse/issues/21828)。[#21915](https://github.com/ClickHouse/ClickHouse/pull/21915) ([Alexander Kuzmenkov](https://github.com/akuzm)) 。
* 修复首次执行 catboost 模型时出现的死锁问题。关闭 [#13832](https://github.com/ClickHouse/ClickHouse/issues/13832)。[#21844](https://github.com/ClickHouse/ClickHouse/pull/21844) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 修复了在 `WHERE` 或 `HAVING` 条件被下推到 `GROUP BY` 之前时，可能出现的错误查询结果 (以及可能发生的崩溃) 。修复 [#21773](https://github.com/ClickHouse/ClickHouse/issues/21773)。[#21841](https://github.com/ClickHouse/ClickHouse/pull/21841) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 改进了 `WriteBufferFromS3` 中的错误处理和日志。[#21836](https://github.com/ClickHouse/ClickHouse/pull/21836) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* 修复了在使用两级聚合时，带有 `Distinct` 组合器的聚合函数可能崩溃的问题。这是对 [#18365](https://github.com/ClickHouse/ClickHouse/pull/18365) 的后续修复。只能在生产环境中复现。[#21818](https://github.com/ClickHouse/ClickHouse/pull/21818) ([Amos Bird](https://github.com/amosbird)).
* 修复标量子查询的索引分析问题。该修复解决了 [#21717](https://github.com/ClickHouse/ClickHouse/issues/21717) 中的问题，该问题是在 [#18896](https://github.com/ClickHouse/ClickHouse/pull/18896) 中引入的。[#21766](https://github.com/ClickHouse/ClickHouse/pull/21766) ([Amos Bird](https://github.com/amosbird))。
* 修复了 `ReplicatedMerge` 表引擎中的一个问题：如果 `Decimal` 列的大小 (32 位或 64 位) 没有变化，`ALTER MODIFY COLUMN` 查询就无法修改其类型。[#21728](https://github.com/ClickHouse/ClickHouse/pull/21728) ([alesapin](https://github.com/alesapin)).
* 修复了对 `ReplicatedMergeTree` 并发执行 `OPTIMIZE` 和 `DROP` 时可能导致无限等待的问题。[#21716](https://github.com/ClickHouse/ClickHouse/pull/21716) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了函数 `arrayElement` 在参数为常量整数时处理 `Map` 类型的问题。[#21699](https://github.com/ClickHouse/ClickHouse/pull/21699) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了在 `ip_trie` 中使用 `access_to_key_from_attributes` 访问不存在的属性时触发的 SIGSEGV 问题。[#21692](https://github.com/ClickHouse/ClickHouse/pull/21692) ([Azat Khuzhin](https://github.com/azat)) 。
* 服务器现仅在 `DDLWorker` 和字典完成初始化后才开始接受连接。[#21676](https://github.com/ClickHouse/ClickHouse/pull/21676) ([Azat Khuzhin](https://github.com/azat)).
* 为 `Join` 类型表的键增加了类型转换支持 (此前会导致 SIGSEGV) 。[#21646](https://github.com/ClickHouse/ClickHouse/pull/21646) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在 `async_socket_for_remote=1` 时分布式请求取消的问题 (例如，带有 limit 的从多个分片进行简单 select，即 `select * from remote('127.{2,3}', system.numbers) limit 100`) 。[#21643](https://github.com/ClickHouse/ClickHouse/pull/21643) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复水平合并中的 `fsync_part_directory` 问题。 [#21642](https://github.com/ClickHouse/ClickHouse/pull/21642) ([Azat Khuzhin](https://github.com/azat)) 。
* 对于外部数据库引擎 (MySQL、PostgreSQL) 的查询，从 `WHERE` 中移除关联表里的未知列。关闭 [#14614](https://github.com/ClickHouse/ClickHouse/issues/14614)、关闭 [#19288](https://github.com/ClickHouse/ClickHouse/issues/19288) (重复) 、关闭 [#19645](https://github.com/ClickHouse/ClickHouse/issues/19645) (重复) 。[#21640](https://github.com/ClickHouse/ClickHouse/pull/21640) ([Vladimir](https://github.com/vdimir)) 。
* 如果在向 S3 写入数据时发生错误，就会调用 `std::terminate`。 [#21624](https://github.com/ClickHouse/ClickHouse/pull/21624) ([Vladimir](https://github.com/vdimir)).
* 修复了在启用 `optimize_skip_unused_shards` 且未使用任何分片时可能出现的错误 `Cannot find column`。[#21579](https://github.com/ClickHouse/ClickHouse/pull/21579) ([Azat Khuzhin](https://github.com/azat)).
* 如果查询中的 `WHERE` 条件是常量，且已启用 `optimize_skip_unused_shards` 设置，则可能会跳过所有分片，导致查询错误地返回空结果。[#21550](https://github.com/ClickHouse/ClickHouse/pull/21550) ([Amos Bird](https://github.com/amosbird)) 。
* 修复表函数 `clusterAllReplicas` 返回错误 `_shard_num` 的问题。关闭 [#21481](https://github.com/ClickHouse/ClickHouse/issues/21481)。[#21498](https://github.com/ClickHouse/ClickHouse/pull/21498) ([flynn](https://github.com/ucasFL)).
* 修复了 S3 表在配置更新后仍持有旧凭据的问题。[#21457](https://github.com/ClickHouse/ClickHouse/pull/21457) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) 。
* 修复了 Poco 中 `SecureSocket` 内部 SSL 对象的竞争条件。[#21456](https://github.com/ClickHouse/ClickHouse/pull/21456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复 `Kafka` 的 `Avro` 格式解析。修复了 [#21437](https://github.com/ClickHouse/ClickHouse/issues/21437)。[#21438](https://github.com/ClickHouse/ClickHouse/pull/21438) ([Ilya Golshtein](https://github.com/ilejn)) 。
* 修复安全套接字中的接收和发送超时问题，以及非阻塞读取问题。 [#21429](https://github.com/ClickHouse/ClickHouse/pull/21429) ([Kruglov Pavel](https://github.com/Avogar)).
* `force_drop_table` 标志对 `MATERIALIZED VIEW` 不生效，此问题已修复。修复了 [#18943](https://github.com/ClickHouse/ClickHouse/issues/18943)。[#20626](https://github.com/ClickHouse/ClickHouse/pull/20626) ([tavplubix](https://github.com/tavplubix))。
* 修复 `PredicateRewriteVisitor` 中的名称冲突。该问题会在全连接后导致 `WHERE` 过滤结果错误。关闭 [#20497](https://github.com/ClickHouse/ClickHouse/issues/20497)。[#20622](https://github.com/ClickHouse/ClickHouse/pull/20622) ([Vladimir](https://github.com/vdimir)).

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 为 ClickHouse Keeper 新增 [Jepsen](https://github.com/jepsen-io/jepsen) 测试。[#21677](https://github.com/ClickHouse/ClickHouse/pull/21677) ([alesapin](https://github.com/alesapin)) 。
* 在 CI 中并行运行无状态测试。依赖 [#22181](https://github.com/ClickHouse/ClickHouse/issues/22181)。[#22300](https://github.com/ClickHouse/ClickHouse/pull/22300) ([alesapin](https://github.com/alesapin)) 。
* 为 [SQLancer](https://github.com/sqlancer/sqlancer) 的 CI 运行启用状态检查。[#22015](https://github.com/ClickHouse/ClickHouse/pull/22015) ([Ilya Yatsishin](https://github.com/qoega)) 。
* 为 PowerPC 构建做了多项准备：在 `ppc64le` 上启用内置的 openldap。[#22487](https://github.com/ClickHouse/ClickHouse/pull/22487) ([Kfir Itzhak](https://github.com/mastertheknife)) 。支持在 `ppc64le` 上使用 Clang 编译。[#22476](https://github.com/ClickHouse/ClickHouse/pull/22476) ([Kfir Itzhak](https://github.com/mastertheknife)) 。修复在 `ppc64le` 上编译 boost 的问题。[#22474](https://github.com/ClickHouse/ClickHouse/pull/22474) ([Kfir Itzhak](https://github.com/mastertheknife)) 。修复 `ppc64le` 上因内部 CMake 变量 `CMAKE_ASM_COMPILE_OBJECT` 未设置而导致的 CMake 错误。[#22469](https://github.com/ClickHouse/ClickHouse/pull/22469) ([Kfir Itzhak](https://github.com/mastertheknife)) 。修复 Fedora/RHEL/CentOS 在 `ppc64le` 上找不到 `libclang_rt.builtins` 的问题。[#22458](https://github.com/ClickHouse/ClickHouse/pull/22458) ([Kfir Itzhak](https://github.com/mastertheknife)) 。支持在 `ppc64le` 上使用 `jemalloc` 构建。[#22447](https://github.com/ClickHouse/ClickHouse/pull/22447) ([Kfir Itzhak](https://github.com/mastertheknife)) 。修复 ClickHouse 配置嵌入以及 cctz 时区嵌入在 `ppc64le` 上的问题。[#22445](https://github.com/ClickHouse/ClickHouse/pull/22445) ([Kfir Itzhak](https://github.com/mastertheknife)) 。修复 `ppc64le` 上的编译问题，并使用正确的指令指针寄存器。[#22430](https://github.com/ClickHouse/ClickHouse/pull/22430) ([Kfir Itzhak](https://github.com/mastertheknife)) 。
* 重新为 `aarch64` 启用 S3 (AWS) 库。[#22484](https://github.com/ClickHouse/ClickHouse/pull/22484) ([Kfir Itzhak](https://github.com/mastertheknife)) 。
* 将 `tzdata` 添加到 Docker 容器中，因为读取 `ORC` 格式需要它。此更改修复了 [#14156](https://github.com/ClickHouse/ClickHouse/issues/14156)。[#22000](https://github.com/ClickHouse/ClickHouse/pull/22000) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 为 `clickhouse-server` 镜像的 Dockerfile 新增 2 个参数：`deb_location` 和 `single_binary_location`。[#21977](https://github.com/ClickHouse/ClickHouse/pull/21977) ([filimonov](https://github.com/filimonov)) 。
* 允许在使用 `clang-tidy` 时启用断言，从而将其用于发布构建。[#21914](https://github.com/ClickHouse/ClickHouse/pull/21914) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在 cmake 脚本中加入对 llvm-12 二进制文件名的搜索。通过隐式常量转换来抑制 clang 警告。更新 submodule 以使用 CMake 3.19 构建。抑制 `readpassphrase` 库中宏展开时的递归。将 clang 中已弃用的 `-fuse-ld` 改为 `--ld-path`。[#21597](https://github.com/ClickHouse/ClickHouse/pull/21597) ([Ilya Yatsishin](https://github.com/qoega)) 。
* 更新 `docker/test/testflows/runner/dockerd-entrypoint.sh` 以使用 Yandex dockerhub-proxy，因为 Docker Hub 启用了非常严格的速率限制 [#21551](https://github.com/ClickHouse/ClickHouse/pull/21551) ([vzakaznikov](https://github.com/vzakaznikov)).
* 修复 macOS 共享库的构建问题。[#20184](https://github.com/ClickHouse/ClickHouse/pull/20184) ([nvartolomei](https://github.com/nvartolomei)) 。
* 为 `zookeeper-dump-tree` 新增 `ctime` 选项。该选项可转储节点创建时间。[#21842](https://github.com/ClickHouse/ClickHouse/pull/21842) ([Ilya](https://github.com/HumanUser)).

<div id="clickhouse-release-213-lts">
  ## ClickHouse 21.3 版本发布 (LTS)
</div>

<div id="clickhouse-release-v213-2021-03-12">
  ### ClickHouse 发布 v21.3，2021-03-12
</div>

<div id="backward-incompatible-change">
  #### 向后不兼容变更
</div>

* 现在不再允许使用带有表生存时间 (TTL) 的旧语法创建 MergeTree 表，因为这种写法会被直接忽略。仍然可以 Attach 旧表。[#20282](https://github.com/ClickHouse/ClickHouse/pull/20282) ([alesapin](https://github.com/alesapin)).
* 现在，所有不区分大小写的函数名都会被重写为其规范形式。这是投影查询路由 (即将推出的功能) 所必需的。[#20174](https://github.com/ClickHouse/ClickHouse/pull/20174) ([Amos Bird](https://github.com/amosbird)).
* 修复了在 `TTL` 表达式为函数且与 `ORDER BY` 键相同的情况下创建 `TTL` 的问题。现在允许在带有 `GROUP BY` 的 `TTL` 中为主键列设置自定义聚合函数。不兼容变更：当 `TTL` 过期时，对于不在 `GROUP BY` 中且未显式设置的主键列，现在会应用 `any` 函数，而不是 `max`。此外，如果你将 `TTL` 与 `WHERE` 或 `GROUP BY` 一起使用，则在执行滚动更新时，可能会在 merge 过程中看到异常。[#15450](https://github.com/ClickHouse/ClickHouse/pull/15450) ([Anton Popov](https://github.com/CurtizJ)).

<div id="new-feature">
  #### 新功能
</div>

* 新增 File 表引擎设置：`engine_file_empty_if_not_exists` 和 `engine_file_truncate_on_insert`。[#20620](https://github.com/ClickHouse/ClickHouse/pull/20620) ([M0r64n](https://github.com/M0r64n))。
* 新增聚合函数 `deltaSum`，用于对连续行之间的差值求和。[#20057](https://github.com/ClickHouse/ClickHouse/pull/20057) ([Russ Frank](https://github.com/rf))。
* 在 `system.part_log` 表中新增 `event_time_microseconds` 列。[#20027](https://github.com/ClickHouse/ClickHouse/pull/20027) ([Bharat Nallan](https://github.com/bharatnc))。
* 新增 `timezoneOffset(datetime)` 函数，返回相对于 UTC 的秒级偏移量。此项变更关闭了 [#issue:19850](https://github.com/ClickHouse/ClickHouse/issues/19850)。[#19962](https://github.com/ClickHouse/ClickHouse/pull/19962) ([keenwolf](https://github.com/keen-wolf))。
* 新增设置 `insert_shard_id`，支持从分布式表向指定分片插入数据。[#19961](https://github.com/ClickHouse/ClickHouse/pull/19961) ([flynn](https://github.com/ucasFL))。
* 更新函数 `reinterpretAs` 以支持大整数。修复了 [#19691](https://github.com/ClickHouse/ClickHouse/issues/19691)。[#19858](https://github.com/ClickHouse/ClickHouse/pull/19858) ([Maksim Kita](https://github.com/kitaisreal))。
* S3 客户端新增对服务器端加密客户提供密钥 (`x-amz-server-side-encryption-customer-(key/md5)` 请求头) 的支持。参见[链接](https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html)。关闭了 [#19428](https://github.com/ClickHouse/ClickHouse/issues/19428)。[#19748](https://github.com/ClickHouse/ClickHouse/pull/19748) ([Vladimir Chebotarev](https://github.com/excitoon))。
* 为 `executable` 字典源新增 `implicit_key` 选项。如果记录到达顺序与输入键顺序一致，则可避免为每条记录都输出键。实现了 [#14527](https://github.com/ClickHouse/ClickHouse/issues/14527)。[#19677](https://github.com/ClickHouse/ClickHouse/pull/19677) ([Maksim Kita](https://github.com/kitaisreal))。
* 新增配额类型 `query_selects` 和 `query_inserts`。[#19603](https://github.com/ClickHouse/ClickHouse/pull/19603) ([JackyWoo](https://github.com/JackyWoo))。
* 新增函数 `extractTextFromHTML` [#19600](https://github.com/ClickHouse/ClickHouse/pull/19600) ([zlx19950903](https://github.com/zlx19950903)), ([alexey-milovidov](https://github.com/alexey-milovidov))。
* 使用 `MergeTree*` 引擎的表现在新增了两个用于查询并发控制的表级设置。设置 `max_concurrent_queries` 用于限制与该表相关的并发执行查询数量。设置 `min_marks_to_honor_max_concurrent_queries` 表示仅当查询至少读取这么多个标记时，才应用前一个设置。[#19544](https://github.com/ClickHouse/ClickHouse/pull/19544) ([Amos Bird](https://github.com/amosbird))。
* 新增 `file` 函数，可将 user\_files 目录中的文件读取为 String。它不同于 `file` table function。此项变更实现了 [#issue:18851](https://github.com/ClickHouse/ClickHouse/issues/18851)。[#19204](https://github.com/ClickHouse/ClickHouse/pull/19204) ([keenwolf](https://github.com/keen-wolf))。

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 新增 Experimental `Replicated` database engine。它会在多个主机之间复制 DDL 查询。[#16193](https://github.com/ClickHouse/ClickHouse/pull/16193) ([tavplubix](https://github.com/tavplubix))。
* 引入对窗口函数的 Experimental 支持，可通过 `allow_experimental_window_functions = 1` 启用。这是一项初步的、alpha 阶段的实现，不适合在生产环境中使用，并且会在未来版本中发生不向后兼容的变更。支持的功能列表请参阅[文档](https://github.com/ClickHouse/ClickHouse/blob/master/docs/sql-reference/window-functions/index.md#experimental-window-functions)。[#20337](https://github.com/ClickHouse/ClickHouse/pull/20337) ([Alexander Kuzmenkov](https://github.com/akuzm))。
* 新增了对 DiskS3 元数据文件进行备份/恢复的能力。[#18377](https://github.com/ClickHouse/ClickHouse/pull/18377) ([Pavel Kovalenko](https://github.com/Jokser))。

<div id="performance-improvement-8">
  #### 性能提升
</div>

* 远程查询的对冲请求。启用 `use_hedged_requests` 设置后 (默认关闭) ，允许针对同一查询与不同副本建立多个连接。如果与副本的现有连接未能在 `hedged_connection_timeout` 内建立，或者在 `receive_data_timeout` 内未收到数据，则会启用新连接。查询会使用第一个发送非空 Progress 数据包的连接 (如果启用了 `allow_changing_replica_until_first_data_packet`，则也可以是 Data 数据包) ；其他连接会被 Cancel。支持 `max_parallel_replicas > 1` 的查询。[#19291](https://github.com/ClickHouse/ClickHouse/pull/19291) ([Kruglov Pavel](https://github.com/Avogar))。这可以显著降低超大型集群中的尾部延迟。
* 当表配置了行级安全表达式时，新增了对 `PREWHERE` 的支持 (并启用了相应优化) 。[#19576](https://github.com/ClickHouse/ClickHouse/pull/19576) ([Denis Glazachev](https://github.com/traceon)) 。
* 设置 `distributed_aggregation_memory_efficient` 默认启用。它可降低内存占用，并提升分布式查询的性能。 [#20599](https://github.com/ClickHouse/ClickHouse/pull/20599) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 提升了对多个固定大小键执行 GROUP BY 时的性能。[#20472](https://github.com/ClickHouse/ClickHouse/pull/20472) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 通过更严格的别名处理提升聚合函数的性能。[#19946](https://github.com/ClickHouse/ClickHouse/pull/19946) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在极端情况下 (读取速度达到约 50 GB/秒时) ，通过简化管道，从而减少管道调度中的锁竞争，加快了从 `Memory` 表读取的速度。[#20468](https://github.com/ClickHouse/ClickHouse/pull/20468) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 对 HTTP 服务器进行了部分重构，以减少传入和传出数据的拷贝次数。通过 HTTP 插入长记录时，性能最高可提升 1.5 倍。[#19516](https://github.com/ClickHouse/ClickHouse/pull/19516) ([Ivan](https://github.com/abyss7)).
* 为 `Memory` 表添加 `compress` 设置。启用后，表占用的 RAM 会更少。在某些机器和数据集上，执行 SELECT 时也可能更快，但并非总是如此。此更改关闭了 [#20093](https://github.com/ClickHouse/ClickHouse/issues/20093)。注意：`Memory` 表有时会比 MergeTree 更慢，原因包括：(1) 缺少压缩 (2) 块大小固定 (3) 缺少索引和 prewhere... [#20168](https://github.com/ClickHouse/ClickHouse/pull/20168) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 聚合相关代码略有改进。[#20978](https://github.com/ClickHouse/ClickHouse/pull/20978) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 重新加入 `intDiv`/`modulo` 特化版本以提升性能。这修复了 [#21293](https://github.com/ClickHouse/ClickHouse/issues/21293)。该回归问题是在 [https://github.com/ClickHouse/ClickHouse/pull/18145](https://github.com/ClickHouse/ClickHouse/pull/18145) 中引入的。[#21307](https://github.com/ClickHouse/ClickHouse/pull/21307) ([Amos Bird](https://github.com/amosbird)) 。
* 如果插入目标是 Memory 表，在 INSERT SELECT 时不要过度合并块。在之前的版本中，INSERT SELECT 后会在 Memory 表中生成低效的数据表示。此修复关闭了 [#13052](https://github.com/ClickHouse/ClickHouse/issues/13052)。[#20169](https://github.com/ClickHouse/ClickHouse/pull/20169) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了至少一种 DataType 解析器可能出现指数级复杂度的情况 (由 fuzzer 发现) 。这解决了 [#20096](https://github.com/ClickHouse/ClickHouse/issues/20096)。[#20132](https://github.com/ClickHouse/ClickHouse/pull/20132) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 当 `do_not_merge_across_partitions_select_final` 设置为 1 时，可对 level > 0 的单个 part 上带 FINAL 的 SELECT 实现并行执行。[#19375](https://github.com/ClickHouse/ClickHouse/pull/19375) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 查询 `system.parts` 和 `system.parts_columns` 时，仅填充所请求的列。修复 [#19570](https://github.com/ClickHouse/ClickHouse/issues/19570)。[#21035](https://github.com/ClickHouse/ClickHouse/pull/21035) ([Anmol Arora](https://github.com/anmolarora)) 。
* 对 `avg` 聚合函数中的算术表达式进行代数优化。关闭 [#20092](https://github.com/ClickHouse/ClickHouse/issues/20092)。[#20183](https://github.com/ClickHouse/ClickHouse/pull/20183) ([flynn](https://github.com/ucasFL)).

<div id="improvement">
  #### 改进
</div>

* 表函数的压缩方法现已不区分大小写。还修复了以大写形式检查 LZMA 压缩方法的问题。[#21416](https://github.com/ClickHouse/ClickHouse/pull/21416) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 新增两个设置：当非活动 parts 过多时，可在插入期间延迟或报错。这在 server 无法足够快地清理 parts 时很有用。[#20178](https://github.com/ClickHouse/ClickHouse/pull/20178) ([Amos Bird](https://github.com/amosbird)).
* 提升了对 mysql 客户端的兼容性。1. mysql jdbc 2. mycli。[#21367](https://github.com/ClickHouse/ClickHouse/pull/21367) ([Amos Bird](https://github.com/amosbird)) 。
* 禁止删除被 materialized view 引用的列。见 [#21164](https://github.com/ClickHouse/ClickHouse/issues/21164)。[#21303](https://github.com/ClickHouse/ClickHouse/pull/21303) ([flynn](https://github.com/ucasFL)).
* MySQL 字典源现在会在发生意外连接失败时重试 (即“查询期间与 MySQL 服务器的连接丢失”) ，这种情况有时会出现在 SSL/TLS 连接中。[#21237](https://github.com/ClickHouse/ClickHouse/pull/21237) ([Alexander Kazakov](https://github.com/Akazz)) 。
* 易用性改进：`DateTime64` 的解析更加一致：现在可识别以缩放整数形式指定的带亚秒级分辨率的 Unix 时间戳 (例如 `1111111111222`，而不是 `1111111111.222`) 。这修复了 [#13194](https://github.com/ClickHouse/ClickHouse/issues/13194)。[#21053](https://github.com/ClickHouse/ClickHouse/pull/21053) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在启用 distributed\_group\_by\_no\_merge 时，仅在发起节点上合并已排序的块。[#20882](https://github.com/ClickHouse/ClickHouse/pull/20882) ([Azat Khuzhin](https://github.com/azat)) 。
* 在加载 mysql 源的配置时，ClickHouse 现在会对具有相同优先级的副本列表进行随机重排，以确保在选择 mysql 端点时能够正确执行轮询逻辑。此更改修复了 [#20629](https://github.com/ClickHouse/ClickHouse/issues/20629)。[#20632](https://github.com/ClickHouse/ClickHouse/pull/20632) ([Alexander Kazakov](https://github.com/Akazz)) 。
* 函数 'reinterpretAs(x, Type)' 已更名为 'reinterpret(x, Type)'。[#20611](https://github.com/ClickHouse/ClickHouse/pull/20611) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 支持 RabbitMQ 引擎中的 vhost [#20576](https://github.com/ClickHouse/ClickHouse/issues/20576)。[#20596](https://github.com/ClickHouse/ClickHouse/pull/20596) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 改进了由 Arrays 和 Tuples 组合而成的数据类型的序列化。改进了枚举数据类型与 protobuf 枚举类型的匹配。修复了 `Map` 数据类型的序列化。现在，省略的值会自动使用默认值。[#20506](https://github.com/ClickHouse/ClickHouse/pull/20506) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 已修复分布式 DDL 任务执行与 DDL 队列清理之间的竞争问题。现在，如果存在活跃的工作线程，则无法从 ZooKeeper 中移除 DDL 任务。修复了 [#20016](https://github.com/ClickHouse/ClickHouse/issues/20016)。[#20448](https://github.com/ClickHouse/ClickHouse/pull/20448) ([tavplubix](https://github.com/tavplubix)) 。
* 让 FQDN 和其他与 DNS 相关的函数在 Alpine 镜像中正常工作。[#20336](https://github.com/ClickHouse/ClickHouse/pull/20336) ([filimonov](https://github.com/filimonov)) 。
* 不要对明确禁止的函数进行提前常量折叠。[#20303](https://github.com/ClickHouse/ClickHouse/pull/20303) ([Azat Khuzhin](https://github.com/azat)) 。
* 如果整数值超出 Decimal 类型的表示范围，从整数到 Decimal 类型的隐式转换此前仍可能成功。现在会抛出 `ARGUMENT_OUT_OF_BOUND`。[#20232](https://github.com/ClickHouse/ClickHouse/pull/20232) ([tavplubix](https://github.com/tavplubix)) 。
* 无锁的 `SYSTEM FLUSH DISTRIBUTED`。[#20215](https://github.com/ClickHouse/ClickHouse/pull/20215) ([Azat Khuzhin](https://github.com/azat)) 。
* 将 `count(constant)` 和 `sum(1)` 规范化为 `count()`。这是投影查询路由所必需的。[#20175](https://github.com/ClickHouse/ClickHouse/pull/20175) ([Amos Bird](https://github.com/amosbird)) 。
* bitmap 函数现已支持所有原生整数类型。[#20171](https://github.com/ClickHouse/ClickHouse/pull/20171) ([Amos Bird](https://github.com/amosbird)) 。
* 已更新 `CacheDictionary`、`ComplexCacheDictionary`、`SSDCacheDictionary` 和 `SSDComplexKeyDictionary`，改用 LRUHashMap 作为底层索引。[#20164](https://github.com/ClickHouse/ClickHouse/pull/20164) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 现在可在启动时通过提供 `CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT` 来配置 `access_management` 设置，默认值为禁用 (`0`) ，这也是此前的默认值。[#20139](https://github.com/ClickHouse/ClickHouse/pull/20139) ([Marquitos](https://github.com/sonirico)) 。
* 修复用于 DateTime64 的 `toDateTime64(toDate()/toDateTime())` —— 为 DateTime64 实现钳位，以匹配 DateTime 的行为。[#20131](https://github.com/ClickHouse/ClickHouse/pull/20131) ([Azat Khuzhin](https://github.com/azat)) 。
* 配额改进：SHOW TABLES 现在在配额计算中按一次查询计算，而不是两次。SYSTEM 查询现在也会消耗配额。修复了配额消耗中时间间隔结束时间的计算问题。[#20106](https://github.com/ClickHouse/ClickHouse/pull/20106) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 支持 `system.zookeeper` 表中的 `path IN (set)` 表达式。[#20105](https://github.com/ClickHouse/ClickHouse/pull/20105) ([小路](https://github.com/nicelulu)).
* 在 `system.tables` 中显示 `MaterializeMySQL` 表的完整信息。[#20051](https://github.com/ClickHouse/ClickHouse/pull/20051) ([Stig Bakken](https://github.com/stigsb)) 。
* 修复了 `executable` 字典中仅在误用情况下才可能出现的数据竞争问题 (即脚本忽略输入并返回数据时) 。[#20045](https://github.com/ClickHouse/ClickHouse/pull/20045) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 现在，可以通过 mysql 副本的 config 部分中的 "opt\_reconnect" 参数控制 MYSQL\_OPT\_RECONNECT 选项的值。[#19998](https://github.com/ClickHouse/ClickHouse/pull/19998) ([Alexander Kazakov](https://github.com/Akazz)) 。
* 如果用户调用 `JSONExtract` 函数并请求 `Float32` 类型，则允许不精确转换为结果类型。例如，JSON 中的数字 `0.1` 是双精度值，无法用 Float32 精确表示，但用户仍然希望获取它。此前的版本对于非 `Nullable` 类型返回 0，对于 `Nullable` 类型返回 NULL，以表明转换并不精确。这一逻辑在理论上完全正确，但会让用户感到意外，并引发疑问。此更改关闭了 [#13962](https://github.com/ClickHouse/ClickHouse/issues/13962)。[#19960](https://github.com/ClickHouse/ClickHouse/pull/19960) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 如果向分布式表执行 INSERT 时块结构不匹配，则增加块结构转换。[#19947](https://github.com/ClickHouse/ClickHouse/pull/19947) ([Azat Khuzhin](https://github.com/azat)) 。
* 改进 `system.distributed_ddl_queue` 表：重启后将 MaxDDLEntryID 初始化为上一次的值。在此 PR 之前，MaxDDLEntryID 会一直为零，直到处理新的 DDLTask。[#19924](https://github.com/ClickHouse/ClickHouse/pull/19924) ([Amos Bird](https://github.com/amosbird)) 。
* 在 `system.parts` 中显示 `MaterializeMySQL` 的表。[#19770](https://github.com/ClickHouse/ClickHouse/pull/19770) ([Stig Bakken](https://github.com/stigsb)) 。
* 为 `Buffer` profile 新增单独的配置指令。[#19721](https://github.com/ClickHouse/ClickHouse/pull/19721) ([Azat Khuzhin](https://github.com/azat)) 。
* 将与 JOIN 无关的条件移至 WHERE 子句。[#18720](https://github.com/ClickHouse/ClickHouse/issues/18720)。[#19685](https://github.com/ClickHouse/ClickHouse/pull/19685) ([hexiaoting](https://github.com/hexiaoting)) 。
* 新增了按异步发送待处理字节数对向 Distributed 的 INSERT 进行限流的能力 (已为 `Distributed` 引擎添加 `bytes_to_delay_insert`/`max_delay_to_insert` 和 `bytes_to_throw_insert` 设置) 。[#19673](https://github.com/ClickHouse/ClickHouse/pull/19673) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了析构函数中极少数情况下会忽略写入错误的问题。[#19451](https://github.com/ClickHouse/ClickHouse/pull/19451) ([Azat Khuzhin](https://github.com/azat)).
* 在致命错误的堆栈跟踪中显示内联帧。[#19317](https://github.com/ClickHouse/ClickHouse/pull/19317) ([Ivan](https://github.com/abyss7)) 。

<div id="bug-fixes">
  #### 问题修复
</div>

* 修复了到 ZooKeeper 的冗余重连问题，以及单个 ClickHouse server 出现两个活动 session 的可能性。这两个问题均在 #14678 中引入。[#21264](https://github.com/ClickHouse/ClickHouse/pull/21264) ([alesapin](https://github.com/alesapin)).
* 修复了从 `Values` 格式向包含 `LowCardinality` 列的表插入数据时出现的错误：`Bad cast from type ... to DB::ColumnLowCardinality`。修复 #21140 [#21357](https://github.com/ClickHouse/ClickHouse/pull/21357) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了在非复制的 MergeTree 表引擎中，当谓词中包含表自身时，`ALTER DELETE` 变更发生死锁的问题。修复了 [#20558](https://github.com/ClickHouse/ClickHouse/issues/20558)。[#21477](https://github.com/ClickHouse/ClickHouse/pull/21477) ([alesapin](https://github.com/alesapin)) 。
* 修复了分布式查询在故障发生时触发 SIGSEGV 的问题。[#21434](https://github.com/ClickHouse/ClickHouse/pull/21434) ([Azat Khuzhin](https://github.com/azat)).
* 现在，`ALTER MODIFY COLUMN` 查询将能够正确应用于分区键、跳过索引、生存时间 (TTL) 等的更改。修复了 [#13675](https://github.com/ClickHouse/ClickHouse/issues/13675)。[#21334](https://github.com/ClickHouse/ClickHouse/pull/21334) ([alesapin](https://github.com/alesapin)) 。
* 修复了 `join_use_nulls` 的问题，以及连接子查询中的 `TOTALS` 时的缺陷。此修复关闭了 [#19362](https://github.com/ClickHouse/ClickHouse/issues/19362) 和 [#21137](https://github.com/ClickHouse/ClickHouse/issues/21137)。[#21248](https://github.com/ClickHouse/ClickHouse/pull/21248) ([vdimir](https://github.com/vdimir)) 。
* 修复了带有 `UNION` 的查询在 `EXPLAIN` 中崩溃的问题。修复 [#20876](https://github.com/ClickHouse/ClickHouse/issues/20876)、[#21170](https://github.com/ClickHouse/ClickHouse/issues/21170)。[#21246](https://github.com/ClickHouse/ClickHouse/pull/21246) ([flynn](https://github.com/ucasFL)).
* 现在，只有支持变更操作的表引擎才允许执行变更操作 (MergeTree 家族、Memory、MaterializedView) 。其他引擎将报出更明确的错误。修复了 [#21168](https://github.com/ClickHouse/ClickHouse/issues/21168)。[#21183](https://github.com/ClickHouse/ClickHouse/pull/21183) ([alesapin](https://github.com/alesapin)) 。
* 修复了 [#21112](https://github.com/ClickHouse/ClickHouse/issues/21112)。修复了一个缺陷：如果某个回调函数稍晚到达，可能会导致插入查询出现重复数据。[#21138](https://github.com/ClickHouse/ClickHouse/pull/21138) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复了在类型为 Nullable 时，`input_format_null_as_default` 不生效的问题。此修复解决了 [#21116](https://github.com/ClickHouse/ClickHouse/issues/21116)。[#21121](https://github.com/ClickHouse/ClickHouse/pull/21121) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了将 Tuple 转换为 Map 时的相关错误。关闭 [#21029](https://github.com/ClickHouse/ClickHouse/issues/21029)。[#21120](https://github.com/ClickHouse/ClickHouse/pull/21120) ([hexiaoting](https://github.com/hexiaoting)) 。
* 修复删除使用自定义 (非默认) ZooKeeper 集群的 Replicated\*MergeTree 时发生的元数据泄漏问题。[#21119](https://github.com/ClickHouse/ClickHouse/pull/21119) ([fastio](https://github.com/fastio)).
* 修复了在 `joinGet` 中使用 LowCardinality 键时出现的类型不匹配问题。该修复解决了 [#21114](https://github.com/ClickHouse/ClickHouse/issues/21114)。[#21117](https://github.com/ClickHouse/ClickHouse/pull/21117) ([Amos Bird](https://github.com/amosbird)).
* 修复了这样一个问题：当 Replicated(\*)MergeTree engine 需要指定其他参数时，default\_replica\_path 和 default\_replica\_name 的值不会生效。[#21060](https://github.com/ClickHouse/ClickHouse/pull/21060) ([mxzlxy](https://github.com/mxzlxy)) 。
* 在对特意构造的 `DateTime64` 类型越界值进行格式化时，可能发生越界内存访问。此修复关闭了 [#20494](https://github.com/ClickHouse/ClickHouse/issues/20494)。此修复关闭了 [#20543](https://github.com/ClickHouse/ClickHouse/issues/20543)。[#21023](https://github.com/ClickHouse/ClickHouse/pull/21023) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 阻止对 storage join 的并行插入。[#21009](https://github.com/ClickHouse/ClickHouse/pull/21009) ([vdimir](https://github.com/vdimir)).
* 修复了 `ALTER MODIFY COLUMN` 会创建明知会失败的变更这一问题。[#21007](https://github.com/ClickHouse/ClickHouse/pull/21007) ([Anton Popov](https://github.com/CurtizJ)) 。
* 关闭了 [#9969](https://github.com/ClickHouse/ClickHouse/issues/9969)。修复了 Brotli HTTP 压缩错误；该问题会在数据量较大、结构稍复杂且使用 JSON 输出格式时复现。将 Brotli 更新到最新版本，以纳入“修复罕见访问 ring-buffer 中未初始化数据”的修复。[#20991](https://github.com/ClickHouse/ClickHouse/pull/20991) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 修复查询取消时出现的“异步任务队列返回了空任务”问题。[#20881](https://github.com/ClickHouse/ClickHouse/pull/20881) ([Azat Khuzhin](https://github.com/azat)) 。
* 使用 MySQL 5.7 客户端连接到 ClickHouse server 时，`USE database;` 查询无法正常执行，现已修复。修复了 [#18926](https://github.com/ClickHouse/ClickHouse/issues/18926)。[#20878](https://github.com/ClickHouse/ClickHouse/pull/20878) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了聚合函数中 `-Distinct` 组合器与 `-State` 组合器同时使用时的问题。[#20866](https://github.com/ClickHouse/ClickHouse/pull/20866) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复带有 UNION DISTINCT 和 LIMIT 子句的子查询问题。关闭 [#20597](https://github.com/ClickHouse/ClickHouse/issues/20597)。[#20610](https://github.com/ClickHouse/ClickHouse/pull/20610) ([flynn](https://github.com/ucasFL)).
* 修复了在查询中查找字典中不存在的键时，字典行为不一致的问题。[#20578](https://github.com/ClickHouse/ClickHouse/pull/20578) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复了标量子查询和索引子查询的线程数问题 (在 [#19007](https://github.com/ClickHouse/ClickHouse/issues/19007) 之后一直都会使用单线程) 。修复了 [#20457](https://github.com/ClickHouse/ClickHouse/issues/20457)、[#20512](https://github.com/ClickHouse/ClickHouse/issues/20512)。[#20550](https://github.com/ClickHouse/ClickHouse/pull/20550) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了一个可能导致崩溃的问题：如果从 remove 查询接收到未知数据包，就可能发生崩溃 (该问题在 [#17868](https://github.com/ClickHouse/ClickHouse/issues/17868) 中引入) 。[#20547](https://github.com/ClickHouse/ClickHouse/pull/20547) ([Azat Khuzhin](https://github.com/azat)) 。
* 在解析用于 async INSERT 的目录名时增加了适当的检查 (修复 SIGSEGV) 。[#20498](https://github.com/ClickHouse/ClickHouse/pull/20498) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复函数 `transform` 无法正确处理浮点键的问题。关闭 [#20460](https://github.com/ClickHouse/ClickHouse/issues/20460)。[#20479](https://github.com/ClickHouse/ClickHouse/pull/20479) ([flynn](https://github.com/ucasFL)) 。
* 修复了在将 WITH 别名传递到子查询时出现的无限循环问题。此修复对应于 [#20388](https://github.com/ClickHouse/ClickHouse/issues/20388)。[#20476](https://github.com/ClickHouse/ClickHouse/pull/20476) ([Amos Bird](https://github.com/amosbird)) 。
* 修复当 http 客户端断开连接时 server 异常退出的问题。[#20464](https://github.com/ClickHouse/ClickHouse/pull/20464) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在 JOIN 包含来自 SELECT 的常量时，`join_use_nulls=1` 导致的 `LOGICAL_ERROR`。[#20461](https://github.com/ClickHouse/ClickHouse/pull/20461) ([Azat Khuzhin](https://github.com/azat)) 。
* 检查表达式列表中是否使用了表函数 `view`，并在使用时报错。此修复了 [#20342](https://github.com/ClickHouse/ClickHouse/issues/20342)。[#20350](https://github.com/ClickHouse/ClickHouse/pull/20350) ([Amos Bird](https://github.com/amosbird)).
* 避免在 RANGE\_HASHED() 字典中进行无效解引用。[#20345](https://github.com/ClickHouse/ClickHouse/pull/20345) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在 `join_use_nulls=1` 时发生的空指针解引用问题。[#20344](https://github.com/ClickHouse/ClickHouse/pull/20344) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复两个标度不同的常量 decimal 进行二元运算时结果错误的问题。修复了 [#20283](https://github.com/ClickHouse/ClickHouse/issues/20283)。[#20339](https://github.com/ClickHouse/ClickHouse/pull/20339) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了 `ReplicatedMergeTree` 表引擎家族中失败的后台任务重试过于频繁的问题。这可能导致日志过于冗长并增加 CPU 负载。修复了 [#20203](https://github.com/ClickHouse/ClickHouse/issues/20203)。[#20335](https://github.com/ClickHouse/ClickHouse/pull/20335) ([alesapin](https://github.com/alesapin)).
* 将 `*CollapsingMergeTree` 和 `ReplacingMergeTree` 表引擎中的版本列操作限制为只能使用 `DROP` 或 `RENAME`。[#20300](https://github.com/ClickHouse/ClickHouse/pull/20300) ([alesapin](https://github.com/alesapin)).
* 修复了这样一种情况：当 JSON 已损坏时，我们会尝试将整个文件读入内存，从而导致 allocator 抛出异常。修复了 [#19719](https://github.com/ClickHouse/ClickHouse/issues/19719)。[#20286](https://github.com/ClickHouse/ClickHouse/pull/20286) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复了在不允许执行纵向合并的 `MergeTree` 表引擎家族中进行纵向合并时触发的异常。修复 [#20259](https://github.com/ClickHouse/ClickHouse/issues/20259)。[#20279](https://github.com/ClickHouse/ClickHouse/pull/20279) ([alesapin](https://github.com/alesapin)) 。
* 修复了在关闭过程中重新加载配置时极少发生的服务器崩溃问题。修复 [#19689](https://github.com/ClickHouse/ClickHouse/issues/19689)。[#20224](https://github.com/ClickHouse/ClickHouse/pull/20224) ([alesapin](https://github.com/alesapin)).
* 修复了在 INSERT SELECT 中使用 CTE 时出现的问题。此项修复解决了 [#20187](https://github.com/ClickHouse/ClickHouse/issues/20187) 和 [#20195](https://github.com/ClickHouse/ClickHouse/issues/20195)。[#20211](https://github.com/ClickHouse/ClickHouse/pull/20211) ([Amos Bird](https://github.com/amosbird)).
* 修复 [#19314](https://github.com/ClickHouse/ClickHouse/issues/19314)。[#20156](https://github.com/ClickHouse/ClickHouse/pull/20156) ([Ivan](https://github.com/abyss7)) 。
* 修复 `toMinute` 函数，使其能够正确处理特殊时区。[#20149](https://github.com/ClickHouse/ClickHouse/pull/20149) ([keenwolf](https://github.com/keen-wolf)) 。
* 修复了在查询中使用 `if` 函数时，若 then/else 分支的结果为 `Tuple` 类型而导致服务器崩溃的问题。`Tuple` 类型必须包含 `Array` 或其他复杂类型。修复了 [#18356](https://github.com/ClickHouse/ClickHouse/issues/18356)。[#20133](https://github.com/ClickHouse/ClickHouse/pull/20133) ([alesapin](https://github.com/alesapin)).
* `MongoDB` 表引擎现在仅会在需要读取数据时建立连接。`ATTACH TABLE` 也不再尝试连接。[#20110](https://github.com/ClickHouse/ClickHouse/pull/20110) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了 StorageJoin 中的缺陷。[#20079](https://github.com/ClickHouse/ClickHouse/pull/20079) ([vdimir](https://github.com/vdimir)) 。
* 修复了这样一种情况：在计算负数除以较小除数的余数时，结果数据类型不够大，无法容纳负值结果。此修复关闭了 [#20052](https://github.com/ClickHouse/ClickHouse/issues/20052)。[#20067](https://github.com/ClickHouse/ClickHouse/pull/20067) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* MaterializeMySQL：修复了涉及更新多个表的语句的复制问题。[#20066](https://github.com/ClickHouse/ClickHouse/pull/20066) ([Håvard Kvålen](https://github.com/havardk)) 。
* 防止在 Docker 中执行初始化脚本期间出现 "连接被拒绝"。 [#20012](https://github.com/ClickHouse/ClickHouse/pull/20012) ([filimonov](https://github.com/filimonov)).
* `EmbeddedRocksDB` 是一种 Experimental 存储。修复了类型检查不完善的问题。简化了代码。此项修复关闭了 [#19967](https://github.com/ClickHouse/ClickHouse/issues/19967)。[#19972](https://github.com/ClickHouse/ClickHouse/pull/19972) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了函数 `fromModifiedJulianDay` 在参数类型为 `Nullable(T)` 且参数为除 Int32 之外的任意整数类型时发生段错误的问题。[#19959](https://github.com/ClickHouse/ClickHouse/pull/19959) ([PHO](https://github.com/depressed-pho)).
* 修复 BloomFilter 索引导致的崩溃问题。修复了 [#19757](https://github.com/ClickHouse/ClickHouse/issues/19757)。[#19884](https://github.com/ClickHouse/ClickHouse/pull/19884) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 如果启用了 system.text\_log，则可能会发生死锁。此问题已在 [#19874](https://github.com/ClickHouse/ClickHouse/issues/19874) 中修复。[#19875](https://github.com/ClickHouse/ClickHouse/pull/19875) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了服务器在启动时因表的默认表达式中包含 `dictGet()` 而出现的问题。现在无需加载字典即可获取 `dictGet()` 的返回类型。[#19805](https://github.com/ClickHouse/ClickHouse/pull/19805) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复 `clickhouse-client` 在仅执行 `select` 时发生中止异常的问题。[#19790](https://github.com/ClickHouse/ClickHouse/pull/19790) ([taiyang-li](https://github.com/taiyang-li)) 。
* 修复了一个 bug：在同时启动多个 clickhouse-copier 时，将数据片移动到目标端表可能会失败。[#19743](https://github.com/ClickHouse/ClickHouse/pull/19743) ([madianjun](https://github.com/mdianjun)).
* 执行 `ON CLUSTER` 查询的后台线程可能会在等待已删除的复制表执行操作时卡住。此问题已修复。[#19684](https://github.com/ClickHouse/ClickHouse/pull/19684) ([yiguolei](https://github.com/yiguolei)) 。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 允许全局启用 AVX-2 来构建 ClickHouse。这会在现代 CPU 上带来小幅性能提升。目前不建议用于生产环境，暂时也不会作为官方构建提供支持。[#20180](https://github.com/ClickHouse/ClickHouse/pull/20180) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了 Coverity 发现的一些问题。参见 [#19964](https://github.com/ClickHouse/ClickHouse/issues/19964)。[#20010](https://github.com/ClickHouse/ClickHouse/pull/20010) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 现在允许在 gdb 下使用修改过的二进制文件启动。在之前的版本中，如果在启动前先在 gdb 中设置断点，server 会因完整性检查失败而拒绝启动。[#21258](https://github.com/ClickHouse/ClickHouse/pull/21258) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 为 Kafka 中不同的压缩方法新增了测试。[#21111](https://github.com/ClickHouse/ClickHouse/pull/21111) ([filimonov](https://github.com/filimonov)).
* 修复了 test\_storage\_kerberized\_hdfs 测试中的端口冲突问题。[#19974](https://github.com/ClickHouse/ClickHouse/pull/19974) ([Ilya Yatsishin](https://github.com/qoega)).
* 在集成测试中，当 docker 启动失败时，会将 `stdout` 和 `stderr` 打印到日志中。在此 PR 之前，这种情况下只有一条非常简短的错误消息，不利于排查问题。[#20631](https://github.com/ClickHouse/ClickHouse/pull/20631) ([Vitaly Baranov](https://github.com/vitlibar)).

<div id="clickhouse-release-212">
  ## ClickHouse 发行版 21.2
</div>

<div id="clickhouse-release-v21228-stable-2021-02-07">
  ### ClickHouse 发行版 v21.2.2.8-稳定版本，2021-02-07
</div>

<div id="backward-incompatible-change-9">
  #### 不兼容变更
</div>

* 位运算函数 (`bitAnd`、`bitOr` 等) 已禁止用于浮点参数。现在必须显式转换为整数。 [#19853](https://github.com/ClickHouse/ClickHouse/pull/19853) ([Azat Khuzhin](https://github.com/azat)).
* 禁止将 `lcm`/`gcd` 用于浮点数。 [#19532](https://github.com/ClickHouse/ClickHouse/pull/19532) ([Azat Khuzhin](https://github.com/azat)).
* 修复了 `OPTIMIZE TABLE`/合并操作的内存跟踪；`OPTIMIZE TABLE`/合并操作现会计入查询内存限制并应用采样。 [#18772](https://github.com/ClickHouse/ClickHouse/pull/18772) ([Azat Khuzhin](https://github.com/azat)).
* 不允许将浮点列用作分区键，参见 [#18421](https://github.com/ClickHouse/ClickHouse/issues/18421#event-4147046255)。 [#18464](https://github.com/ClickHouse/ClickHouse/pull/18464) ([hexiaoting](https://github.com/hexiaoting)).
* 不再支持类型定义中过多的括号，例如：`Array((UInt8))`。

<div id="new-feature-3">
  #### 新特性
</div>

* 新增了 `PostgreSQL` 表引擎 (支持 select/insert 以及多维数组) ，并可作为表函数使用。新增了 `PostgreSQL` 字典源。新增了 `PostgreSQL` 数据库引擎。[#18554](https://github.com/ClickHouse/ClickHouse/pull/18554) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 数据类型 `Nested` 现在支持任意层级的嵌套。引入了复杂类型的子列，例如 `Array` 中的 `size0`、`Nullable` 中的 `null` 以及 `Tuple` 元素名称，这些子列可在不读取整个列的情况下直接读取。[#17310](https://github.com/ClickHouse/ClickHouse/pull/17310) ([Anton Popov](https://github.com/CurtizJ)) 。
* 为 `FlatDictionary`、`HashedDictionary`、`ComplexKeyHashedDictionary`、`DirectDictionary`、`ComplexKeyDirectDictionary` 和 `RangeHashedDictionary` 新增了 `Nullable` 支持。[#18236](https://github.com/ClickHouse/ClickHouse/pull/18236) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增一个名为 `system.distributed_ddl_queue` 的表，用于显示 DDL 工作线程队列中的查询语句。[#17656](https://github.com/ClickHouse/ClickHouse/pull/17656) ([Bharat Nallan](https://github.com/bharatnc)) 。
* 新增支持将 LDAP 组名以及属性值等映射为本地 roles，供来自 ldap 用户目录的用户使用。[#17211](https://github.com/ClickHouse/ClickHouse/pull/17211) ([Denis Glazachev](https://github.com/traceon)) 。
* 支持向表函数 `cluster` 插入数据，并且表函数 `remote` 和 `cluster` 支持通过指定分片键将数据分发到各个节点。关闭 [#16752](https://github.com/ClickHouse/ClickHouse/issues/16752)。[#18264](https://github.com/ClickHouse/ClickHouse/pull/18264) ([flynn](https://github.com/ucasFL)) 。
* 新增函数 `decodeXMLComponent`，用于解码 XML 字符。示例：`SELECT decodeXMLComponent('Hello,&quot;world&quot;!')` [#17659](https://github.com/ClickHouse/ClickHouse/issues/17659)。[#18542](https://github.com/ClickHouse/ClickHouse/pull/18542) ([nauta](https://github.com/nautaa)) 。
* 新增函数 `parseDateTimeBestEffortUSOrZero` 和 `parseDateTimeBestEffortUSOrNull`。[#19712](https://github.com/ClickHouse/ClickHouse/pull/19712) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增 `sign` 数学函数。[#19527](https://github.com/ClickHouse/ClickHouse/pull/19527) ([flynn](https://github.com/ucasFL)) 。
* 将已使用的特性 (函数、表引擎等) 信息添加到 system.query\_log 中。[#18495](https://github.com/ClickHouse/ClickHouse/issues/18495)。[#19371](https://github.com/ClickHouse/ClickHouse/pull/19371) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 函数 `formatDateTime` 现已支持 `%Q` 修饰符，可将日期格式化为季度。[#19224](https://github.com/ClickHouse/ClickHouse/pull/19224) ([Jianmei Zhang](https://github.com/zhangjmruc)).
* 支持在 play UI 中将 MetaKey+Enter 绑定为快捷键。[#19012](https://github.com/ClickHouse/ClickHouse/pull/19012) ([sundyli](https://github.com/sundy-li)).
* 为 map 数据类型新增了三个函数：1. `mapContains(map, key)`，用于检查 map.keys 是否包含第二个参数 key。2. `mapKeys(map)`，以 Array 格式返回所有键。3. `mapValues(map)`，以 Array 格式返回所有值。[#18788](https://github.com/ClickHouse/ClickHouse/pull/18788) ([hexiaoting](https://github.com/hexiaoting)) 。
* 新增与 [#18494](https://github.com/ClickHouse/ClickHouse/issues/18494) 相关的 `log_comment` 设置。[#18549](https://github.com/ClickHouse/ClickHouse/pull/18549) ([Zijie Lu](https://github.com/TszKitLo40)) 。
* 为 `argMin` 和 `argMax` 函数新增了对 Tuple 类型参数的支持。[#17359](https://github.com/ClickHouse/ClickHouse/pull/17359) ([Ildus Kurbangaliev](https://github.com/ildus)) 。
* 新增对 `EXISTS VIEW` 语法的支持。[#18552](https://github.com/ClickHouse/ClickHouse/pull/18552) ([Du Chuan](https://github.com/spongedu)) 。
* 添加 `SELECT ALL` 语法。解决 [#18706](https://github.com/ClickHouse/ClickHouse/issues/18706)。[#18723](https://github.com/ClickHouse/ClickHouse/pull/18723) ([flynn](https://github.com/ucasFL)) 。

<div id="performance-improvement">
  #### 性能改进
</div>

* 通过减少 `stat` 系统调用次数，加快了 parts 的删除速度。这恢复了之前一度存在的优化。`IDisk` 的接口也更加安全。此更改关闭了 [#19065](https://github.com/ClickHouse/ClickHouse/issues/19065)。[#19086](https://github.com/ClickHouse/ClickHouse/pull/19086) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 在 `WITH` 语句中声明的别名现在会被正确用于索引分析。像 `WITH column AS alias SELECT ... WHERE alias = ...` 这样的查询现在可以使用索引。[#18896](https://github.com/ClickHouse/ClickHouse/pull/18896) ([Amos Bird](https://github.com/amosbird)).
* 新增 `optimize_alias_column_prediction` (默认开启) ，其作用包括：- 在进行分区裁剪和使用二级索引跳过数据时，识别 WHERE 中的别名列；- 在 `optimize_trivial_count` 的简单 count 查询中，识别 WHERE 中的别名列；- 在 `optimize_aggregation_in_order`/`optimize_read_in_order` 的 GROUP BY/ORDER BY 中，识别别名列。[#16995](https://github.com/ClickHouse/ClickHouse/pull/16995) ([sundyli](https://github.com/sundy-li)).
* 提升了聚合函数 `sum` 的速度。该改进仅在合成基准测试中可见，实际意义不大。[#19216](https://github.com/ClickHouse/ClickHouse/pull/19216) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 更新 libc++ 并使用另一种 ABI，以获得更好的性能。[#18914](https://github.com/ClickHouse/ClickHouse/pull/18914) ([Danila Kutenin](https://github.com/danlark1)).
* 在逻辑等价时，将 `sumIf()` 和 `sum(if())` 函数重写为 `countIf()` 函数。[#17041](https://github.com/ClickHouse/ClickHouse/pull/17041) ([flynn](https://github.com/ucasFL)).
* 为 S3 连接使用连接池，由 `s3_max_connections` 设置控制。[#13405](https://github.com/ClickHouse/ClickHouse/pull/13405) ([Vladimir Chebotarev](https://github.com/excitoon)).
* 新增对 zstd long 选项的支持，以更好地压缩字符串列并节省空间。[#17184](https://github.com/ClickHouse/ClickHouse/pull/17184) ([ygrek](https://github.com/ygrek)).
* 取消了每次建立连接时都访问配置的操作，从而略微降低了服务端延迟。[#19863](https://github.com/ClickHouse/ClickHouse/pull/19863) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 减少了 `Buffer` engine 多层 layer 的锁竞争。[#19379](https://github.com/ClickHouse/ClickHouse/pull/19379) ([Azat Khuzhin](https://github.com/azat)).
* 支持将查询计划中的 `Filter` step 拆分为 `Expression + Filter` 对。结合 `Expression + Expression` 合并优化 ([#17458](https://github.com/ClickHouse/ClickHouse/issues/17458)) ，这可能会将某些表达式的执行延后到 `Filter` step 之后。[#19253](https://github.com/ClickHouse/ClickHouse/pull/19253) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).

<div id="improvement">
  #### 改进
</div>

* 即使从 `table` 中只能选择任意一列，现在也可以执行 `SELECT count() FROM table`。此 PR 修复了 [#10639](https://github.com/ClickHouse/ClickHouse/issues/10639)。[#18233](https://github.com/ClickHouse/ClickHouse/pull/18233) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 与远程 MySQL 服务器交互时，将字符集设为 `utf8mb4`。修复了 [#19795](https://github.com/ClickHouse/ClickHouse/issues/19795)。[#19800](https://github.com/ClickHouse/ClickHouse/pull/19800) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* `S3` 表函数现已支持 `auto` 压缩模式 (自动检测) 。此项改进解决了 [#18754](https://github.com/ClickHouse/ClickHouse/issues/18754)。[#19793](https://github.com/ClickHouse/ClickHouse/pull/19793) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 正确输出 `formatReadableTimeDelta` 函数的无穷大参数。在之前的版本中，它会被隐式转换为特定于实现的整数值。[#19791](https://github.com/ClickHouse/ClickHouse/pull/19791) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 如果无法准确确定区域，表函数 `S3` 将使用全局区域。这修复了 [#10998](https://github.com/ClickHouse/ClickHouse/issues/10998)。[#19750](https://github.com/ClickHouse/ClickHouse/pull/19750) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 在 distributed queries 中，如果启用了设置 `async_socket_for_remote`，那么当表中使用嵌套层级非常深的数据类型时 (例如 `Array(Array(Array(...more...)))`) ，至少在调试构建配置下可能会发生栈溢出。此项修复了 [#19108](https://github.com/ClickHouse/ClickHouse/issues/19108)。此次变更引入了轻微的向后不兼容：类型定义中不再支持多余的括号，例如：`Array((UInt8))`。[#19736](https://github.com/ClickHouse/ClickHouse/pull/19736) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 为消息代理 (RabbitMQ 和 Kafka) 新增独立的连接池。[#19722](https://github.com/ClickHouse/ClickHouse/pull/19722) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复非复制表 MergeTree 中罕见的 `max_number_of_merges_with_ttl_in_pool` 限制被突破的问题 (可分配更多带 TTL 的合并任务) 。[#19708](https://github.com/ClickHouse/ClickHouse/pull/19708) ([alesapin](https://github.com/alesapin)).
* 字典：改进了属性解析期间的错误信息。[#19678](https://github.com/ClickHouse/ClickHouse/pull/19678) ([Maksim Kita](https://github.com/kitaisreal)).
* 新增一个选项，可在读取时禁用校验和校验。绝不应在生产环境中使用。请不要指望禁用它会带来任何收益。它只能用于实验和基准测试。该设置仅适用于 MergeTree 家族的表。对于其他表引擎，以及通过网络接收数据时，始终都会校验校验和。根据我的观察，性能没有差异，或者差异不到 0.5%。[#19588](https://github.com/ClickHouse/ClickHouse/pull/19588) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 支持在函数 `multiIf` 中使用常量结果。[#19533](https://github.com/ClickHouse/ClickHouse/pull/19533) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 Map 数据类型启用函数 length/empty/notEmpty，返回 Map 中键的个数。[#19530](https://github.com/ClickHouse/ClickHouse/pull/19530) ([taiyang-li](https://github.com/taiyang-li)) 。
* 为 `clickhouse-benchmark` 新增 `--reconnect` 选项。指定该选项后，会在每次请求前重新建立连接。这是测试所必需的。 [#19872](https://github.com/ClickHouse/ClickHouse/pull/19872) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 支持使用 `.debug` 文件的新路径。此更改修复了 [#19348](https://github.com/ClickHouse/ClickHouse/issues/19348)。[#19520](https://github.com/ClickHouse/ClickHouse/pull/19520) ([Amos Bird](https://github.com/amosbird)).
* `toIPv6` 函数支持解析 `IPv4` 地址。[#19518](https://github.com/ClickHouse/ClickHouse/pull/19518) ([Bharat Nallan](https://github.com/bharatnc)) 。
* 为 `system.query_log`、`system.processes` 等添加 `http_referer` 字段。此更改关闭了 [#19389](https://github.com/ClickHouse/ClickHouse/issues/19389)。[#19390](https://github.com/ClickHouse/ClickHouse/pull/19390) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 通过让更多函数支持大小写不敏感并添加别名，增强了与 MySQL 的兼容性。[#19387](https://github.com/ClickHouse/ClickHouse/pull/19387) ([Daniil Kondratyev](https://github.com/dankondr)) 。
* 为 MergeTree parts (Wide/Compact/InMemory) 类型新增指标。[#19381](https://github.com/ClickHouse/ClickHouse/pull/19381) ([Azat Khuzhin](https://github.com/azat)) 。
* 允许 docker 以任意 uid 运行。[#19374](https://github.com/ClickHouse/ClickHouse/pull/19374) ([filimonov](https://github.com/filimonov)) 。
* 修复了 Pretty 格式中 `IPv4` 数据类型的值对齐不正确的问题。此前这些值是右对齐，而不是左对齐。此修复关闭了 [#19184](https://github.com/ClickHouse/ClickHouse/issues/19184)。[#19339](https://github.com/ClickHouse/ClickHouse/pull/19339) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 允许在无需重启的情况下修改 `max_server_memory_usage`。此更改关闭了 [#18154](https://github.com/ClickHouse/ClickHouse/issues/18154)。[#19186](https://github.com/ClickHouse/ClickHouse/pull/19186) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在早期版本中，使用某些 NaN 参数调用函数 `bar` 时抛出的异常信息可能会有些误导。此项修复了 [#19088](https://github.com/ClickHouse/ClickHouse/issues/19088)。[#19107](https://github.com/ClickHouse/ClickHouse/pull/19107) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在 clickhouse-server 镜像中，明确将 clickhouse 用户和组的 uid / gid 设为固定值 (101)。[#19096](https://github.com/ClickHouse/ClickHouse/pull/19096) ([filimonov](https://github.com/filimonov)).
* 修复了插入包含超长字符串的数据时出现的 `PeekableReadBuffer: Memory limit exceed` 错误。修复了 [#18690](https://github.com/ClickHouse/ClickHouse/issues/18690)。[#18979](https://github.com/ClickHouse/ClickHouse/pull/18979) ([tavplubix](https://github.com/tavplubix)).
* Docker 镜像：对 clickhouse-server 的入口脚本进行了多项改进。[#18954](https://github.com/ClickHouse/ClickHouse/pull/18954) ([filimonov](https://github.com/filimonov)).
* 添加 `normalizeQueryKeepNames` 和 `normalizedQueryHashKeepNames`，可在归一化查询时不使用 `?` 屏蔽长名称。这有助于更好地分析复杂的查询日志。[#18910](https://github.com/ClickHouse/ClickHouse/pull/18910) ([Amos Bird](https://github.com/amosbird)) 。
* 在发送前于发送端检查分布式批次的逐块校验和 (无需将文件读取两遍，校验和会在读取时验证) ，这可以避免接收端的 INSERT 卡住 (例如发送端存在被截断的 .bin 文件时) 。避免在批次 INSERT 时将 .bin 文件读取两遍 (此前为了在计算行数/字节数时将 squashing 考虑在内，必须这样做；现在这些信息已包含在请求头中，同时保留了向后兼容性) 。[#18853](https://github.com/ClickHouse/ClickHouse/pull/18853) ([Azat Khuzhin](https://github.com/azat)).
* 修复了对包含聚合函数状态的表执行 RIGHT 和 FULL JOIN 时出现的问题。在之前的版本中，会抛出与 `cloneResized` 方法相关的异常。[#18818](https://github.com/ClickHouse/ClickHouse/pull/18818) ([templarzq](https://github.com/templarzq)).
* 新增了支持按前缀配置的 S3 端点设置。[#18812](https://github.com/ClickHouse/ClickHouse/pull/18812) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 为 bitmapTransform、bitmapSubsetInRange、bitmapSubsetLimit 和 bitmapContains 函数新增对 \[UInt8, UInt16, UInt32, UInt64] 参数类型的支持。此更改关闭了 [#18713](https://github.com/ClickHouse/ClickHouse/issues/18713)。[#18791](https://github.com/ClickHouse/ClickHouse/pull/18791) ([sundyli](https://github.com/sundy-li)) 。
* 允许进一步为 CTE (公共表表达式) 设置别名。当 `enable_global_with_statement = 1` 时，会将 CSE (公共子表达式消除) 传播到同一级别的子查询中。此更改修复了 [#17378](https://github.com/ClickHouse/ClickHouse/issues/17378)。此更改还修复了 [https://github.com/ClickHouse/ClickHouse/pull/16575#issuecomment-753416235。](https://github.com/ClickHouse/ClickHouse/pull/16575#issuecomment-753416235。) [#18684](https://github.com/ClickHouse/ClickHouse/pull/18684) ([Amos Bird](https://github.com/amosbird)) 。
* 将 librdkafka 升级到 v1.6.0-RC2。修复了 [#18668](https://github.com/ClickHouse/ClickHouse/issues/18668)。[#18671](https://github.com/ClickHouse/ClickHouse/pull/18671) ([filimonov](https://github.com/filimonov)) 。
* 发生意外异常时，会自动重启负责执行分布式 DDL 查询的后台线程。修复了 [#17991](https://github.com/ClickHouse/ClickHouse/issues/17991)。[#18285](https://github.com/ClickHouse/ClickHouse/pull/18285) ([徐炘](https://github.com/weeds085490)) 。
* 更新了 AWS C++ SDK，以支持在 S3 中使用全局区域。[#17870](https://github.com/ClickHouse/ClickHouse/pull/17870) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 新增支持在创建 `LIVE VIEW` 表时使用 `WITH ... [AND] [PERIODIC] REFRESH [interval_in_sec]` 子句。[#14822](https://github.com/ClickHouse/ClickHouse/pull/14822) ([vzakaznikov](https://github.com/vzakaznikov)) 。
* 限制对使用旧语法创建的 `MergeTree` 表执行 `MODIFY TTL` 查询。此前该查询会执行成功，但实际上不会生效。[#19064](https://github.com/ClickHouse/ClickHouse/pull/19064) ([Anton Popov](https://github.com/CurtizJ)).

<div id="bug-fixes">
  #### 问题修复
</div>

* 修复了带有常量参数的二元函数在索引分析中的问题，该问题会导致查询结果错误。此修复对应于 [#18364](https://github.com/ClickHouse/ClickHouse/issues/18364)。[#18373](https://github.com/ClickHouse/ClickHouse/pull/18373) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了在表的默认表达式中包含 `dictGet()` 时服务器启动失败的问题。现在可在不加载字典的情况下获取 `dictGet()` 的返回类型。[#19805](https://github.com/ClickHouse/ClickHouse/pull/19805) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复了在查询中使用 `if` 函数时，若 then/else 分支的结果为 `Tuple` 类型会导致服务器崩溃的问题。`Tuple` 类型必须包含 `Array` 或其他复杂类型。修复了 [#18356](https://github.com/ClickHouse/ClickHouse/issues/18356)。[#20133](https://github.com/ClickHouse/ClickHouse/pull/20133) ([alesapin](https://github.com/alesapin)).
* `MaterializeMySQL` (Experimental 功能) ：修复了更新多个表的语句的复制问题。[#20066](https://github.com/ClickHouse/ClickHouse/pull/20066) ([Håvard Kvålen](https://github.com/havardk)).
* 防止在执行初始化脚本期间，docker 中出现 "Connection refused" 错误。 [#20012](https://github.com/ClickHouse/ClickHouse/pull/20012) ([filimonov](https://github.com/filimonov)).
* `EmbeddedRocksDB` 是一种 Experimental 存储。修复了类型检查不完善的问题。简化了代码。此更改关闭了 [#19967](https://github.com/ClickHouse/ClickHouse/issues/19967)。[#19972](https://github.com/ClickHouse/ClickHouse/pull/19972) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了函数 `fromModifiedJulianDay` 的一个段错误：当参数类型为 `Nullable(T)`，且 `T` 为除 Int32 之外的任意整数类型时，会触发该错误。[#19959](https://github.com/ClickHouse/ClickHouse/pull/19959) ([PHO](https://github.com/depressed-pho)).
* 函数 `greatCircleAngle` 在先前版本中返回的结果不准确。此修复关闭了 [#19769](https://github.com/ClickHouse/ClickHouse/issues/19769)。[#19789](https://github.com/ClickHouse/ClickHouse/pull/19789) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了一个罕见问题：数据损坏后，某些 replicated 操作 (如变更) 可能无法处理某些 parts。修复了 [#19593](https://github.com/ClickHouse/ClickHouse/issues/19593)。[#19702](https://github.com/ClickHouse/ClickHouse/pull/19702) ([alesapin](https://github.com/alesapin)) 。
* 执行 `ON CLUSTER` 查询的后台线程可能会在等待已删除的复制表完成某些操作时卡住。现已修复。[#19684](https://github.com/ClickHouse/ClickHouse/pull/19684) ([yiguolei](https://github.com/yiguolei)).
* 修复了列描述反序列化错误的问题。该问题会导致无法向包含名为 `\` 的列的表中执行 INSERT。[#19479](https://github.com/ClickHouse/ClickHouse/pull/19479) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 如果某个文件中出现空数据块，则将分布式批次标记为损坏。[#19449](https://github.com/ClickHouse/ClickHouse/pull/19449) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了一个极少见的 bug：在 `DROP/DETACH/REPLACE/MOVE PARTITION` 之后，可能导致变更卡住。此前 [#15537](https://github.com/ClickHouse/ClickHouse/issues/15537) 已在大多数情况下部分修复了该问题。[#19443](https://github.com/ClickHouse/ClickHouse/pull/19443) ([tavplubix](https://github.com/tavplubix)) 。
* 修复可能出现的 `Extremes transform was already added to pipeline` 错误。修复 [#14100](https://github.com/ClickHouse/ClickHouse/issues/14100)。[#19430](https://github.com/ClickHouse/ClickHouse/pull/19430) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了具有非零默认值的 JOIN 类型中的默认值问题 (例如某些枚举) 。关闭 [#18197](https://github.com/ClickHouse/ClickHouse/issues/18197)。[#19360](https://github.com/ClickHouse/ClickHouse/pull/19360) ([vdimir](https://github.com/vdimir)) 。
* EOF 时，不要将用于分布式发送的标记文件标记为损坏。[#19290](https://github.com/ClickHouse/ClickHouse/pull/19290) ([Azat Khuzhin](https://github.com/azat)).
* 修复了 `async_socket_for_remote` 中管道文件描述符 (fd) 泄漏的问题。[#19153](https://github.com/ClickHouse/ClickHouse/pull/19153) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了读取 `ORC` 格式文件时无限读取的问题 (该问题是在 [#10580](https://github.com/ClickHouse/ClickHouse/issues/10580) 中引入的) 。修复 [#19095](https://github.com/ClickHouse/ClickHouse/issues/19095)。[#19134](https://github.com/ClickHouse/ClickHouse/pull/19134) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 MergeTree 数据写入器中的一个问题，该问题可能导致标记大小超过固定粒度大小。修复 [#18913](https://github.com/ClickHouse/ClickHouse/issues/18913)。[#19123](https://github.com/ClickHouse/ClickHouse/pull/19123) ([alesapin](https://github.com/alesapin)).
* 修复了一个启动时的错误：当 ClickHouse 无法从 `LowCardinality(Nullable(...))` 中读取压缩 codec 时，会抛出 `Attempt to read after EOF` 异常。修复 [#18340](https://github.com/ClickHouse/ClickHouse/issues/18340)。[#19101](https://github.com/ClickHouse/ClickHouse/pull/19101) ([alesapin](https://github.com/alesapin)).
* 简化了 `tupleHammingDistance` 的实现。支持任意长度相同的元组。修复了 [#19029](https://github.com/ClickHouse/ClickHouse/issues/19029)。[#19084](https://github.com/ClickHouse/ClickHouse/pull/19084) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 确保 `groupUniqArray` 对 `Enum` 类型的参数返回正确的类型。此问题已在 [#17875](https://github.com/ClickHouse/ClickHouse/issues/17875) 中修复。[#19019](https://github.com/ClickHouse/ClickHouse/pull/19019) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了在使用带有 `LowCardinality` 参数的函数 `ignore` 时，可能出现的错误 `Expected single dictionary argument for function`。修复了 [#14275](https://github.com/ClickHouse/ClickHouse/issues/14275)。[#19016](https://github.com/ClickHouse/ClickHouse/pull/19016) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了向使用 `TinyLog` 引擎的表中插入 `LowCardinality` 列时的问题。修复 [#18629](https://github.com/ClickHouse/ClickHouse/issues/18629)。[#19010](https://github.com/ClickHouse/ClickHouse/pull/19010) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 JOIN 中的一个小问题：Join 会尝试物化 const 列，但我们的代码在其他地方才会等待这些列。[#18982](https://github.com/ClickHouse/ClickHouse/pull/18982) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 禁用 `optimize_move_functions_out_of_any`，因为该优化并非总是正确。这修复了 [#18051](https://github.com/ClickHouse/ClickHouse/issues/18051) 和 [#18973](https://github.com/ClickHouse/ClickHouse/issues/18973)。[#18981](https://github.com/ClickHouse/ClickHouse/pull/18981) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了因合并查询计划中的 `Expression` 步骤而可能导致的异常 `QueryPipeline stream: different number of columns`。修复 [#18190](https://github.com/ClickHouse/ClickHouse/issues/18190)。[#18980](https://github.com/ClickHouse/ClickHouse/pull/18980) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了一个在关闭时极少出现的死锁问题。[#18977](https://github.com/ClickHouse/ClickHouse/pull/18977) ([tavplubix](https://github.com/tavplubix)).
* 修复了 server 内存耗尽时出现的偶发崩溃问题。[#18976](https://github.com/ClickHouse/ClickHouse/pull/18976) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了 `ALTER TABLE ... DROP PART 'part_name'` 查询在删除某个分片时错误地移除整个分区所有去重块的问题。修复了 [#18874](https://github.com/ClickHouse/ClickHouse/issues/18874)。[#18969](https://github.com/ClickHouse/ClickHouse/pull/18969) ([alesapin](https://github.com/alesapin)) 。
* 修复了问题 [#18894](https://github.com/ClickHouse/ClickHouse/issues/18894)：新增一项检查，避免在长列别名 (`table.column` 风格，通常由 Looker 等 BI 工具自动生成) 与长表名相同时抛出异常。[#18968](https://github.com/ClickHouse/ClickHouse/pull/18968) ([Daniel Qin](https://github.com/mathfool)).
* 修复错误 `Task was not found in task queue` (仅会在 `async_socket_for_remote = 1` 的远程查询中出现) 。[#18964](https://github.com/ClickHouse/ClickHouse/pull/18964) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了包含某些转义文本 (如 `ALTER ... UPDATE e = CAST('foo', 'Enum8(\'foo\' = 1')`) 的变更被错误序列化的问题。修复 [#18878](https://github.com/ClickHouse/ClickHouse/issues/18878)。[#18944](https://github.com/ClickHouse/ClickHouse/pull/18944) ([alesapin](https://github.com/alesapin)) 。
* ATTACH PARTITION 会重置变更。 [#18804](https://github.com/ClickHouse/ClickHouse/issues/18804)。 [#18935](https://github.com/ClickHouse/ClickHouse/pull/18935) ([fastio](https://github.com/fastio)) 。
* 修复了 `bitmapOrCardinality` 中可能导致空指针解引用的问题。该修复关闭了 [#18911](https://github.com/ClickHouse/ClickHouse/issues/18911)。[#18912](https://github.com/ClickHouse/ClickHouse/pull/18912) ([sundyli](https://github.com/sundy-li)) 。
* 修复了在尝试将 `NULL` 从 `Nullable(String)` CAST 为 `Nullable(Decimal(P, S))` 时出现的 `Attempt to read after eof` 错误。现在，当无法从可空字符串中解析出十进制数时，函数 `CAST` 会返回 `NULL`。修复了 [#7690](https://github.com/ClickHouse/ClickHouse/issues/7690)。[#18718](https://github.com/ClickHouse/ClickHouse/pull/18718) ([Winter Zhang](https://github.com/zhang2014)).
* 修复 MySQL 引擎中的数据类型转换问题。[#18124](https://github.com/ClickHouse/ClickHouse/pull/18124) ([bo zeng](https://github.com/mis98zb)) 。
* 修复 clickhouse-client 在仅执行 `select` 时出现中止异常的问题。[#19790](https://github.com/ClickHouse/ClickHouse/pull/19790) ([taiyang-li](https://github.com/taiyang-li)).

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 在 CI 中运行 [SQLancer](https://twitter.com/RiggerManuel/status/1352345625480884228) (逻辑 SQL 模糊测试器) 。[#19006](https://github.com/ClickHouse/ClickHouse/pull/19006) ([Ilya Yatsishin](https://github.com/qoega)) 。
* Query Fuzzer 将更广泛地对新增测试进行模糊测试。此项关闭了 [#18916](https://github.com/ClickHouse/ClickHouse/issues/18916)。[#19185](https://github.com/ClickHouse/ClickHouse/pull/19185) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 集成 [Big List of Naughty Strings](https://github.com/minimaxir/big-list-of-naughty-strings/)，以改进模糊测试。[#19480](https://github.com/ClickHouse/ClickHouse/pull/19480) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 添加了使用 MSan 运行的集成测试。[#18974](https://github.com/ClickHouse/ClickHouse/pull/18974) ([alesapin](https://github.com/alesapin)) 。
* 修复了 cyrus-sasl 和 musl 中的 MemorySanitizer 错误。[#19821](https://github.com/ClickHouse/ClickHouse/pull/19821) ([Ilya Yatsishin](https://github.com/qoega)) 。
* `positionCaseInsensitiveUTF8` 函数中对参数不足的检查触发了 AddressSanitizer。[#19720](https://github.com/ClickHouse/ClickHouse/pull/19720) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在集成测试中移除了 docker-compose 的 --project-directory。修复了来自 Docker 容器的日志格式。[#19706](https://github.com/ClickHouse/ClickHouse/pull/19706) ([Ilya Yatsishin](https://github.com/qoega)) 。
* 简化了集成测试中 macros.xml 的生成。不再出现 dicttoxml 产生的大量日志。dicttoxml 项目已超过 5 年未活跃。[#19697](https://github.com/ClickHouse/ClickHouse/pull/19697) ([Ilya Yatsishin](https://github.com/qoega)) 。
* 允许通过环境变量 `CLICKHOUSE_WATCHDOG_ENABLE` 显式启用或禁用 watchdog。默认情况下，如果 server 未连接到终端，则会启用它。[#19522](https://github.com/ClickHouse/ClickHouse/pull/19522) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 允许在 arm64 上构建支持 Kafka 的 ClickHouse。[#19369](https://github.com/ClickHouse/ClickHouse/pull/19369) ([filimonov](https://github.com/filimonov)) 。
* 允许在不使用 ssl 的情况下构建 librdkafka。[#19337](https://github.com/ClickHouse/ClickHouse/pull/19337) ([filimonov](https://github.com/filimonov)) 。
* 在 FreeBSD 构建中恢复了 Kafka 输入。[#18924](https://github.com/ClickHouse/ClickHouse/pull/18924) ([Alexandre Snarskii](https://github.com/snar)) 。
* 修复了表函数 `VALUES` 中潜在的空指针解引用问题。[#19357](https://github.com/ClickHouse/ClickHouse/pull/19357) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 避免了 `arrayElement` 函数、`substring` 和 `arraySum` 中的 UBSan 报告。修复了 [#19305](https://github.com/ClickHouse/ClickHouse/issues/19305)。修复了 [#19287](https://github.com/ClickHouse/ClickHouse/issues/19287)。此项关闭了 [#19336](https://github.com/ClickHouse/ClickHouse/issues/19336)。[#19347](https://github.com/ClickHouse/ClickHouse/pull/19347) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。

<div id="clickhouse-release-211">
  ## ClickHouse 发行版 21.1
</div>

<div id="clickhouse-release-v211332-stable-2021-02-03">
  ### ClickHouse 发行版 v21.1.3.32-稳定版本，2021-02-03
</div>

<div id="bug-fixes">
  #### 问题修复
</div>

* 修复 BloomFilter 索引导致的崩溃问题。修复了 [#19757](https://github.com/ClickHouse/ClickHouse/issues/19757)。[#19884](https://github.com/ClickHouse/ClickHouse/pull/19884) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复将谓词下推到 union distinct 子查询时导致的崩溃。此修复解决了 [#19855](https://github.com/ClickHouse/ClickHouse/issues/19855)。[#19861](https://github.com/ClickHouse/ClickHouse/pull/19861) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了对大于 127 的 UInt8 值进行过滤时出现的问题。[#19799](https://github.com/ClickHouse/ClickHouse/pull/19799) ([Anton Popov](https://github.com/CurtizJ)) 。
* 在早期版本中，函数 `arrayEnumerateUniq` 遇到异常参数时可能会导致崩溃或陷入无限循环。此修复关闭了 [#19787](https://github.com/ClickHouse/ClickHouse/issues/19787)。[#19788](https://github.com/ClickHouse/ClickHouse/pull/19788) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了对算术类型与 String 类型进行精确比较时发生的栈溢出问题。[#19773](https://github.com/ClickHouse/ClickHouse/pull/19773) ([tavplubix](https://github.com/tavplubix)) 。
* 修复在 `WHERE` 或 `PREWHERE` 中使用嵌套列名时导致的崩溃。修复了 [#19755](https://github.com/ClickHouse/ClickHouse/issues/19755)。[#19763](https://github.com/ClickHouse/ClickHouse/pull/19763) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 `bitmapAndnot` 函数中的段错误。已修复 [#19668](https://github.com/ClickHouse/ClickHouse/issues/19668)。[#19713](https://github.com/ClickHouse/ClickHouse/pull/19713) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 某些涉及大整数的函数可能会导致段错误。Big integers 属于 Experimental 功能。此问题已关闭 [#19667](https://github.com/ClickHouse/ClickHouse/issues/19667)。[#19672](https://github.com/ClickHouse/ClickHouse/pull/19672) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了 `neighbor` 函数在 `LowCardinality` 参数上返回错误结果的问题。修复 [#10333](https://github.com/ClickHouse/ClickHouse/issues/10333)。[#19617](https://github.com/ClickHouse/ClickHouse/pull/19617) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 Connection 在断开连接后 CompressedWriteBuffer 被释放后仍被使用的问题。[#19599](https://github.com/ClickHouse/ClickHouse/pull/19599) ([Azat Khuzhin](https://github.com/azat)) 。
* `DROP/DETACH TABLE table ON CLUSTER cluster SYNC` 查询可能会卡住，现已修复。修复了 [#19568](https://github.com/ClickHouse/ClickHouse/issues/19568)。[#19572](https://github.com/ClickHouse/ClickHouse/pull/19572) ([tavplubix](https://github.com/tavplubix)).
* 修复了 CREATE DICTIONARY 查询中 id 表达式的问题。[#19571](https://github.com/ClickHouse/ClickHouse/pull/19571) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 修复了 merge\_tree\_min\_rows\_for\_concurrent\_read/merge\_tree\_min\_bytes\_for\_concurrent\_read=0/UINT64\_MAX 时发生的 SIGSEGV 问题。[#19528](https://github.com/ClickHouse/ClickHouse/pull/19528) ([Azat Khuzhin](https://github.com/azat)) 。
* 如果使用精心构造的参数调用 `addMonth` 函数，可能会发生缓冲区溢出 (读取内存时) 。此修复解决了 [#19441](https://github.com/ClickHouse/ClickHouse/issues/19441)。此修复解决了 [#19413](https://github.com/ClickHouse/ClickHouse/issues/19413)。[#19472](https://github.com/ClickHouse/ClickHouse/pull/19472) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 如果将空字符串作为 IV 传入，encrypt/decrypt 函数中就可能发生未初始化内存读取。此修复关闭了 [#19391](https://github.com/ClickHouse/ClickHouse/issues/19391)。[#19397](https://github.com/ClickHouse/ClickHouse/pull/19397) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复 Uber H3 库中可能存在的缓冲区溢出问题。参见 [https://github.com/uber/h3/issues/392。此项修复解决了](https://github.com/uber/h3/issues/392。此项修复解决了) [#19219](https://github.com/ClickHouse/ClickHouse/issues/19219)。[#19383](https://github.com/ClickHouse/ClickHouse/pull/19383) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了 system.parts \_state 列的问题 (由于顺序错误，查询此列时会报 LOGICAL\_ERROR) 。[#19346](https://github.com/ClickHouse/ClickHouse/pull/19346) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在聚合时，当 materialized view 与其目标表结构不同时，可能导致结果错误或发生 segfault 的问题。修复 [#18063](https://github.com/ClickHouse/ClickHouse/issues/18063)。[#19322](https://github.com/ClickHouse/ClickHouse/pull/19322) ([tavplubix](https://github.com/tavplubix)).
* 修复错误 `Cannot convert column now64() because it is constant but values of constants are different in source and result`。这是对 [#7156](https://github.com/ClickHouse/ClickHouse/issues/7156) 的后续修复。[#19316](https://github.com/ClickHouse/ClickHouse/pull/19316) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了一个错误：并发执行 `ALTER` 和 `DROP` 查询时，处理 ReplicatedMergeTree 表可能会发生挂起。[#19237](https://github.com/ClickHouse/ClickHouse/pull/19237) ([alesapin](https://github.com/alesapin)) 。
* 修复了通过 `HTTP interface` 使用 `Template` 或 `CustomSeparated` format 插入数据时出现的 `There is no checkpoint` error。修复 [#19021](https://github.com/ClickHouse/ClickHouse/issues/19021)。[#19072](https://github.com/ClickHouse/ClickHouse/pull/19072) ([tavplubix](https://github.com/tavplubix)).
* 在分析阶段，当结果无法计算时，禁用对子查询进行常量折叠。 [#18446](https://github.com/ClickHouse/ClickHouse/pull/18446) ([Azat Khuzhin](https://github.com/azat)).
* 变更在 `MOVE` 或 `REPLACE PARTITION` 之后，或者在极少数情况下在 `DETACH` 或 `DROP PARTITION` 之后，可能会因等待某个不存在的分片而卡住。该问题已修复。 [#15537](https://github.com/ClickHouse/ClickHouse/pull/15537) ([tavplubix](https://github.com/tavplubix)).

<div id="clickhouse-release-v211215-stable-2021-01-18">
  ### ClickHouse 发行版 v21.1.2.15-稳定版本 2021-01-18
</div>

<div id="backward-incompatible-change-10">
  #### 向后不兼容的更改
</div>

* 设置 `input_format_null_as_default` 现已默认启用。[#17525](https://github.com/ClickHouse/ClickHouse/pull/17525) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 现在会检查配置中 profile 设置的 settings 约束。如果 users.xml 包含不满足相应约束的设置，server 将无法启动。[#18486](https://github.com/ClickHouse/ClickHouse/pull/18486) ([tavplubix](https://github.com/tavplubix)) 。
* 限制 `ALTER MODIFY SETTING` 修改会影响数据分区片段的存储设置 (`write_final_mark` 和 `enable_mixed_granularity_parts`) 。[#18306](https://github.com/ClickHouse/ClickHouse/pull/18306) ([Amos Bird](https://github.com/amosbird)) 。
* 默认将 `insert_quorum_parallel` 设为 1。与“sequential” quorum 插入相比，这样用起来方便得多。但如果你依赖 sequential consistency，则应将该设置改回 0。[#17567](https://github.com/ClickHouse/ClickHouse/pull/17567) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 移除了 `sumburConsistentHash` 函数。此更改关闭了 [#18120](https://github.com/ClickHouse/ClickHouse/issues/18120)。[#18656](https://github.com/ClickHouse/ClickHouse/pull/18656) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 移除了 aggregate functions `timeSeriesGroupSum` 和 `timeSeriesGroupRateSum`，因为我的一位朋友说它们从来就没正常工作过。这修复了 [#16869](https://github.com/ClickHouse/ClickHouse/issues/16869)。如果你碰巧成功用过这些函数，请发送邮件至 [feedback@clickhouse.com](mailto:feedback@clickhouse.com)。[#17423](https://github.com/ClickHouse/ClickHouse/pull/17423) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 禁止使用 `toUnixTimestamp(Date())` (此前它只是返回 Date 的 UInt16 表示) 。[#17376](https://github.com/ClickHouse/ClickHouse/pull/17376) ([Azat Khuzhin](https://github.com/azat)) 。
* 允许在 `avg` 和 `avgWeighted` 函数中使用扩展整数类型 (`Int128`、`Int256`、`UInt256`) 。还允许在 `avgWeighted` 函数中为 value 和 weight 使用不同类型 (整数、decimal、浮点数) 。这是一个向后不兼容的更改：现在 `avg` 和 `avgWeighted` 函数始终返回 `Float64` (与文档一致) 。在此更改之前，`Decimal` 参数的返回类型也会是 `Decimal`。[#15419](https://github.com/ClickHouse/ClickHouse/pull/15419) ([Mike](https://github.com/myrrc)) 。
* 表达式 `toUUID(N)` 不再可用。请改用 `toUUID('00000000-0000-0000-0000-000000000000')`。进行此更改的原因是，当 N 非零时，`toUUID(N)` 的结果并不直观。
* 现在会拒绝 “key usage” 不正确的 SSL 证书。在之前的版本中，这类证书是可以使用的。参见 [#19262](https://github.com/ClickHouse/ClickHouse/issues/19262)。
* 默认配置中已移除对替换文件 (`/etc/metrika.xml`) 的 `incl` 引用 (`<remote_servers>`、`<zookeeper>`、`<macros>`、`<compression>`、`<networks>`) 。如果你此前使用了替换文件，并依赖这些隐式引用，则应在更新前通过添加带有 `incl="..."` 属性的相应部分，手动显式将它们加回。参见 [#18740](https://github.com/ClickHouse/ClickHouse/pull/18740) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。

<div id="new-feature-3">
  #### 新特性
</div>

* 在 ClickHouse 中支持 gRPC 协议。[#15111](https://github.com/ClickHouse/ClickHouse/pull/15111) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 支持使用多个 ZooKeeper 集群。 [#17070](https://github.com/ClickHouse/ClickHouse/pull/17070) ([fastio](https://github.com/fastio)).
* 已支持 `REPLACE TABLE` 和 `CREATE OR REPLACE TABLE` 语句。[#18521](https://github.com/ClickHouse/ClickHouse/pull/18521) ([tavplubix](https://github.com/tavplubix)) 。
* 实现 `UNION DISTINCT`，并默认将普通 `UNION` 子句按 `UNION DISTINCT` 处理。新增设置 `union_default_mode`，可将其按 `UNION ALL` 处理，或要求显式指定模式。[#16338](https://github.com/ClickHouse/ClickHouse/pull/16338) ([flynn](https://github.com/ucasFL)).
* 新增 `accurateCastOrNull` 函数。已关闭 [#10290](https://github.com/ClickHouse/ClickHouse/issues/10290)。在 `x IN (subquery)` 表达式中添加了类型转换。已关闭 [#10266](https://github.com/ClickHouse/ClickHouse/issues/10266)。[#16724](https://github.com/ClickHouse/ClickHouse/pull/16724) ([Maksim Kita](https://github.com/kitaisreal))。
* IP 字典可直接支持 `IPv4` / `IPv6` 类型。[#17571](https://github.com/ClickHouse/ClickHouse/pull/17571) ([vdimir](https://github.com/vdimir)).
* IP 字典支持按键获取。已解决 [#18241](https://github.com/ClickHouse/ClickHouse/issues/18241)。[#18480](https://github.com/ClickHouse/ClickHouse/pull/18480) ([vdimir](https://github.com/vdimir)).
* 新增了对数据导入和导出的 `*.zst` 压缩/解压缩支持。这样即可在 `file()` 函数中使用 `*.zst`，并在 HTTP 客户端中使用 `Content-encoding: zstd`。此更改解决了 [#16791 ](https://github.com/ClickHouse/ClickHouse/issues/16791)。[#17144](https://github.com/ClickHouse/ClickHouse/pull/17144) ([Abi Palagashvili](https://github.com/fibersel)).
* 新增了 `mannWitneyUTest`、`studentTTest` 和 `welchTTest` 聚合函数。对 `rankCorr` 也做了一些重构。[#16883](https://github.com/ClickHouse/ClickHouse/pull/16883) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 新增函数 `countMatches`/`countMatchesCaseInsensitive`。[#17459](https://github.com/ClickHouse/ClickHouse/pull/17459) ([Azat Khuzhin](https://github.com/azat)) 。
* 实现 `countSubstrings()`/`countSubstringsCaseInsensitive()`/`countSubstringsCaseInsensitiveUTF8()` (计算子串出现次数) 。[#17347](https://github.com/ClickHouse/ClickHouse/pull/17347) ([Azat Khuzhin](https://github.com/azat)) 。
* 在 system.query\_log 中添加有关所使用数据库、表和列的信息。新增 `query_kind` 和 `normalized_query_hash` 字段。[#17726](https://github.com/ClickHouse/ClickHouse/pull/17726) ([Amos Bird](https://github.com/amosbird)) 。
* 新增设置 `optimize_on_insert`。启用后，会对通过 INSERT 写入的数据块执行与该块发生 merge 时相同的转换 (例如 Replacing、Collapsing、Aggregating...) 。该设置默认启用。这可能会影响 materialized view 和 MaterializeMySQL 的行为 (参见详细说明) 。这关闭了 [#10683](https://github.com/ClickHouse/ClickHouse/issues/10683)。[#16954](https://github.com/ClickHouse/ClickHouse/pull/16954) ([Kruglov Pavel](https://github.com/Avogar)) 。
* HDFS 的 Kerberos 认证。[#16621](https://github.com/ClickHouse/ClickHouse/pull/16621) ([Ilya Golshtein](https://github.com/ilejn)) 。
* 支持 `SHOW SETTINGS` 语句，可显示 system.settings 中的参数。还支持 `SHOW CHANGED SETTINGS` 以及 `LIKE/ILIKE` 子句。[#18056](https://github.com/ClickHouse/ClickHouse/pull/18056) ([Jianmei Zhang](https://github.com/zhangjmruc)).
* 函数 `position` 现已支持 `POSITION(needle IN haystack)` 语法，以兼容 SQL。这修复了 [#18701](https://github.com/ClickHouse/ClickHouse/issues/18701)。... [#18779](https://github.com/ClickHouse/ClickHouse/pull/18779) ([Jianmei Zhang](https://github.com/zhangjmruc)) 。
* 现在，MergeTree 家族中的表新增了一项存储设置 `max_partitions_to_read`。它用于限制单次查询可访问的最大分区数。同时还新增了一个用户设置 `force_max_partition_limit`，用于强制实施这一限制。[#18712](https://github.com/ClickHouse/ClickHouse/pull/18712) ([Amos Bird](https://github.com/amosbird)).
* 为 `system.part_log` 中已插入的 parts 新增 `query_id` 列。关闭 [#10097](https://github.com/ClickHouse/ClickHouse/issues/10097)。[#18644](https://github.com/ClickHouse/ClickHouse/pull/18644) ([flynn](https://github.com/ucasFL)) 。
* 允许在 CREATE TABLE AS SELECT 中指定列定义。示例：`CREATE TABLE t1 (x String) ENGINE = Memory AS SELECT 1;`。[#18060](https://github.com/ClickHouse/ClickHouse/pull/18060) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 新增了 `arrayMin`、`arrayMax` 和 `arrayAvg` 聚合函数。[#18032](https://github.com/ClickHouse/ClickHouse/pull/18032) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 已实现 `ATTACH TABLE name FROM 'path/to/data/' (col1 Type1, ...` 查询。该查询会按给定的结构创建新表，并从 `user_files` 中指定的目录附加表数据。[#17903](https://github.com/ClickHouse/ClickHouse/pull/17903) ([tavplubix](https://github.com/tavplubix)) 。
* 为 StorageMemory 添加变更支持。此项改动修复了 [#9117](https://github.com/ClickHouse/ClickHouse/issues/9117)。[#15127](https://github.com/ClickHouse/ClickHouse/pull/15127) ([flynn](https://github.com/ucasFL)) 。
* 支持 `EXISTS DATABASE name` 语法。[#18458](https://github.com/ClickHouse/ClickHouse/pull/18458) ([Du Chuan](https://github.com/spongedu)) 。
* 新增对内置函数 `isIPv4String` && `isIPv6String` 的支持，类似于 [MySQL](https://github.com/ClickHouse/ClickHouse/compare/master...spongedu:support_is_ipv4?expand=1)。[#18349](https://github.com/ClickHouse/ClickHouse/pull/18349) ([Du Chuan](https://github.com/spongedu)) 。
* 新增设置 `insert_distributed_one_random_shard = 1`，从而允许在没有任何分布式键的情况下向多分片分布式表插入数据。[#18294](https://github.com/ClickHouse/ClickHouse/pull/18294) ([Amos Bird](https://github.com/amosbird)) 。
* 向 MergeTreeSettings 中添加了设置 `min_compress_block_size` 和 `max_compress_block_size`；它们的优先级高于全局设置，并且仅在设置后生效。关闭 [13890](https://github.com/ClickHouse/ClickHouse/issues/13890)。[#17867](https://github.com/ClickHouse/ClickHouse/pull/17867) ([flynn](https://github.com/ucasFL)).
* 新增了对 64 位 roaring bitmap 的支持。[#17858](https://github.com/ClickHouse/ClickHouse/pull/17858) ([Andy Yang](https://github.com/andyyzh)) 。
* 扩展了 `OPTIMIZE ... DEDUPLICATE` 语法，支持显式指定用于检查重复项的列列表 (也可通过星号/列转换器隐式指定) 。... [#17846](https://github.com/ClickHouse/ClickHouse/pull/17846) ([Vasily Nemkov](https://github.com/Enmk)).
* 新增函数 `toModifiedJulianDay`、`fromModifiedJulianDay`、`toModifiedJulianDayOrNull` 和 `fromModifiedJulianDayOrNull`。这些函数可用于在前推格里高利历日期和修正儒略日编号之间进行转换。[#17750](https://github.com/ClickHouse/ClickHouse/pull/17750) ([PHO](https://github.com/depressed-pho)).
* 新增对使用自定义 TLD 列表的支持：添加了函数 `firstSignificantSubdomainCustom`、`cutToFirstSignificantSubdomainCustom`。[#17748](https://github.com/ClickHouse/ClickHouse/pull/17748) ([Azat Khuzhin](https://github.com/azat)) 。
* 新增对 `PROXYv1` 协议的支持，用于封装 native TCP 接口。允许将 quotas 的键设为代理转发的 IP 地址 (适用于 `PROXYv1` 地址以及来自 HTTP interface 的 `X-Forwarded-For`) 。如果你仅通过受信任的代理 (例如 CloudFlare) 提供对 ClickHouse 的访问，但又希望按用户的原始 IP 地址统计其资源使用情况，这项功能就非常有用。此修复解决了 [#17268](https://github.com/ClickHouse/ClickHouse/issues/17268)。[#17707](https://github.com/ClickHouse/ClickHouse/pull/17707) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 现在，clickhouse-client 支持打开 `EDITOR` 来编辑命令。`Alt-Shift-E`。 [#17665](https://github.com/ClickHouse/ClickHouse/pull/17665) ([Amos Bird](https://github.com/amosbird)) 。
* 添加函数 `encodeXMLComponent`，用于对字符进行转义，以便将字符串放入 XML 文本节点或属性值中。[#17659](https://github.com/ClickHouse/ClickHouse/pull/17659) ([nauta](https://github.com/nautaa)).
* 引入 `DETACH TABLE/VIEW ... PERMANENTLY` 语法，这样重启后表不会自动重新出现 (仅会在显式请求时恢复) 。仍可使用简写语法 ATTACH TABLE 将该表重新附加。实现了 [#5555](https://github.com/ClickHouse/ClickHouse/issues/5555)。修复了 [#13850](https://github.com/ClickHouse/ClickHouse/issues/13850)。[#17642](https://github.com/ClickHouse/ClickHouse/pull/17642) ([filimonov](https://github.com/filimonov)).
* 新增了用于统计 MergeTree 表中总行数、总字节数和 parts 数量的异步指标。此项修复了 [#11714](https://github.com/ClickHouse/ClickHouse/issues/11714)。[#17639](https://github.com/ClickHouse/ClickHouse/pull/17639) ([flynn](https://github.com/ucasFL)).
* 为 SQL 之外的分页新增 `limit` 和 `offset` 设置：[#16176](https://github.com/ClickHouse/ClickHouse/issues/16176) 它们有助于构建 API。这两个设置会对 SELECT 查询生效，效果等同于添加 `select * from (your_original_select_query) t limit xxx offset xxx;`。[#17633](https://github.com/ClickHouse/ClickHouse/pull/17633) ([hexiaoting](https://github.com/hexiaoting)) 。
* 提供一个新的聚合函数组合器：`-SimpleState`，可在查询中构建 `SimpleAggregateFunction` 类型。这对于定义使用 AggregatingMergeTree 引擎的物化视图很有用，也会让投影受益。[#16853](https://github.com/ClickHouse/ClickHouse/pull/16853) ([Amos Bird](https://github.com/amosbird)).
* 为 `clickhouse-client` 和 `clickhouse-local` 添加了 `queries-file` 参数。[#15930](https://github.com/ClickHouse/ClickHouse/pull/15930) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 `clickhouse-benchmark` 添加了 `query` 参数。[#17832](https://github.com/ClickHouse/ClickHouse/pull/17832) ([Maksim Kita](https://github.com/kitaisreal)) 。
* `EXPLAIN AST` 现在也支持 `SELECT` 之外的其他查询。[#18136](https://github.com/ClickHouse/ClickHouse/pull/18136) ([taiyang-li](https://github.com/taiyang-li)) 。

<div id="experimental-feature">
  #### Experimental 功能
</div>

* 新增了用于计算文本 n-gram 和 shingle 的 minHash 与 simhash 的函数，用于半重复搜索。同时还新增了 `bitHammingDistance` 和 `tupleHammingDistance` 函数。[#7649](https://github.com/ClickHouse/ClickHouse/pull/7649) ([flynn](https://github.com/ucasFL)).
* 新增数据类型 `Map`。参见 [#1841](https://github.com/ClickHouse/ClickHouse/issues/1841)。`Map` 的首个版本仅支持键和值均为 `String` 类型。[#15806](https://github.com/ClickHouse/ClickHouse/pull/15806) ([hexiaoting](https://github.com/hexiaoting)).
* 实现了基于 ANTLR4 runtime 并由 EBNF 语法生成的另一种 SQL parser。[#11298](https://github.com/ClickHouse/ClickHouse/pull/11298) ([Ivan](https://github.com/abyss7)).

<div id="performance-improvement">
  #### 性能改进
</div>

* 新的 IP 字典实现降低了内存占用，在某些场景下提升了性能，并修复了一些问题。[#16804](https://github.com/ClickHouse/ClickHouse/pull/16804) ([vdimir](https://github.com/vdimir)).
* 数据导出支持并行格式化。[#11617](https://github.com/ClickHouse/ClickHouse/pull/11617) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* LDAP 集成：在 LDAP 服务器连接配置中新增了 `verification_cooldown` 参数，以支持在可配置的时间段内缓存成功的 "绑定" 尝试。[#15988](https://github.com/ClickHouse/ClickHouse/pull/15988) ([Denis Glazachev](https://github.com/traceon)).
* 为 `clickhouse-local` 添加 `--no-system-table` 选项，使其无需系统表即可运行。这样可避免初始化 `DateLUT`；该初始化在启动时可能会耗费较长时间 (数十毫秒) 。[#18899](https://github.com/ClickHouse/ClickHouse/pull/18899) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在 `AggregateFunctionWindowFunnelData` 中将 `PODArray` 替换为 `PODArrayWithStackMemory`，以提升 `windowFunnel` 函数性能。[#18817](https://github.com/ClickHouse/ClickHouse/pull/18817) ([flynn](https://github.com/ucasFL)).
* 在同步 INSERT 到 Distributed 表时，不要向分片发送空块。此更改修复了 [#14571](https://github.com/ClickHouse/ClickHouse/issues/14571)。[#18775](https://github.com/ClickHouse/ClickHouse/pull/18775) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 优化了 StorageMemory 的读取性能。[#18052](https://github.com/ClickHouse/ClickHouse/pull/18052) ([Maksim Kita](https://github.com/kitaisreal)).
* 使用 Dragonbox 算法替代 ryu 进行浮点数到字符串的转换，显著提升了这类转换的性能。[#17831](https://github.com/ClickHouse/ClickHouse/pull/17831) ([Maksim Kita](https://github.com/kitaisreal)).
* 优化了 `IPv6CIDRToRange` 的实现性能。[#17569](https://github.com/ClickHouse/ClickHouse/pull/17569) ([vdimir](https://github.com/vdimir)) 。
* 新增 `remerge_sort_lowered_memory_bytes_ratio` 设置 (如果 remerge 后的内存使用量未按此比例下降，则会禁用 remerge) 。[#17539](https://github.com/ClickHouse/ClickHouse/pull/17539) ([Azat Khuzhin](https://github.com/azat)).
* 提升 PK 中使用 SimpleAggregateFunction(String) 的 AggregatingMergeTree 性能。[#17109](https://github.com/ClickHouse/ClickHouse/pull/17109) ([Azat Khuzhin](https://github.com/azat)) 。
* 现在，`-If` 组合器已完成去虚拟化，`count` 也已正确实现向量化。相关改动见[此 PR](https://github.com/ClickHouse/ClickHouse/pull/17041)。[#17043](https://github.com/ClickHouse/ClickHouse/pull/17043) ([Amos Bird](https://github.com/amosbird)) 。
* 优化从大量 `MergeTree` 表读取 `Merge` 表时的性能。修复了 [#7748](https://github.com/ClickHouse/ClickHouse/issues/7748)。[#16988](https://github.com/ClickHouse/ClickHouse/pull/16988) ([Anton Popov](https://github.com/CurtizJ)).
* 优化了函数 `repeat` 的性能。[#16937](https://github.com/ClickHouse/ClickHouse/pull/16937) ([satanson](https://github.com/satanson)) 。
* 小幅提升了浮点数解析性能。[#16809](https://github.com/ClickHouse/ClickHouse/pull/16809) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 为 `OPTIMIZE TABLE ... FINAL` 新增了跳过已合并分区的功能。[#15939](https://github.com/ClickHouse/ClickHouse/pull/15939) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 集成了 [Daniel Lemire 的 fast\_float](https://github.com/lemire/fast_float)，用于解析浮点数。[#16787](https://github.com/ClickHouse/ClickHouse/pull/16787) ([Maksim Kita](https://github.com/kitaisreal)) 。该功能尚未启用，因为其性能仍低于 ClickHouse 中现有的粗略浮点解析器。
* 修复了 max\_distributed\_connections (会影响 `prefer_localhost_replica = 1` 和 `max_threads != max_distributed_connections`) 。[#17848](https://github.com/ClickHouse/ClickHouse/pull/17848) ([Azat Khuzhin](https://github.com/azat)) 。
* 向 S3 发送数据时，可自适应选择单分片或多分片上传方式。单分片上传由新设置 `max_single_part_upload_size` 控制。[#17934](https://github.com/ClickHouse/ClickHouse/pull/17934) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* 在 `PipelineExecutor` 中支持异步任务。初步支持远程查询使用异步套接字。[#17868](https://github.com/ClickHouse/ClickHouse/pull/17868) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
* 当列大小未知时，允许对紧凑 parts 使用 `optimize_move_to_prewhere` 优化。[#17330](https://github.com/ClickHouse/ClickHouse/pull/17330) ([Anton Popov](https://github.com/CurtizJ)) 。

<div id="improvement">
  #### 改进
</div>

* 在对使用 `TinyLog` 或 `Log` 表引擎的表执行向自身写入的 `INSERT SELECT` 时，可避免发生死锁。此更改修复了 [#6802](https://github.com/ClickHouse/ClickHouse/issues/6802)。此更改修复了 [#18691](https://github.com/ClickHouse/ClickHouse/issues/18691)。此更改修复了 [#16812](https://github.com/ClickHouse/ClickHouse/issues/16812)。此更改修复了 [#14570](https://github.com/ClickHouse/ClickHouse/issues/14570)。[#15260](https://github.com/ClickHouse/ClickHouse/pull/15260) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 支持类似于 [MySQL](https://dev.mysql.com/doc/refman/5.7/en/show-create-view.html) 的 `SHOW CREATE VIEW name` 语法。[#18095](https://github.com/ClickHouse/ClickHouse/pull/18095) ([Du Chuan](https://github.com/spongedu)) 。
* 所有 `Decimal * Float` 类型或反向组合的查询现均已支持，包括聚合查询 (例如 `SELECT sum(decimal_field * 1.1)` 或 `SELECT dec_col * float_col`) ，结果类型为 Float32 或 Float64。[#18145](https://github.com/ClickHouse/ClickHouse/pull/18145) ([Mike](https://github.com/myrrc)).
* 改进了轻量级 Web UI：添加历史记录；支持共享；避免不同请求之间的竞态条件；添加请求进行中和就绪状态指示器；添加 favicon；在 textarea 未获得焦点时检测 Ctrl+Enter。[#17293](https://github.com/ClickHouse/ClickHouse/pull/17293) [#17770](https://github.com/ClickHouse/ClickHouse/pull/17770) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* clickhouse-server 未向 ZooKeeper 服务器发送 `close` 请求。[#16837](https://github.com/ClickHouse/ClickHouse/pull/16837) ([alesapin](https://github.com/alesapin)).
* 避免在内存限制过低 (`max_memory_usage = 1` / `max_untracked_memory = 1`) 时发生服务器异常终止。[#17453](https://github.com/ClickHouse/ClickHouse/pull/17453) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了在不同事件具有相同 timestamp 时，`windowFunnel` 函数结果不确定的问题。[#18884](https://github.com/ClickHouse/ClickHouse/pull/18884) ([Fuwang Hu](https://github.com/fuwhu)).
* Docker：在 clickhouse-server Docker 镜像中，显式将 clickhouse 用户和用户组的 uid / gid 设置为固定值 (101)。[#19096](https://github.com/ClickHouse/ClickHouse/pull/19096) ([filimonov](https://github.com/filimonov)) 。
* 对 `Distributed` 表的异步 INSERT：新增了两个设置项 (参照 MergeTree 家族) ：- `fsync_after_insert` - 每次插入后都执行 fsync。这会降低插入性能。- `fsync_directories` - 在所有操作 (写入、重命名等) 完成后，对临时目录 (仅用于异步 INSERT) 执行 fsync。[#18864](https://github.com/ClickHouse/ClickHouse/pull/18864) ([Azat Khuzhin](https://github.com/azat)) 。
* `SYSTEM KILL` 命令现已可在 Docker 中正常工作。此项改动关闭了 [#18847](https://github.com/ClickHouse/ClickHouse/issues/18847)。[#18848](https://github.com/ClickHouse/ClickHouse/pull/18848) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 执行 `FETCH PARTITION` 时，会在 zk 路径中展开宏。[#18839](https://github.com/ClickHouse/ClickHouse/pull/18839) ([fastio](https://github.com/fastio)).
* 将 `ALTER TABLE <replicated_table> ON CLUSTER MODIFY SETTING ...` 应用于所有副本，因为这类 ALTER 命令不会复制到其他副本。[#18789](https://github.com/ClickHouse/ClickHouse/pull/18789) ([Amos Bird](https://github.com/amosbird)) 。
* 允许列转换器 `EXCEPT` 使用字符串作为正则表达式匹配器。这解决了 [#18685](https://github.com/ClickHouse/ClickHouse/issues/18685)。[#18699](https://github.com/ClickHouse/ClickHouse/pull/18699) ([Amos Bird](https://github.com/amosbird)) 。
* 修复 `SummingMergeTree` 中的 SimpleAggregateFunction。现在它的行为与 AggregateFunction 一致。在之前的版本中，无论使用的是哪种聚合函数，值都会直接相加。此修复解决了 [#18564](https://github.com/ClickHouse/ClickHouse/issues/18564) 。[#8052](https://github.com/ClickHouse/ClickHouse/issues/8052)。[#18637](https://github.com/ClickHouse/ClickHouse/pull/18637) ([Amos Bird](https://github.com/amosbird)) 。另一个关于在 `SummingMergeTree` 中使用 `SimpleAggregateFunction` 的修复。此修复解决了 [#18676](https://github.com/ClickHouse/ClickHouse/issues/18676) 。[#18677](https://github.com/ClickHouse/ClickHouse/pull/18677) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了在函数 bar 的最后一个参数为 NaN 时，allocator 内部发生的断言错误。现在会改为抛出常规的 ClickHouse 异常。此项修复解决了 [#17876](https://github.com/ClickHouse/ClickHouse/issues/17876)。[#18520](https://github.com/ClickHouse/ClickHouse/pull/18520) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复了一项易用性问题：某些工具中，异常消息后没有换行。[#18444](https://github.com/ClickHouse/ClickHouse/pull/18444) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 支持将主键列和分区键列的类型从 `LowCardinality(Type)` 修改为 `Type`，也支持反向修改。另支持将主键列的类型从 `EnumX ` 修改为 `IntX` 类型。修复了 [#5604](https://github.com/ClickHouse/ClickHouse/issues/5604)。[#18362](https://github.com/ClickHouse/ClickHouse/pull/18362) ([alesapin](https://github.com/alesapin)) 。
* 支持 `untuple` 字段访问。[#18133](https://github.com/ClickHouse/ClickHouse/issues/18133)。[#18309](https://github.com/ClickHouse/ClickHouse/pull/18309) ([hexiaoting](https://github.com/hexiaoting)) 。
* 允许从 CSV 中解析 Array 字段，前提是该字段表示为一个字符串，其中包含序列化为嵌套 CSV 的数组。示例：`"[""Hello"", ""world"", ""42"""" TV""]"` 将解析为 `['Hello', 'world', '42" TV']`。允许在 CSV 中从不带外层方括号的字符串解析数组。示例：`"'Hello', 'world', '42"" TV'"` 将解析为 `['Hello', 'world', '42" TV']`。[#18271](https://github.com/ClickHouse/ClickHouse/pull/18271) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 优化 MergeTree wide parts 的自适应粒度计算。[#18223](https://github.com/ClickHouse/ClickHouse/pull/18223) ([alesapin](https://github.com/alesapin)) 。
* 现在，`clickhouse install` 已可在 Mac 上运行。问题在于该平台上没有 procfs。[#18201](https://github.com/ClickHouse/ClickHouse/pull/18201) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 改进了 `SHOW ...` 查询语法的提示。[#18183](https://github.com/ClickHouse/ClickHouse/pull/18183) ([Du Chuan](https://github.com/spongedu)) 。
* `arrayMin`、`arrayMax`、`arraySum` 和 `arrayAvg` 这些 Array 聚合函数现已支持 `Int128`、`Int256` 和 `UInt256`。[#18147](https://github.com/ClickHouse/ClickHouse/pull/18147) ([Maksim Kita](https://github.com/kitaisreal)) 。
* 在 Set 和 Join 的存储设置中添加 `disk`。[#18112](https://github.com/ClickHouse/ClickHouse/pull/18112) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) 。
* 访问控制：现在，表函数 `merge()` 要求当前用户对其读取数据的每个表都拥有 `SELECT` 权限。此 PR 修复了 [#16964](https://github.com/ClickHouse/ClickHouse/issues/16964)。[#18104](https://github.com/ClickHouse/ClickHouse/pull/18104) [#17983](https://github.com/ClickHouse/ClickHouse/pull/17983) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 临时表现在仅会显示在创建它们的会话的系统表 `system.tables` 和 `system.columns` 中。内部数据库 `_temporary_and_external_tables` 现已在这些系统表中隐藏；取而代之的是，临时表会显示为 database 为空且设置了 `is_temporary` 标志的表。[#18014](https://github.com/ClickHouse/ClickHouse/pull/18014) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复在终端窗口大小变化时 clickhouse-client 的渲染问题。[#18009](https://github.com/ClickHouse/ClickHouse/pull/18009) ([Amos Bird](https://github.com/amosbird)) 。
* 将客户端断开连接时相关事件的日志详细级别从 Warning 下调为 Information。[#18005](https://github.com/ClickHouse/ClickHouse/pull/18005) ([filimonov](https://github.com/filimonov)) 。
* 强制从 filesystem 中移除 DiskS3 的空元数据文件或损坏的元数据文件。S3 是一项 Experimental 功能。[#17935](https://github.com/ClickHouse/ClickHouse/pull/17935) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* 访问控制：`allow_introspection_functions=0` 会禁止使用内部信息函数，但不再禁止授予这类函数的授权 (被授权者需要自行将 `allow_introspection_functions=1`，才能使用该授权) 。类似地，`allow_ddl=0` 会禁止使用 DDL 命令，但也不再禁止授予这类命令的授权。[#17908](https://github.com/ClickHouse/ClickHouse/pull/17908) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 可用性改进：增加列名提示。[#17112](https://github.com/ClickHouse/ClickHouse/issues/17112)。[#17857](https://github.com/ClickHouse/ClickHouse/pull/17857) ([fastio](https://github.com/fastio)) 。
* 当两个 Merge 表尝试读取对方的数据时，增加诊断信息。[#17854](https://github.com/ClickHouse/ClickHouse/pull/17854) ([徐炘](https://github.com/weeds085490)) 。
* 允许在使用 ClickHouse Docker 镜像运行脚本时覆盖超时值。[#17818](https://github.com/ClickHouse/ClickHouse/pull/17818) ([Guillaume Tassery](https://github.com/YiuRULE)) 。
* 检查系统日志表的引擎定义语法，以避免一些配置错误。请注意，此语法检查不涉及语义，这意味着诸如不存在的列 / 表达式函数之类的错误，只有在表创建时才会被发现。[#17739](https://github.com/ClickHouse/ClickHouse/pull/17739) ([Du Chuan](https://github.com/spongedu)) 。
* 移除了 `RabbitMQ` 表在初始化时因无连接而抛出异常的行为 (它会在后台重新连接) 。[#17709](https://github.com/ClickHouse/ClickHouse/pull/17709) ([Kseniia Sumarokova](https://github.com/kssenii)) 。
* 在 Buffer flush 期间，不要忽略 server 的内存限制。[#17646](https://github.com/ClickHouse/ClickHouse/pull/17646) ([Azat Khuzhin](https://github.com/azat)) 。
* 改用已打补丁的 RocksDB 版本 (来自 ClickHouse-Extras) ，以修复 use-after-free 错误。[#17643](https://github.com/ClickHouse/ClickHouse/pull/17643) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 在并行解析时的异常消息中添加了偏移量信息。此修复解决了 [#17457](https://github.com/ClickHouse/ClickHouse/issues/17457)。[#17641](https://github.com/ClickHouse/ClickHouse/pull/17641) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 不要在 INSERT 查询执行过程中抛出“parts 过多”错误。[#17566](https://github.com/ClickHouse/ClickHouse/pull/17566) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 支持在 ALTER 查询的 UPDATE 语句中使用查询参数。修复了 [#10976](https://github.com/ClickHouse/ClickHouse/issues/10976)。[#17563](https://github.com/ClickHouse/ClickHouse/pull/17563) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 查询混淆器：避免将某些 SQL 关键字用作标识符名。[#17526](https://github.com/ClickHouse/ClickHouse/pull/17526) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 通过服务器指标导出 DDLWorker 已执行的当前最大 DDL 条目。这有助于检查 DDLWorker 是否卡在某处。[#17464](https://github.com/ClickHouse/ClickHouse/pull/17464) ([Amos Bird](https://github.com/amosbird)).
* 导出所有服务器当前线程的异步指标。这样有助于排查类似[this](https://github.com/ClickHouse-Extras/poco/pull/28)的问题。[#17463](https://github.com/ClickHouse/ClickHouse/pull/17463) ([Amos Bird](https://github.com/amosbird)).
* 启用设置 `asterisk_include_materialized_columns` 和 `asterisk_include_alias_columns` 时，通配符查询将包含 MATERIALIZED / ALIAS 等列。[#17462](https://github.com/ClickHouse/ClickHouse/pull/17462) ([Ken Chen](https://github.com/chenziliang)) 。
* 允许在 `config.xml` 中使用 `<ttl>` 属性指定 [生存时间 (TTL)](/zh/reference/engines/table-engines/mergetree-family/mergetree#mergetree-table-ttl)，以从[系统日志表](/zh/reference/system-tables/index)中删除旧条目。[#17438](https://github.com/ClickHouse/ClickHouse/pull/17438) ([Du Chuan](https://github.com/spongedu)) 。
* 现在，通过 MySQL 和 PostgreSQL 协议发送到服务器的查询具有不同的接口类型 (可在表 `system.query_log` 的 `interface` 列中查看) ：MySQL 为 `4`，PostgreSQL 为 `5`；不再使用之前的 `1`，而 `1` 现在仅用于原生协议。[#17437](https://github.com/ClickHouse/ClickHouse/pull/17437) ([Vitaly Baranov](https://github.com/vitlibar)).
* 修复 `INSERT ... SELECT ... SETTINGS` 查询中 SETTINGS 子句的解析。[#17414](https://github.com/ClickHouse/ClickHouse/pull/17414) ([Azat Khuzhin](https://github.com/azat)) 。
* 正确计入 RadixSort 中的内存占用。 [#17412](https://github.com/ClickHouse/ClickHouse/pull/17412) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 在 server 的 `receiveHello` 中添加 eof 检查，以避免抛出 `Attempt to read after eof` 异常。[#17365](https://github.com/ClickHouse/ClickHouse/pull/17365) ([Kruglov Pavel](https://github.com/Avogar)) 。
* 避免 bigint 转换时可能发生的栈溢出。大整数功能仍属 Experimental。[#17269](https://github.com/ClickHouse/ClickHouse/pull/17269) ([flynn](https://github.com/ucasFL)) 。
* 现在，`set` 索引可与 `GLOBAL IN` 配合使用。这修复了 [#17232](https://github.com/ClickHouse/ClickHouse/issues/17232)、[#5576](https://github.com/ClickHouse/ClickHouse/issues/5576)。[#17253](https://github.com/ClickHouse/ClickHouse/pull/17253) ([Amos Bird](https://github.com/amosbird)) 。
* 为发送到 S3 存储的请求增加 http 重定向次数限制 (`s3_max_redirects`) 。[#17220](https://github.com/ClickHouse/ClickHouse/pull/17220) ([ianton-ru](https://github.com/ianton-ru)) 。
* 当 `-OrNull` 组合器与 `-If`、`-Merge`、`-MergeState`、`-State` 组合器一起使用时，应将 `-OrNull` 放在最前面。[#16935](https://github.com/ClickHouse/ClickHouse/pull/16935) ([flynn](https://github.com/ucasFL)) 。
* 支持配置 HTTP 代理和 HTTPS S3 端点。[#16861](https://github.com/ClickHouse/ClickHouse/pull/16861) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* 为 S3 客户端增加了正确的身份验证支持，支持使用环境变量、`~/.aws` 和 `AssumeRole`。 [#16856](https://github.com/ClickHouse/ClickHouse/pull/16856) ([Vladimir Chebotarev](https://github.com/excitoon)).
* 新增更多 OpenTelemetry spans。添加了一个将 span 数据导出到 Zipkin 的示例。[#16535](https://github.com/ClickHouse/ClickHouse/pull/16535) ([Alexander Kuzmenkov](https://github.com/akuzm)).
* 缓存字典：彻底消除了获取字典时的回调函数和锁。键在查询时不再区分"未找到"和"已过期"，而是统一存储在同一个映射中。 [#14958](https://github.com/ClickHouse/ClickHouse/pull/14958) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* 修复了从未正常工作的 `fsync_part_directory`/`fsync_after_insert`/`in_memory_parts_insert_sync` (Experimental 功能) 。[#18845](https://github.com/ClickHouse/ClickHouse/pull/18845) ([Azat Khuzhin](https://github.com/azat)) 。
* 允许在 `MaterializeMySQL` 引擎的嵌套 database 中使用 `Atomic` 引擎。[#14849](https://github.com/ClickHouse/ClickHouse/pull/14849) ([tavplubix](https://github.com/tavplubix)) 。

<div id="bug-fixes">
  #### 问题修复
</div>

* 修复了极少数情况下服务器可能会停止接受连接的问题。[#17542](https://github.com/ClickHouse/ClickHouse/pull/17542) (Amos Bird，[alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了带常量参数的二元函数在索引分析中的问题，该问题会导致查询结果错误。此修复对应于 [#18364](https://github.com/ClickHouse/ClickHouse/issues/18364)。[#18373](https://github.com/ClickHouse/ClickHouse/pull/18373) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了在索引比较的类型不同时，可能导致索引分析错误的问题。此修复解决了 [#17122](https://github.com/ClickHouse/ClickHouse/issues/17122)。[#17145](https://github.com/ClickHouse/ClickHouse/pull/17145) ([Amos Bird](https://github.com/amosbird)) 。
* 在合并期间禁用使用 AIO 的写入操作，因为这在极少数情况下可能会导致合并过程中主键列的数据损坏。[#18481](https://github.com/ClickHouse/ClickHouse/pull/18481) ([alesapin](https://github.com/alesapin)).
* 限制将 wide parts 合并为 compact parts。在 vertical merge 的情况下，这会导致结果 part 损坏。[#18381](https://github.com/ClickHouse/ClickHouse/pull/18381) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了在发生读取退避时从 `MergeTree*` 读取可能导致查询结果不完整的问题 (日志中会出现消息 `<Debug> MergeTreeReadPool: Will lower number of threads`) 。该问题在 [#16423](https://github.com/ClickHouse/ClickHouse/issues/16423) 中引入。修复 [#18137](https://github.com/ClickHouse/ClickHouse/issues/18137)。[#18216](https://github.com/ClickHouse/ClickHouse/pull/18216) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复 `rocksdb` 库中释放后继续使用的问题。[#18862](https://github.com/ClickHouse/ClickHouse/pull/18862) ([sundyli](https://github.com/sundy-li)) 。
* 修复了从 `ORC` 格式文件中无限读取的问题 (该问题最初在 [#10580](https://github.com/ClickHouse/ClickHouse/issues/10580) 中引入) 。修复 [#19095](https://github.com/ClickHouse/ClickHouse/issues/19095)。[#19134](https://github.com/ClickHouse/ClickHouse/pull/19134) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了 MergeTree 数据写入器中的一个缺陷，该缺陷可能导致标记大小超过固定粒度大小。修复了 [#18913](https://github.com/ClickHouse/ClickHouse/issues/18913)。[#19123](https://github.com/ClickHouse/ClickHouse/pull/19123) ([alesapin](https://github.com/alesapin)) 。
* 修复了一个启动时 bug：当 ClickHouse 无法从 `LowCardinality(Nullable(...))` 读取压缩编解码器时，会抛出异常 `Attempt to read after EOF`。修复了 [#18340](https://github.com/ClickHouse/ClickHouse/issues/18340)。[#19101](https://github.com/ClickHouse/ClickHouse/pull/19101) ([alesapin](https://github.com/alesapin)) 。
* 限制对使用旧语法创建的 `MergeTree` 表执行 `MODIFY TTL` 查询。此前这类查询会执行成功，但实际上并不会生效。[#19064](https://github.com/ClickHouse/ClickHouse/pull/19064) ([Anton Popov](https://github.com/CurtizJ)).
* 确保 `groupUniqArray` 对枚举类型的参数返回正确的类型。此修复关闭了 [#17875](https://github.com/ClickHouse/ClickHouse/issues/17875)。[#19019](https://github.com/ClickHouse/ClickHouse/pull/19019) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了将 `ignore` 函数与 `LowCardinality` 参数一起使用时，可能出现的错误 `Expected single dictionary argument for function`。修复 [#14275](https://github.com/ClickHouse/ClickHouse/issues/14275)。[#19016](https://github.com/ClickHouse/ClickHouse/pull/19016) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了向使用 `TinyLog` 引擎的表中插入 `LowCardinality` 列时的问题。修复 [#18629](https://github.com/ClickHouse/ClickHouse/issues/18629)。[#19010](https://github.com/ClickHouse/ClickHouse/pull/19010) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* Join 会尝试将 const 列物化，但我们的代码需要在其他位置使用这些列。[#18982](https://github.com/ClickHouse/ClickHouse/pull/18982) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 禁用 `optimize_move_functions_out_of_any`，因为该优化并非始终正确。关闭了 [#18051](https://github.com/ClickHouse/ClickHouse/issues/18051)。关闭了 [#18973](https://github.com/ClickHouse/ClickHouse/issues/18973)。[#18981](https://github.com/ClickHouse/ClickHouse/pull/18981) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了因合并查询计划中的 `Expression` 步骤而可能导致的异常 `QueryPipeline stream: different number of columns`。修复 [#18190](https://github.com/ClickHouse/ClickHouse/issues/18190)。[#18980](https://github.com/ClickHouse/ClickHouse/pull/18980) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了一个在关闭时极少发生的死锁问题。[#18977](https://github.com/ClickHouse/ClickHouse/pull/18977) ([tavplubix](https://github.com/tavplubix)).
* 修复了以下错误行为：当 `ALTER TABLE ... DROP PART 'part_name'` 查询删除某个分片时，会把整个分区的所有去重块一并删除。修复了 [#18874](https://github.com/ClickHouse/ClickHouse/issues/18874)。[#18969](https://github.com/ClickHouse/ClickHouse/pull/18969) ([alesapin](https://github.com/alesapin))。
* Attach 分区时应重置变更。[#18804](https://github.com/ClickHouse/ClickHouse/issues/18804)。[#18935](https://github.com/ClickHouse/ClickHouse/pull/18935) ([fastio](https://github.com/fastio)) 。
* 修复了 `bitmapOrCardinality` 中可能导致空指针解引用的问题。此项修复关闭了 [#18911](https://github.com/ClickHouse/ClickHouse/issues/18911)。[#18912](https://github.com/ClickHouse/ClickHouse/pull/18912) ([sundyli](https://github.com/sundy-li)) 。
* 修复了 `clickhouse-local` 在关闭时可能发生卡顿的问题。此修复解决了 [#18891](https://github.com/ClickHouse/ClickHouse/issues/18891)。[#18893](https://github.com/ClickHouse/ClickHouse/pull/18893) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 如果包含 `x IN table` 形式的表达式，外部数据库 (MySQL、ODBC、JDBC) 的查询会被错误地重写。此修复解决了 [#9756](https://github.com/ClickHouse/ClickHouse/issues/9756)。[#18876](https://github.com/ClickHouse/ClickHouse/pull/18876) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复 \*If 组合器与一元函数及 Nullable 类型配合使用时的问题。[#18806](https://github.com/ClickHouse/ClickHouse/pull/18806) ([Azat Khuzhin](https://github.com/azat)).
* 修复了一个问题：如果将设置 `network_compression_method` 全局设为非默认值，异步分布式 INSERT 可能会被服务器拒绝。此修复解决了 [#18741](https://github.com/ClickHouse/ClickHouse/issues/18741)。[#18776](https://github.com/ClickHouse/ClickHouse/pull/18776) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了在尝试将 `NULL` 从 `Nullable(String)` `CAST` 为 `Nullable(Decimal(P, S))` 时出现的 `Attempt to read after eof` 错误。现在，当无法从 Nullable String 中解析出 decimal 时，`CAST` 函数会返回 `NULL`。修复了 [#7690](https://github.com/ClickHouse/ClickHouse/issues/7690)。[#18718](https://github.com/ClickHouse/ClickHouse/pull/18718) ([Winter Zhang](https://github.com/zhang2014)) 。
* 修复了日志记录中的一个小问题。[#18717](https://github.com/ClickHouse/ClickHouse/pull/18717) ([sundyli](https://github.com/sundy-li)) 。
* 修复了使用旧语法创建的 `ReplicatedMergeTree` 表中空 parts 无法删除的问题。修复 [#18582](https://github.com/ClickHouse/ClickHouse/issues/18582)。[#18614](https://github.com/ClickHouse/ClickHouse/pull/18614) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了此前日期在不同取值下发生溢出的 bug。将 Date 的取值上限严格限制为 "2106-02-07"，并将大于 "2106-02-07" 的日期转换为值 0。[#18565](https://github.com/ClickHouse/ClickHouse/pull/18565) ([hexiaoting](https://github.com/hexiaoting)).
* 新增了对从 MySQL 复制 FixedString 数据类型的支持。从 MySQL 进行复制是一项实验性功能。此补丁修复了 [#18450](https://github.com/ClickHouse/ClickHouse/issues/18450)，也修复了 [#6556](https://github.com/ClickHouse/ClickHouse/issues/6556)。[#18553](https://github.com/ClickHouse/ClickHouse/pull/18553) ([awesomeleo](https://github.com/awesomeleo)).
* 修复对子查询结果使用 `ORDER BY`，且该子查询包含 `RIGHT` 或 `FULL` JOIN 时，可能出现的 `Pipeline stuck` 错误。[#18550](https://github.com/ClickHouse/ClickHouse/pull/18550) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 修复了一个 bug：终止相应变更后，`ALTER` 查询可能会挂起。由 Thread Fuzzer 发现。[#18518](https://github.com/ClickHouse/ClickHouse/pull/18518) ([alesapin](https://github.com/alesapin)).
* `parseDateTimeBestEffort` 函数现已正确支持 12 AM。此项修复解决了 [#18402](https://github.com/ClickHouse/ClickHouse/issues/18402)。[#18449](https://github.com/ClickHouse/ClickHouse/pull/18449) ([vladimir-golovchenko](https://github.com/vladimir-golovchenko)) 。
* 修复了在使用 `Nullable(String)` 类型参数执行 `toType(...)` 函数 (`toDate`、`toUInt32` 等) 时出现的 `value is too short` 错误。现在，此类函数在发生解析错误时会返回 `NULL`，而不是抛出异常。修复 [#7673](https://github.com/ClickHouse/ClickHouse/issues/7673)。[#18445](https://github.com/ClickHouse/ClickHouse/pull/18445) ([tavplubix](https://github.com/tavplubix)) 。
* 修复 `SHOW TABLES` 的非预期行为。[#18431](https://github.com/ClickHouse/ClickHouse/pull/18431) ([fastio](https://github.com/fastio)) 。
* 修复了 -SimpleState 组合器会生成不兼容参数类型和返回类型的问题。[#18404](https://github.com/ClickHouse/ClickHouse/pull/18404) ([Amos Bird](https://github.com/amosbird)) 。
* 修复了并发使用 `Set` 或 `Join` 表，以及查询 `system.tables` 时可能出现的竞态条件。[#18385](https://github.com/ClickHouse/ClickHouse/pull/18385) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 修复了表 `system.settings_profile_elements` 的填充问题。此 PR 修复了 [#18231](https://github.com/ClickHouse/ClickHouse/issues/18231)。[#18379](https://github.com/ClickHouse/ClickHouse/pull/18379) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复了在使用两级聚合时，带有 `Distinct` 组合器的聚合函数可能发生崩溃的问题。修复 [#17682](https://github.com/ClickHouse/ClickHouse/issues/17682)。[#18365](https://github.com/ClickHouse/ClickHouse/pull/18365) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了在同时支持 IPv4/IPv6 双栈的机器上，server 无法访问 `clickhouse-odbc-bridge` 进程的问题；修复了使用格式错误的查询更新 ODBC 字典时，以及导致 odbc-bridge 进程崩溃的问题；可能解决了 [#14489](https://github.com/ClickHouse/ClickHouse/issues/14489)。[#18278](https://github.com/ClickHouse/ClickHouse/pull/18278) ([Denis Glazachev](https://github.com/traceon)) 。
* 访问控制：现在，如果用户至少有权访问表中的一个列，就可以执行 `SELECT count() FROM table`。此 PR 修复了 [#10639](https://github.com/ClickHouse/ClickHouse/issues/10639)。[#18233](https://github.com/ClickHouse/ClickHouse/pull/18233) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 访问控制：`SELECT JOIN` 现在要求对每个被 join 的表都具有 `SELECT` 权限。此 PR 修复了 [#17654](https://github.com/ClickHouse/ClickHouse/issues/17654)。[#18232](https://github.com/ClickHouse/ClickHouse/pull/18232) ([Vitaly Baranov](https://github.com/vitlibar)) 。
* 修复 Enum 与 Int 类型之间的键比较问题。此项修复解决了 [#17989](https://github.com/ClickHouse/ClickHouse/issues/17989)。[#18214](https://github.com/ClickHouse/ClickHouse/pull/18214) ([Amos Bird](https://github.com/amosbird)) 。
* 从 MySQL 进行复制 (Experimental 功能) 。修复了 [#18186](https://github.com/ClickHouse/ClickHouse/issues/18186) 修复了 [#16372](https://github.com/ClickHouse/ClickHouse/issues/16372) 修复了 MaterializeMySQL database engine 中唯一键转换的问题。[#18211](https://github.com/ClickHouse/ClickHouse/pull/18211) ([Winter Zhang](https://github.com/zhang2014)) 。
* 修复同时使用 `WITH FILL` 和 `WITH TIES` 的查询中的不一致问题 [#17466](https://github.com/ClickHouse/ClickHouse/issues/17466)。[#18188](https://github.com/ClickHouse/ClickHouse/pull/18188) ([hexiaoting](https://github.com/hexiaoting)).
* 修复了这样一个问题：如果最后一列发生解析错误，仍会插入带有默认值的行。修复了 [#17712](https://github.com/ClickHouse/ClickHouse/issues/17712)。[#18182](https://github.com/ClickHouse/ClickHouse/pull/18182) ([Jianmei Zhang](https://github.com/zhangjmruc)) 。
* 修复尝试设置 profile 时出现的 `Unknown setting profile` 错误。[#18167](https://github.com/ClickHouse/ClickHouse/pull/18167) ([tavplubix](https://github.com/tavplubix)).
* 修复了查询 `MODIFY COLUMN ... REMOVE TTL` 实际未移除列 TTL 的问题。[#18130](https://github.com/ClickHouse/ClickHouse/pull/18130) ([alesapin](https://github.com/alesapin)).
* 修复了 S3 URL 解析时出现的 `std::out_of_range: basic_string` 问题。[#18059](https://github.com/ClickHouse/ClickHouse/pull/18059) ([Vladimir Chebotarev](https://github.com/excitoon)) 。
* 修复 `DateTime64` 与 `Date` 之间的比较问题。修复了 [#13804](https://github.com/ClickHouse/ClickHouse/issues/13804) 和 [#11222](https://github.com/ClickHouse/ClickHouse/issues/11222)。... [#18050](https://github.com/ClickHouse/ClickHouse/pull/18050) ([Vasily Nemkov](https://github.com/Enmk)) 。
* 从 MySQL 复制 (实验性功能) ：修复了 [#15187](https://github.com/ClickHouse/ClickHouse/issues/15187) 和 [#17912](https://github.com/ClickHouse/ClickHouse/issues/17912)，并支持为 MaterializeMySQL 转换 MySQL 前缀索引。[#17944](https://github.com/ClickHouse/ClickHouse/pull/17944) ([Winter Zhang](https://github.com/zhang2014)) 。
* 当使用数值大于 2^32 的 `logger.size` 参数配置服务器日志轮转时，日志无法正常轮转。现已修复。[#17905](https://github.com/ClickHouse/ClickHouse/pull/17905) ([Alexander Kuzmenkov](https://github.com/akuzm)).
* 如果查询包含 ARRAY JOIN (即该查询实际上并非简单查询) ，简单查询优化会产生错误结果。[#17887](https://github.com/ClickHouse/ClickHouse/pull/17887) ([sundyli](https://github.com/sundy-li)).
* 修复了 `topK` 聚合函数中可能出现的段错误。此修复解决了 [#17404](https://github.com/ClickHouse/ClickHouse/issues/17404)。[#17845](https://github.com/ClickHouse/ClickHouse/pull/17845) ([Maksim Kita](https://github.com/kitaisreal)) 。
* WAL (Experimental 功能) ：如果 `in_memory_parts_enable_wal` 已禁用，则不要从 WAL 中恢复 parts。[#17802](https://github.com/ClickHouse/ClickHouse/pull/17802) ([detailyang](https://github.com/detailyang)) 。
* 关于可删除表的最大大小的异常消息显示有误。[#17764](https://github.com/ClickHouse/ClickHouse/pull/17764) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了向 `Distributed` 表插入数据时，空间不足可能导致段错误的问题。[#17737](https://github.com/ClickHouse/ClickHouse/pull/17737) ([tavplubix](https://github.com/tavplubix)).
* 修复了 ClickHouse 无法重新建立与 MySQL 服务器的连接的问题。[#17681](https://github.com/ClickHouse/ClickHouse/pull/17681) ([Alexander Kazakov](https://github.com/Akazz)) 。
* Windows：修复了在适用于 Linux 的 Windows 子系统上运行 ClickHouse 时，在 `Atomic` 数据库中执行 `RENAME` 查询时出现的 `Function not implemented` 错误。修复 [#17661](https://github.com/ClickHouse/ClickHouse/issues/17661)。[#17664](https://github.com/ClickHouse/ClickHouse/pull/17664) ([tavplubix](https://github.com/tavplubix)) 。
* 当 `pool_size` > 1 时，由于竞态条件，在执行 `ON CLUSTER` 查询时，可能会错误地判断集群是否为循环 (交叉) 复制。现已修复。[#17640](https://github.com/ClickHouse/ClickHouse/pull/17640) ([tavplubix](https://github.com/tavplubix)) 。
* 修复服务器以守护进程模式运行时 `system.stack_trace` 表为空的问题。[#17630](https://github.com/ClickHouse/ClickHouse/pull/17630) ([Amos Bird](https://github.com/amosbird)) 。
* 对于 MergeTree 表，异常 `fmt::v7::format_error` 可能会在后台记录到日志中。此问题已在 [#17613](https://github.com/ClickHouse/ClickHouse/issues/17613) 中修复。[#17615](https://github.com/ClickHouse/ClickHouse/pull/17615) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 当在交互模式下使用 clickhouse-client 执行多行查询时，单行注释会被错误地一直延伸到整个查询末尾。此修复解决了 [#13654](https://github.com/ClickHouse/ClickHouse/issues/13654)。[#17565](https://github.com/ClickHouse/ClickHouse/pull/17565) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复了以下问题：当相应的变更在另一个副本上被终止时，`alter` 查询会卡住。修复了 [#16953](https://github.com/ClickHouse/ClickHouse/issues/16953)。[#17499](https://github.com/ClickHouse/ClickHouse/pull/17499) ([alesapin](https://github.com/alesapin)).
* 修复了 ClickHouse 低估标记缓存大小时导致的内存统计问题。在存在大量带有标记的小文件时，可能会出现这种情况。[#17496](https://github.com/ClickHouse/ClickHouse/pull/17496) ([alesapin](https://github.com/alesapin)).
* 修复了在启用设置 `optimize_redundant_functions_in_order_by` 时 `ORDER BY` 的问题。 [#17471](https://github.com/ClickHouse/ClickHouse/pull/17471) ([Anton Popov](https://github.com/CurtizJ)).
* 修复了 `DISTINCT` 之后可能出现重复项的问题，原因是优化错误。修复 [#17294](https://github.com/ClickHouse/ClickHouse/issues/17294)。[#17296](https://github.com/ClickHouse/ClickHouse/pull/17296) ([li chengxiang](https://github.com/chengxianglibra))。[#17439](https://github.com/ClickHouse/ClickHouse/pull/17439) ([Nikolai Kochetov](https://github.com/KochetovNicolai))。
* 修复了 \*MergeTree 表后台任务 CPU 占用过高的问题。[#17416](https://github.com/ClickHouse/ClickHouse/pull/17416) ([tavplubix](https://github.com/tavplubix)) 。
* 修复从具有 `LowCardinality` 类型的 `JOIN` 表读取数据时可能发生的崩溃。修复了 [#17228](https://github.com/ClickHouse/ClickHouse/issues/17228)。[#17397](https://github.com/ClickHouse/ClickHouse/pull/17397) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) 。
* 来自 MySQL 的复制 (Experimental 功能) ：修复了 [#16835](https://github.com/ClickHouse/ClickHouse/issues/16835)，尝试修复与 MySQL SHOW 语句表头不一致的问题。[#17366](https://github.com/ClickHouse/ClickHouse/pull/17366) ([Winter Zhang](https://github.com/zhang2014)) 。
* 修复谓词优化器中非确定性函数的问题。此修复对应 [#17244](https://github.com/ClickHouse/ClickHouse/issues/17244)。[#17273](https://github.com/ClickHouse/ClickHouse/pull/17273) ([Winter Zhang](https://github.com/zhang2014)) 。
* 修复了 Distributed 查询在使用 `LIMIT` 时可能出现的 `Unexpected packet Data received from client` 错误。[#17254](https://github.com/ClickHouse/ClickHouse/pull/17254) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了子查询中存在 const 列时 Set 索引失效的问题。该修复对应 [#17246](https://github.com/ClickHouse/ClickHouse/issues/17246)。[#17249](https://github.com/ClickHouse/ClickHouse/pull/17249) ([Amos Bird](https://github.com/amosbird)) 。
* clickhouse-copier：修复非分区表的相关问题 [#15235](https://github.com/ClickHouse/ClickHouse/issues/15235)。[#17248](https://github.com/ClickHouse/ClickHouse/pull/17248) ([Qi Chen](https://github.com/kaka11chen)).
* 修复了存储在 S3 磁盘上的 parts 的变更可能无法正常工作的问题 (实验性功能) 。[#17227](https://github.com/ClickHouse/ClickHouse/pull/17227) ([Pavel Kovalenko](https://github.com/Jokser)) 。
* 修复了函数 `fuzzBits` 的错误，相关问题：[#16980](https://github.com/ClickHouse/ClickHouse/issues/16980)。[#17051](https://github.com/ClickHouse/ClickHouse/pull/17051) ([hexiaoting](https://github.com/hexiaoting)) 。
* 修复了仅包含 OFFSET 的查询中 `optimize_distributed_group_by_sharding_key` 的问题。[#16996](https://github.com/ClickHouse/ClickHouse/pull/16996) ([Azat Khuzhin](https://github.com/azat)).
* 修复了通过 `Distributed` 表查询 `Merge` 表并使用 JOIN 时出现的问题。[#16993](https://github.com/ClickHouse/ClickHouse/pull/16993) ([Azat Khuzhin](https://github.com/azat)) 。
* 修复了 ORDER BY 在单调函数场景下的优化问题。修复了 [#16107](https://github.com/ClickHouse/ClickHouse/issues/16107)。[#16956](https://github.com/ClickHouse/ClickHouse/pull/16956) ([Anton Popov](https://github.com/CurtizJ)) 。
* 修复了对不同标度的 `DateTime64` 类型进行比较时的错误。修复 [#16655](https://github.com/ClickHouse/ClickHouse/issues/16655) ... [#16952](https://github.com/ClickHouse/ClickHouse/pull/16952) ([Vasily Nemkov](https://github.com/Enmk)).
* 修复了在启用 `optimize_aggregators_of_group_by_keys` 设置以及使用 JOIN 时，GROUP BY 优化的问题。修复了 [#12604](https://github.com/ClickHouse/ClickHouse/issues/12604)。[#16951](https://github.com/ClickHouse/ClickHouse/pull/16951) ([Anton Popov](https://github.com/CurtizJ)) 。
* 对 SHOW ACCESS 查询进行了小幅修复。[#16866](https://github.com/ClickHouse/ClickHouse/pull/16866) ([tavplubix](https://github.com/tavplubix)) 。
* 修复了启用 `optimize_trivial_count_query` 设置且带有分区谓词时的行为问题。[#16767](https://github.com/ClickHouse/ClickHouse/pull/16767) ([Azat Khuzhin](https://github.com/azat)).
* 通过 MySQL wire 协议执行 INSERT 查询时，会返回受影响的行数。此前 ClickHouse 一直返回 0，现已修复。修复了 [#16605](https://github.com/ClickHouse/ClickHouse/issues/16605)。[#16715](https://github.com/ClickHouse/ClickHouse/pull/16715) ([Winter Zhang](https://github.com/zhang2014)) 。
* 修复了 `select_sequential_consistency` 导致的优化后的简单计数查询和系统表行为不一致问题。[#16309](https://github.com/ClickHouse/ClickHouse/pull/16309) ([Hao Chen](https://github.com/haoch)).
* 当 `REPLACE` 列转换器作用于不存在的列时，会抛出错误。[#16183](https://github.com/ClickHouse/ClickHouse/pull/16183) ([hexiaoting](https://github.com/hexiaoting)) 。
* 在 RIGH|FULL JOIN 中，如果 ON 表达式是非等值 join，则抛出异常。[#15162](https://github.com/ClickHouse/ClickHouse/pull/15162) ([Artem Zuikov](https://github.com/4ertus2)) 。

<div id="buildtestingpackaging-improvement">
  #### 构建/测试/打包改进
</div>

* 为 ClickHouse 可执行文件添加了简单的完整性检查。它可用于检测因硬件故障导致的损坏 (如存储介质上的位衰减或 RAM 中的位翻转) 。[#18811](https://github.com/ClickHouse/ClickHouse/pull/18811) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 将 `OpenSSL` 替换为 `BoringSSL`。这样可以避免 sanitizers 相关问题。此修复解决了 [#12490](https://github.com/ClickHouse/ClickHouse/issues/12490)。此修复解决了 [#17502](https://github.com/ClickHouse/ClickHouse/issues/17502)。此修复解决了 [#12952](https://github.com/ClickHouse/ClickHouse/issues/12952)。[#18129](https://github.com/ClickHouse/ClickHouse/pull/18129) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 简化 `Sys/V` init 脚本。该脚本在 Ubuntu 12.04 及更早版本上无法正常工作。[#17428](https://github.com/ClickHouse/ClickHouse/pull/17428) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 改进了 `./clickhouse install` 脚本。[#17421](https://github.com/ClickHouse/ClickHouse/pull/17421) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 现在 ClickHouse 可以充当一个假的 ZooKeeper。目前，存储实现仅为内存中的哈希表，且服务器仅部分支持 ZooKeeper 协议。[#16877](https://github.com/ClickHouse/ClickHouse/pull/16877) ([alesapin](https://github.com/alesapin)).
* 修复 TestKeeperStorage (ZooKeeper 的一个模拟对象) 中移除失效 watch 列表时的问题。[#18065](https://github.com/ClickHouse/ClickHouse/pull/18065) ([alesapin](https://github.com/alesapin)).
* 添加 `SYSTEM SUSPEND` 命令以进行故障注入，可用于方便开展故障转移测试。此项改动关闭了 [#15979](https://github.com/ClickHouse/ClickHouse/issues/15979)。[#18850](https://github.com/ClickHouse/ClickHouse/pull/18850) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 在 ClickHouse 与 `lld` 链接时生成 build id。事实证明，在我的机器上，`lld` 默认不会生成它。build id 用于崩溃报告和内部信息。[#18808](https://github.com/ClickHouse/ClickHouse/pull/18808) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 修复风格检查中的 ShellCheck 错误。[#18566](https://github.com/ClickHouse/ClickHouse/pull/18566) ([Ilya Yatsishin](https://github.com/qoega)).
* 将时区信息更新至 2020e。 [#18531](https://github.com/ClickHouse/ClickHouse/pull/18531) ([alesapin](https://github.com/alesapin)).
* 修复 codespell 警告。将风格检查拆分成单独的部分。更新风格检查使用的 Docker 镜像。[#18463](https://github.com/ClickHouse/ClickHouse/pull/18463) ([Ilya Yatsishin](https://github.com/qoega)) 。
* 用于自动检查文档中残留的冲突标记。[#18332](https://github.com/ClickHouse/ClickHouse/pull/18332) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 为无状态测试的 flaky 检查启用 Thread Fuzzer。[#18299](https://github.com/ClickHouse/ClickHouse/pull/18299) ([alesapin](https://github.com/alesapin)).
* 不要使用非线程安全的函数 `strerror`。[#18204](https://github.com/ClickHouse/ClickHouse/pull/18204) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 更新 `anchore/scan-action@main` 工作流操作 (已从 `master` 迁移到 `main`) 。[#18192](https://github.com/ClickHouse/ClickHouse/pull/18192) ([Stig Bakken](https://github.com/stigsb)).
* 现在，`clickhouse-test` 会在超时限制下执行 DROP/CREATE 数据库操作。[#18098](https://github.com/ClickHouse/ClickHouse/pull/18098) ([alesapin](https://github.com/alesapin)).
* 启用 Pytest 框架对无状态测试的 Experimental 支持。[#17902](https://github.com/ClickHouse/ClickHouse/pull/17902) ([Ivan](https://github.com/abyss7)).
* 现在，我们在集成测试中使用更新后的 docker daemon 版本。[#17671](https://github.com/ClickHouse/ClickHouse/pull/17671) ([alesapin](https://github.com/alesapin)) 。
* 如果启用了 Sentry，则向其发送有关官方构建、内存、CPU 和可用磁盘空间的信息。Sentry 是一项需要用户主动启用的功能，用于帮助 ClickHouse 开发者。此变更关闭了 [#17279](https://github.com/ClickHouse/ClickHouse/issues/17279)。[#17543](https://github.com/ClickHouse/ClickHouse/pull/17543) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* clickhouse-copier 的代码中有一个变量未初始化。[#17363](https://github.com/ClickHouse/ClickHouse/pull/17363) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复 [#17309](https://github.com/ClickHouse/ClickHouse/issues/17309) 中的[一条 MSan 报告](https://clickhouse-test-reports.s3.yandex.net/17309/065cd002578f2e8228f12a2744bd40c970065e0c/stress_test_\(memory\)/stderr.log)。[#17344](https://github.com/ClickHouse/ClickHouse/pull/17344) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) 。
* 修复了 Arrow Flight 库中的 IPv6 问题。详情请见[评论](https://github.com/ClickHouse/ClickHouse/pull/16243#issuecomment-720830294)。[#16664](https://github.com/ClickHouse/ClickHouse/pull/16664) ([Zhanna](https://github.com/FawnD2)).
* 添加一个库，将某些 `libc` 函数替换为会导致进程终止的陷阱。 [#16366](https://github.com/ClickHouse/ClickHouse/pull/16366) ([alexey-milovidov](https://github.com/alexey-milovidov)).
* 在发生栈溢出时，在服务器日志中提供诊断信息，并将错误消息发送给 clickhouse-client。此项修复关闭了 [#14840](https://github.com/ClickHouse/ClickHouse/issues/14840)。[#16346](https://github.com/ClickHouse/ClickHouse/pull/16346) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 现在，几乎所有无状态功能测试都可以并行运行了。[#15236](https://github.com/ClickHouse/ClickHouse/pull/15236) ([alesapin](https://github.com/alesapin)) 。
* 修复了 `librdkafka` 中 snappy 解压缩时的数据损坏问题 (该问题仅影响 gcc10 构建，但官方构建已使用 clang，因此至少近期的官方发布版本不受影响) 。[#18053](https://github.com/ClickHouse/ClickHouse/pull/18053) ([Azat Khuzhin](https://github.com/azat)).
* 如果 server 因 OOM killer 被终止，则在日志中输出一条消息。[#13516](https://github.com/ClickHouse/ClickHouse/pull/13516) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* PODArray：避免使用 `(nullptr, 0)` 参数调用 memcpy (修复 UBSan 报告) 。此修复解决了 [#18525](https://github.com/ClickHouse/ClickHouse/issues/18525)。[#18526](https://github.com/ClickHouse/ClickHouse/pull/18526) ([alexey-milovidov](https://github.com/alexey-milovidov)) 。
* 对 DDLWorker 内部 ZooKeeper 路径的拼接进行了小幅改进。[#17767](https://github.com/ClickHouse/ClickHouse/pull/17767) ([Bharat Nallan](https://github.com/bharatnc)) 。
* 允许从调试文件中重新加载符号。该 PR 还修复了一个 build-id 相关问题。[#17637](https://github.com/ClickHouse/ClickHouse/pull/17637) ([Amos Bird](https://github.com/amosbird)) 。

<div id="changelog-for-2020">
  ## [2020 年更新日志](/zh/resources/changelogs/oss/2020)
</div>
