Python Polars v2.2.0:破坏性变更与 Out-of-core joins
Python Polars 2.2.0
推荐理由
v2.2.0 包含多项破坏性变更(如 str.find 返回值语义改变、SQL DELETE 行为调整),升级前务必检查现有代码是否依赖旧接口或行为,避免线上故障。
🏆 Highlights
🏆 亮点
- Out-of-core joins (#30679)
- 堆外连接 (#30679)
💥 Breaking changes
💥 破坏性变更
- Add Expr.bin.find(_many), and return char offsets in Expr.str.find(_many) (#31026)
- Require scalar function arguments at plan time (#30914)
- Make SQL DELETE change the registered table in a SQLContext (#30869)
- 添加 Expr.bin.find(_many),并在 Expr.str.find(_many) 中返回字符偏移量 (#31026)
- 在计划阶段要求标量函数参数 (#30914)
- 使 SQL DELETE 更改 SQLContext 中注册的表 (#30869)
🚀 Performance improvements
🚀 性能改进
- Parallel streaming cumulative aggregations (#31062)
- Properly assign Timestamp unit on ingest (#29699)
- Optimize single-char strip (#31052)
- Add null-equal join support to SQL (#31049)
- Drop the entries of null Map rows without memory per entry (#31014)
- Don't publish join runtime filters to scans too small to skip much (#31025)
- Compare dictionary codes with one code when a single dictionary value matches (#31023)
- Probe ordered streaming joins sync and build one table for small build sides (#31019)
- Avoid redundant dictionary scans and byte-array copies in Parquet writes (#30982)
- Cache plugin symbol lookups (#31013)
- Use the rolling kernels on chunked input in window aggregations (#30472)
- Abandon stalled cloud reads after a stall timeout (#30966)
- Drop unused projections in join (#30740)
- Skip files by predicates on the include_file_paths column (#30802)
- Run the SQL lambda resolver through dynamic dispatch (#30930)
- Skip key deduplication when materializing a scalar Map (#30862)
- Don't generate the run reduction for order-dependent reducers (#30929)
- Compare columns through one non-generic function (#30931)
- Skip row groups for is_in with an imploded Series (#30925)
- Drop unused projections in sort (#30739)
- Store 128-bit group-by keys next to the hash table instead of in it (#30830)
- Reduce runs of consecutive rows of one group as slices in streaming group-by (#30813)
- Skip the hot table for runs of equal dictionary codes in streaming group-by (#30812)
- Keep the probe columns as is in streaming joins on unique build keys (#30807)
- Reduce runs of equal groups locally in sum, mean, min and max (#30808)
- Keep parquet dictionary-encoded String columns as Column::Dictionary (#30522)
- Skip repeated values of a group in streaming unique and n_unique (#30804)
- Handle nulls in horizontal min/max without a per-type option kernel (#30806)
- Reuse the hash table lookup for runs of equal string keys in join probes (#30803)
- Pushdown filters on the include_file_paths column (#30785)
- Skip hashing and hot table lookups for runs of equal string keys (#30794)
- Compute rolling_*_by windows outside the generic aggregation (#30795)
- Build dictionaries in casts with u32 or u64 keys (#30790)
- Compute date parts with integer arithmetic (#30777)
- Read IPC buffers through a reader trait object (#30772)
- Rewrite get(arg_max()) to max_by (#30773)
- Gather string views before translating their buffers (#30766)
- Run parallel quantile selection on integer keys (#30761)
- Select quantile order statistics in parallel (#30570)
- Use exact integer ranges of large parquet files for packed keys (#30717)
- Pack multi-column join and group-by keys into fixed-width integers (#30708)
- Compute quantiles and quantile/rank bins by selection instead of sorting (#30569)
- Skip the probe side of joins without non-null build keys (#30692)
- Search sorted numeric slices with branchless binary searches (#30568)
- Optimise decoding of small Parquet String and Binary columns (#30632)
- Vectorize Decimal mean and sum reductions (#30704)
- Use estimated rows to choose the build side of streaming equi joins (#30681)
- Out-of-core joins (#30679)
- Move inner and semi/anti joins below left joins in more cases (#30694)
- Let null-rejecting string predicates downgrade outer joins (#30693)
- Use column equalities between joined inputs as join keys when reordering joins (#30680)
- Prune unused struct fields in projection pushdown (#30598)
- Implement more fold iterators (#30670)
- Count distinct join keys of in-memory frames for join estimates (#30667)
- Evaluate conditions reading both inputs inside outer equi joins (#30654)
- Use the streaming group-by for value_counts with sort or normalize (#30636)
- Pass plan statistics through row index nodes (#30658)
- Keep statistics of passed-through columns next to a computed column in a select (#30660)
- Use an exact bitset as runtime filter for integer join keys in a small range (#30662)
- Estimate the sizes of streaming group-by results in parallel (#30661)
- Use a hash join for outer joins on an equality and a condition on one input (#30651)
- Parse CSV columns at a time over a mask based field index (#30639)
- Let local Parquet scans grow their prefetch window (#30640)
- Speed up inline binary view construction for short strings (#30628)
- Add dedicated kernel for concat_list (#30604)
- Improve TrueIdxIter and use in IEJoin (#30612)
- Always inline CSV field splitting (#30626)
- Build inline binary views without a memcpy call (#30609)
- Decrease threshold for parallel column decoding for Parquet (#30610)
- Let the scan pipeline window follow the in-flight byte budget (#30098)
- Let the cloud read rate limiter follow demand (#30102)
- Optimise decoding of Parquet Struct, Map, Array and List rows (#30601)
- Admit parked cloud reads in issue order (#29982)
- Reuse CSV field end masks for unquoted fields (#30597)
- Probe in-flight byte budget for cloud reads (#29766)
- Increase prefetch window for ordered Parquet and IPC scans (#29728)
- Avoid rescanning null runs in the streaming merge-join (#30575)
- Make the streaming equi-join build side fully spillable (#30558)
- Ingest approx-quantile items per chunk (#30516)
- Optimise DataType::eq comparison (#30557)
- Rewrite filters on the first row number of unordered windows into a group-by (#30509)
- Add memory grant system and use in group_by (#30524)
- Estimate horizontal concatenations so the joins above them can be reordered (#30539)
- Evaluate fused group-by inputs per partition instead of per loaded batch (#30508)
- Evaluate SQL subqueries correlated only by inequalities once per distinct outer value (#30511)
- Don't treat SQL decimal multiplication as fallible in the optimizer (#30510)
- Merge streaming min_by/max_by aggregations that share a key and store short keys inline (#30507)
- Store rows once in unordered streaming windows under memory pressure (#30496)
- Let SQL window functions reorder rows when only the result observes the order (#30494)
- Split streaming merge join windows in linear time (#30474)
- Share the item count between parallel KLL sketches (#30381)
- Fix count-only projection pushdown through LazyFrameResolver (#30445)
- Mark Expr.replace with literal as elementwise (#30430)
- Scan CSV fields once for the default line terminators (#30414)
- Start hot table even smaller with rapid growth (#30384)
- Copy short runs in filter instead of slicing the whole array (#30406)
- Count pre-aggregates in memory when choosing the number of streaming group-by partitions (#30405)
- Add fixed-size row encoding layouts (#30379)
- Lower int_range(0, pl.len()) of any wide integer dtype to a row index in streaming (#30376)
- Build the left side of semi and anti joins when the right side references its unique keys (#30373)
- Make cum_sum_horizontal a native element-wise expression (#30341)
- Trim leading and trailing .* from str.contains regexes (#30261)
- Broadcast per-group scalars for small groups in agg andover (#30343)
- Don't expand a single-row Series literal per group (#30308)
- Make is_in row-group pruning exact for any haystack size (#29923)
- Reserve less memory in streaming sort (#30314)
- Improve DirtyHash for 128-bit integers (#30320)
- Compare integer columns to float literals and dt.year() to date bounds (#30311)
- Use row estimates for semi and anti joins when both sides exceed the sample (#30307)
- Calculate describe() quantiles without sort (#30244)
- Optimize rolling_min and rolling_max with a van Herk block scan (#29445)
- 并行流式累积聚合 (#31062)
- 在摄入时正确分配 Timestamp 单位 (#29699)
- 优化单字符 strip (#31052)
- 为 SQL 添加 null-equal 连接支持 (#31049)
- 在不按条目计内存的情况下丢弃 null Map 行的条目 (#31014)
- 不要将连接运行时过滤器发布给太小而无法跳过太多数据的扫描 (#31025)
- 当单个字典值匹配时,使用一个代码比较字典代码 (#31023)
- 探测有序流式连接的同步,并为小型构建侧构建一个表 (#31019)
- 避免 Parquet 写入中的冗余字典扫描和字节数组复制 (#30982)
- 缓存插件符号查找 (#31013)
- 在窗口聚合中对分块输入使用滚动内核 (#30472)
- 在停滞超时后放弃停滞的云读取 (#30966)
- 在连接中丢弃未使用的投影 (#30740)
- 通过 include_file_paths 列上的谓词跳过文件 (#30802)
- 通过动态分发运行 SQL lambda 解析器 (#30930)
- 在物化标量 Map 时跳过键去重 (#30862)
- 不为依赖顺序的归约器生成运行归约 (#30929)
- 通过一个非泛型函数比较列 (#30931)
- 在 is_in 与折叠 Series 时跳过行组 (#30925)
- 在排序中丢弃未使用的投影 (#30739)
- 将 128 位分组键存储在哈希表旁边而非其中 (#30830)
- 在流式分组中将同一组的连续行缩减为切片 (#30813)
- 在流式分组中跳过相等字典代码的连续行的热表查找 (#30812)
- 在基于唯一构建键的流式连接中保持探测列不变 (#30807)
- 在 sum、mean、min 和 max 中局部减少相等组的连续行 (#30808)
- 在 parquet 中将字典编码的 String 列保留为 Column::Dictionary (#30522)
- 在流式 unique 和 n_unique 中跳过组的重复值 (#30804)
- 在不使用按类型选项内核的情况下处理水平 min/max 中的空值 (#30806)
- 在连接探测中重用相等字符串键连续行的哈希表查找 (#30803)
- 对 include_file_paths 列应用过滤器下推 (#30785)
- 跳过相等字符串键连续行的哈希计算和热表查找 (#30794)
- 在非通用聚合之外计算 rolling_*_by 窗口 (#30795)
- 在使用 u32 或 u64 键的转换中构建字典 (#30790)
- 使用整数算术计算日期部分 (#30777)
- 通过读取器 trait 对象读取 IPC 缓冲区 (#30772)
- 将 get(arg_max()) 重写为 max_by (#30773)
- 在转换其缓冲区之前收集字符串视图 (#30766)
- 在整数键上运行并行分位数选择 (#30761)
- 并行选择分位数顺序统计量 (#30570)
- 对于打包键,使用大型 parquet 文件的精确整数范围 (#30717)
- 将多列连接和分组键打包为固定宽度整数 (#30708)
- 通过选择而非排序计算分位数及分位数/排名分箱 (#30569)
- 跳过无非空构建键的连接探测侧 (#30692)
- 使用无分支二分搜索对有序数值切片进行搜索 (#30568)
- 优化小型 Parquet 字符串和二进制列的解码 (#30632)
- 向量化小数均值和求约简操作 (#30704)
- 使用估计行数来选择流式等值连接的构建侧 (#30681)
- 外存连接 (#30679)
- 在更多情况下将内部连接和半/反连接置于左连接之下 (#30694)
- 允许拒绝 null 值的字符串谓词降级外部连接 (#30693)
- 在重排连接时,使用连接输入之间的列相等性作为连接键 (#30680)
- 在投影下推中修剪未使用的结构体字段 (#30598)
- 实现更多的折叠迭代器 (#30670)
- 为连接估计计数内存帧中不同连接键的数量 (#30667)
- 在外部等值连接内评估同时读取两个输入的条件 (#30654)
- 对带有 sort 或 normalize 参数的 value_counts 使用流式分组 (#30636)
- 通过行索引节点传递计划统计信息 (#30658)
- 在选择操作中,将透传列的统计信息保留在计算列旁边 (#30660)
- 对于小范围内的整数连接键,使用精确位集作为运行时过滤器 (#30662)
- 并行估计流式分组结果的大小 (#30661)
- 对基于等值和单输入条件的外部连接使用哈希连接 (#30651)
- 基于掩码字段索引按列解析 CSV (#30639)
- 让本地 Parquet 扫描扩大其预取窗口 (#30640)
- 加速短字符串的内联二进制视图构建 (#30628)
- 为 concat_list 添加专用内核 (#30604)
- 改进 TrueIdxIter 并在 IEJoin 中使用 (#30612)
- 始终内联 CSV 字段分割 (#30626)
- 在不使用 memcpy 调用的情况下构建内联二进制视图 (#30609)
- 降低 Parquet 并行列解码的阈值 (#30610)
- 让扫描管道窗口跟随未决字节预算 (#30098)
- 让云读取速率限制器跟随需求 (#30102)
- 优化 Parquet Struct、Map、Array 和 List 行的解码 (#30601)
- 按发出顺序接受暂停的云读取 (#29982)
- 对非引用字段重用 CSV 字段结束掩码 (#30597)
- 探测云读取的未决字节预算 (#29766)
- 增加有序 Parquet 和 IPC 扫描的预取窗口 (#29728)
- 避免在流式合并连接中重新扫描空值运行 (#30575)
- 使流式等值连接的构建阶段完全可溢出 (#30558)
- 按块摄入近似分位数项 (#30516)
- 优化 DataType::eq 比较 (#30557)
- 将无序窗口的第一行号上的过滤器重写为 group-by (#30509)
- 添加内存授予系统并在 group_by 中使用 (#30524)
- 估算水平连接,以便对其上方的连接进行重排序 (#30539)
- 按分区而非按加载批次评估融合 group-by 输入 (#30508)
- 仅通过不等式关联的 SQL 子查询针对每个不同的外部值只求值一次 (#30511)
- 在优化器中不要将 SQL 十进制乘法视为可能失败的运算 (#30510)
- 合并共享键的流式 min_by/max_by 聚合,并将短键内联存储 (#30507)
- 在内存压力下,对无序流式窗口中的行只存储一次 (#30496)
- 当仅结果观察到顺序时,让 SQL 窗口函数重排序 (#30494)
- 线性时间内拆分流式合并连接窗口 (#30474)
- 在并行 KLL 草图之间共享项目计数 (#30381)
- 修复通过 LazyFrameResolver 的仅计数投影下推 (#30445)
- 将带字面量的 Expr.replace 标记为逐元素操作 (#30430)
- 针对默认行终止符仅扫描一次 CSV 字段 (#30414)
- 使用快速增长策略进一步缩小热表规模 (#30384)
- 在过滤器中复制短运行序列,而非切片整个数组 (#30406)
- 在选择流式分组分区数量时计算内存中的预聚合值 (#30405)
- 添加固定大小的行编码布局 (#30379)
- 在流式处理中将任何宽整数类型的 int_range(0, pl.len()) 下推为行索引 (#30376)
- 当右侧引用其唯一键时构建半连接和反连接的左侧 (#30373)
- 使 cum_sum_horizontal 成为原生的逐元素表达式 (#30341)
- 从 str.contains 正则表达式中修剪前导和尾随的 .* (#30261)
- 在 agg 和 over 中对小分组广播每组分量的标量值 (#30343)
- 不要按分组展开单行 Series 字面量 (#30308)
- 使 is_in 的行组剪枝对任意 haystack 大小都精确 (#29923)
- 减少流式排序中的内存占用 (#30314)
- 改进 DirtyHash 以支持 128 位整数 (#30320)
- 将整数列与浮点字面量进行比较,并将 dt.year() 与日期边界进行比较 (#30311)
- 当两侧均超过样本大小时,在半连接和反连接中使用行估计值 (#30307)
- 在不进行排序的情况下计算 describe() 的分位数 (#30244)
- 使用 van Herk 块扫描算法优化 rolling_min 和 rolling_max (#29445)
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力