Skip to content

Conversation

@0xhhh321321
Copy link

@0xhhh321321 0xhhh321321 commented Jan 24, 2026

  1. over_null=partition_by/order_by 时,依赖列集合为空会生成非法 .over(...) 语法(例如 .over(, ASSET, ...))。现在在条件为空时退化为不带该条件,避免语法错误。
  2. ts_* 打印时区分参数槽位:
  • 序列参数(x / x,y / …)必须是 pl.Expr:数值常量/纯数字子表达式会提升为 pl.lit(...)。
  • 窗口/标量参数(d/ddof/…)保持 Python 标量,避免 Expr 布尔判断等问题。
  1. 常量逐元素/条件函数(如 sign/abs/log/min/max/clip/if_else 等)在全常量输入时直接折叠为 pl.lit(...),避免生成 sign(0) 这类运行期调用返回 numpy 标量,触发 Polars Lazy 推断报错(UDF called without return type)。

@0xhhh321321 0xhhh321321 changed the title Fix polars codegen for constants and empty over_null mask 修复 Polars 代码生成:避免空 over_null 条件导致语法错误,并修正 ts_* 数值参数打印(窗口参数保留为标量) Jan 24, 2026
@0xhhh321321 0xhhh321321 changed the title 修复 Polars 代码生成:避免空 over_null 条件导致语法错误,并修正 ts_* 数值参数打印(窗口参数保留为标量) 避免空 over_null 条件语法错误;ts_* 参数打印区分“序列参数 vs 窗口参数”,并提升纯数字子表达式为 pl.lit Jan 24, 2026
@0xhhh321321 0xhhh321321 changed the title 避免空 over_null 条件语法错误;ts_* 参数打印区分“序列参数 vs 窗口参数”,并提升纯数字子表达式为 pl.lit 修复 Polars 代码生成:over_null 语法 + 常量函数/参数 pl.lit Jan 25, 2026
@wukan1986
Copy link
Owner

请问,能提供一些表达式给我测试一下吗?

建议这3个问题拆分成3个pr。谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants