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

# Cloud v24.10 更新日志

> v24.10 快速发布更新日志

与 ClickHouse Cloud 服务相关的 v24.10 版本变更。

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

* 现在，当子查询位于括号内时，在包含 `UNION` 的查询链中允许将 `SETTINGS` 写在 `FORMAT` 之前。此更改关闭了 [#39712](https://github.com/ClickHouse/ClickHouse/issues/39712)。同时，这也改变了在同一查询序列中两次指定 SETTINGS 子句时的行为：离对应子查询最近的 SETTINGS 子句将优先生效。在此前的版本中，最外层的 SETTINGS 子句可能会优先于内层子句。[#60197](https://github.com/ClickHouse/ClickHouse/pull/60197)[#68614](https://github.com/ClickHouse/ClickHouse/pull/68614) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* 重新实现了 Dynamic 类型。现在，当动态数据类型数量达到上限时，新类型不再被转换为 String，而是以二进制格式存储在一种特殊的数据结构中，并附带二进制编码的类型信息。现在，任何曾插入到 Dynamic 列中的类型都可以作为子列读取出来。[#68132](https://github.com/ClickHouse/ClickHouse/pull/68132) ([Pavel Kruglov](https://github.com/Avogar)).
* 现已支持对命名元组使用 `a[b].c` 这样的表达式，也支持在任意表达式上使用命名下标，例如 `expr().name`。这对处理 JSON 很有用。此更改关闭了 [#54965](https://github.com/ClickHouse/ClickHouse/issues/54965)。在此前的版本中，形如 `expr().name` 的表达式会被解析为 `tupleElement(expr(), name)`，查询分析器会查找名为 `name` 的列，而不是对应的元组元素；而在新版本中，它会被改为 `tupleElement(expr(), 'name')`。在大多数情况下，旧版本实际上并不能正常工作，但也可以设想一种非常罕见的场景，在这种情况下，此更改可能导致不兼容：如果你将元组元素名称存储在某个列或别名中，而该列或别名的名称又与元组元素名称不同：`SELECT 'b' AS a, CAST([tuple(123)] AS 'Array(Tuple(b UInt8))') AS t, t[1].a`。你使用过这类查询的可能性极低，但我们仍需将此更改标记为可能向后不兼容。[#68435](https://github.com/ClickHouse/ClickHouse/pull/68435) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* 启用设置 `print_pretty_type_names` 后，`Tuple` 数据类型将在 `SHOW CREATE TABLE` 语句、`formatQuery` 函数，以及 `clickhouse-client` 和 `clickhouse-local` 的交互模式中以 Pretty 形式输出。在此前的版本中，此设置仅适用于 `DESCRIBE` 查询和 `toTypeName`。此更改关闭了 [#65753](https://github.com/ClickHouse/ClickHouse/issues/65753)。[#68492](https://github.com/ClickHouse/ClickHouse/pull/68492) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* 现在默认允许对 `[PRE]WHERE` 子句中的过滤条件进行重排序。可通过将 `allow_reorder_prewhere_conditions` 设置为 `false` 来禁用。[#70657](https://github.com/ClickHouse/ClickHouse/pull/70657) ([Nikita Taranov](https://github.com/nickitat)).
* 修复了 `optimize_functions_to_subcolumns` 优化的问题 (此前可能导致 `Invalid column type for ColumnUnique::insertRangeFrom. Expected String, got LowCardinality(String)` 错误) ，修复方式是在 `mapKeys`/`mapValues` 中保留 `LowCardinality` 类型。[#70716](https://github.com/ClickHouse/ClickHouse/pull/70716) ([Azat Khuzhin](https://github.com/azat)).

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

* 可刷新materialized view 现已可用于生产环境。[#70550](https://github.com/ClickHouse/ClickHouse/pull/70550) ([Michael Kolupaev](https://github.com/al13n321)) 。Replicated 数据库现已支持可刷新materialized view。[#60669](https://github.com/ClickHouse/ClickHouse/pull/60669) ([Michael Kolupaev](https://github.com/al13n321)) 。
* 函数 `toStartOfInterval()` 现已新增一个重载形式，可分别模拟 TimescaleDB 的 `time_bucket()` 函数和 PostgreSQL 的 `date_bin()` 函数。([#55619](https://github.com/ClickHouse/ClickHouse/issues/55619))。它允许以*任意*原点为起点，将日期或时间戳值对齐到给定时间间隔的整数倍上 (而不是使用 0000-01-01 00:00:00.000 这一*固定*原点) 。例如，`SELECT toStartOfInterval(toDateTime('2023-01-01 14:45:00'), INTERVAL 1 MINUTE, toDateTime('2023-01-01 14:35:30'));` 返回 `2023-01-01 14:44:30`，这是以原点 `2023-01-01 14:35:30` 为起点按 1 分钟时间间隔对齐后的结果。[#56738](https://github.com/ClickHouse/ClickHouse/pull/56738) ([Yarik Briukhovetskyi](https://github.com/yariks5s)) 。
* MongoDB integration 已重构：从已弃用的 Poco::MongoDB 迁移到新的驱动 mongocxx；移除对已弃用旧协议的支持；支持通过 URI 建立连接；支持所有 MongoDB 类型；支持在 MongoDB 端执行 WHERE 和 ORDER BY 语句；对 MongoDB 不支持的表达式加以限制。[#63279](https://github.com/ClickHouse/ClickHouse/pull/63279) ([Kirill Nikiforov](https://github.com/allmazz)) 。
* clickhouse-client 中新增了 `--progress-table` 选项，用于打印一个表格，显示查询执行期间不断变化的指标；同时新增了与 `--progress-table` 配套的 `--enable-progress-table-toggle` 选项，可通过按下控制键 (空格键) 切换进度表的显示。[#63689](https://github.com/ClickHouse/ClickHouse/pull/63689) ([Maria Khristenko](https://github.com/mariaKhr)).
* 这样即可对带通配符的前缀授予访问权限。`GRANT SELECT ON db.table_pefix_* TO user`。[#65311](https://github.com/ClickHouse/ClickHouse/pull/65311) ([pufit](https://github.com/pufit)) 。
* 新增了 JSONCompactWithProgress 格式，ClickHouse 会将每一行输出为一个以换行分隔的 JSON 对象，其中包含元数据、数据、进度、总计和统计信息。[#66205](https://github.com/ClickHouse/ClickHouse/pull/66205) ([Alexey Korepanov](https://github.com/alexkorep)).
* 新增 system.query\_metric\_log，其中包含来自表 system.events 的各个查询的内存和指标值历史记录，并会定期写入磁盘。[#66532](https://github.com/ClickHouse/ClickHouse/pull/66532) ([Pablo Marcos](https://github.com/pamarcos)) 。
* 新增 `input_format_json_empty_as_default` 设置。启用后，会将 JSON 输入中的空字段视为默认值。解决了 [#59339](https://github.com/ClickHouse/ClickHouse/issues/59339)。[#66782](https://github.com/ClickHouse/ClickHouse/pull/66782) ([Alexis Arnaud](https://github.com/a-a-f)).
* 新增了函数 `overlay` 和 `overlayUTF8`，可将字符串中的部分内容替换为另一个字符串。示例：`SELECT overlay('Hello New York', 'Jersey', 11)` 返回 `Hello New Jersey`。[#66933](https://github.com/ClickHouse/ClickHouse/pull/66933) ([李扬](https://github.com/taiyang-li)) 。
* 新增命令：按分区执行轻量级删除 `DELETE FROM [db.]table [ON CLUSTER cluster] [IN PARTITION partition_expr] WHERE expr;` \`\`\` VM-114-29-tos :) select \* from ads\_app\_poster\_ip\_source\_channel\_di\_replicated\_local;. [#67805](https://github.com/ClickHouse/ClickHouse/pull/67805) ([sunny](https://github.com/sunny19930321)).
* 已支持对 `Interval` 数据类型的值进行比较，比较时现在会将其转换为最小超类型。[#68057](https://github.com/ClickHouse/ClickHouse/pull/68057) ([Yarik Briukhovetskyi](https://github.com/yariks5s)) 。
* 新增 create\_if\_not\_exists 设置，使 CREATE 语句默认采用 IF NOT EXISTS 行为。[#68164](https://github.com/ClickHouse/ClickHouse/pull/68164) ([Peter Nguyen](https://github.com/petern48)).
* 现已支持读取 Azure 和本地的 Iceberg 表。[#68210](https://github.com/ClickHouse/ClickHouse/pull/68210) ([Daniil Ivanik](https://github.com/divanik)).
* 新增聚合函数 distinctDynamicTypes/distinctJSONPaths/distinctJSONPathsAndTypes，以便更好地查看 JSON 列类型内容的内部信息。[#68463](https://github.com/ClickHouse/ClickHouse/pull/68463) ([Pavel Kruglov](https://github.com/Avogar)) 。
* 现在支持按标签删除查询缓存条目。例如，由 `SELECT 1 SETTINGS use_query_cache = true, query_cache_tag = 'abc'` 创建的查询缓存条目，现在可以通过 `SYSTEM DROP QUERY CACHE TAG 'abc'` 删除 (当然，也可以直接使用：`SYSTEM DROP QUERY CACHE`，这会清空整个查询缓存) 。[#68477](https://github.com/ClickHouse/ClickHouse/pull/68477) ([Michał Tabaszewski](https://github.com/pinsvin00)) 。
* 可以使用隐式 SELECT 编写简单的 SELECT 查询，从而支持计算器风格的表达式，例如 `ch "1 + 2"`。这由新设置 `implicit_select` 控制。[#68502](https://github.com/ClickHouse/ClickHouse/pull/68502) ([Alexey Milovidov](https://github.com/alexey-milovidov)) 。
* 为 `clickhouse local` 增加 `--copy` 模式支持，作为格式转换的快捷方式 [#68503](https://github.com/ClickHouse/ClickHouse/issues/68503)。[#68583](https://github.com/ClickHouse/ClickHouse/pull/68583) ([Denis Hananein](https://github.com/denis-hananein)) 。
* 新增了 `ripeMD160` 函数，用于计算字符串的 RIPEMD-160 加密哈希值。示例：`SELECT hex(ripeMD160('The quick brown fox jumps over the lazy dog'))` 返回 `37F332F68DB77BD9D7EDD4969571AD671CF9DD3B`。[#68639](https://github.com/ClickHouse/ClickHouse/pull/68639) ([Dergousov Maxim](https://github.com/m7kss1)) 。
* 为 URL 表引擎添加虚拟列 \_headers。关闭 [#65026](https://github.com/ClickHouse/ClickHouse/issues/65026)。[#68867](https://github.com/ClickHouse/ClickHouse/pull/68867) ([flynn](https://github.com/ucasfl)).
* 新增 `system.projections` 表，用于跟踪可用投影。[#68901](https://github.com/ClickHouse/ClickHouse/pull/68901) ([Jordi Villar](https://github.com/jrdi)) 。
* 新增对 `arrayUnion` 函数的支持。[#68989](https://github.com/ClickHouse/ClickHouse/pull/68989) ([Peter Nguyen](https://github.com/petern48)) 。
* 新增 `arrayZipUnaligned` 函数，以兼容 Spark 的 arrays\_zip；该函数基于原有的 `arrayZip`，支持未对齐数组。 \`\`\` sql SELECT arrayZipUnaligned(\[1], \[1, 2, 3]). [#69030](https://github.com/ClickHouse/ClickHouse/pull/69030) ([李扬](https://github.com/taiyang-li)).
* 支持聚合函数 `quantileExactWeightedInterpolated`，它是基于 quantileExactWeighted 的插值版本。有些人可能会疑惑，既然已经有了 `quantileExactInterpolatedWeighted`，为什么还需要新的 `quantileExactWeightedInterpolated`。原因是新函数比旧函数更准确。顺便一提，这是为了兼容 Apache Gluten 中的 Spark。[#69619](https://github.com/ClickHouse/ClickHouse/pull/69619) ([李扬](https://github.com/taiyang-li)) 。
* 支持 arrayElementOrNull 函数。若数组索引越界或未找到 map 键，则返回 null。[#69646](https://github.com/ClickHouse/ClickHouse/pull/69646) ([李扬](https://github.com/taiyang-li)) 。
* 通过在 Dynamic 内部类型上执行，大多数函数现已支持 Dynamic 类型。[#69691](https://github.com/ClickHouse/ClickHouse/pull/69691) ([Pavel Kruglov](https://github.com/Avogar)) 。
* 为函数 `arrayAUC` 新增参数 `scale` (默认值：`true`) ，可用于跳过归一化步骤 (问题 [#69609](https://github.com/ClickHouse/ClickHouse/issues/69609)) 。[#69717](https://github.com/ClickHouse/ClickHouse/pull/69717) ([gabrielmcg44](https://github.com/gabrielmcg44)) 。
* 重新加入了 `RIPEMD160` 函数，该函数用于计算字符串的 RIPEMD-160 加密哈希值。示例：`SELECT HEX(RIPEMD160('The quick brown fox jumps over the lazy dog'))` 返回 `37F332F68DB77BD9D7EDD4969571AD671CF9DD3B`。[#70087](https://github.com/ClickHouse/ClickHouse/pull/70087) ([Dergousov Maxim](https://github.com/m7kss1)) 。
* 支持使用 ETag + 文件路径的哈希作为缓存键，缓存对象存储表引擎和数据湖读取的文件。 [#70135](https://github.com/ClickHouse/ClickHouse/pull/70135) ([Kseniia Sumarokova](https://github.com/kssenii)).
* 支持读取 HDFS 上的 Iceberg 表。[#70268](https://github.com/ClickHouse/ClickHouse/pull/70268) ([flynn](https://github.com/ucasfl)) 。
* 通过设置 `input_format_binary_read_json_as_string/output_format_binary_write_json_as_string`，可在 RowBinary format 中将 JSON 类型作为二进制字符串读写。[#70288](https://github.com/ClickHouse/ClickHouse/pull/70288) ([Pavel Kruglov](https://github.com/Avogar)) 。
* 支持在 Native format 中将 JSON 列作为单个 String 列进行序列化/反序列化。对于输出，使用设置 `output_format_native_write_json_as_string`。对于输入，在列数据前使用序列化版本 `1`。[#70312](https://github.com/ClickHouse/ClickHouse/pull/70312) ([Pavel Kruglov](https://github.com/Avogar)) 。
* 现已支持标准 CTE 和 `with insert`，此前仅支持 `insert ... with ...`。[#70593](https://github.com/ClickHouse/ClickHouse/pull/70593) ([Shichao Jin](https://github.com/jsc0218)) 。
