TO_MONTHS(Lakehouse v1)
将指定数量的个月转换为 Interval 类型。
- 接受正整数、零和负整数作为输入。
Analyze 语法
Section titled “Analyze 语法”func.to_months(<months>)Analyze 示例
Section titled “Analyze 示例”func.to_months(2)┌──────────────────────────────────────────────────────┐│ func.to_months(2) │├──────────────────────────────────────────────────────┤│ 2 months │└──────────────────────────────────────────────────────┘SQL 语法
Section titled “SQL 语法”TO_MONTHS(<months>)Interval(以月表示)。
SQL 示例
Section titled “SQL 示例”SELECT TO_MONTHS(2), TO_MONTHS(0), TO_MONTHS((- 2));
┌──────────────────────────────────────────────┐│ to_months(2) │ to_months(0) │ to_months(- 2) │├──────────────┼──────────────┼────────────────┤│ 2 months │ 00:00:00 │ -2 months │└──────────────────────────────────────────────┘