zclllyybb commented on code in PR #2804:
URL: https://github.com/apache/doris-website/pull/2804#discussion_r2374701422
##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/day-floor.md:
##########
@@ -7,39 +7,118 @@
## 描述
-将日期转化为指定的时间间隔周期的最近向下取整时刻。
+DAY_FLOOR 函数用于将指定的日期或时间值向下取整(floor)到最近的指定天数周期的起点。即返回不大于输入日期时间的最大周期时刻,周期规则由
period(周期天数)和 origin(起始基准时间)共同定义。若未指定起始基准时间,默认以 0001-01-01 00:00:00 为基准计算。
+
+日期时间的计算公式
+$
+\text{DAY\_FLOOR}(\langle\text{date\_or\_time\_expr}\rangle,
\langle\text{period}\rangle, \langle\text{origin}\rangle) =
\max\{\langle\text{origin}\rangle + k \times \langle\text{period}\rangle \times
\text{day} \mid k \in \mathbb{Z} \land \langle\text{origin}\rangle + k \times
\langle\text{period}\rangle \times \text{day} \leq
\langle\text{date\_or\_time\_expr}\rangle\}
+$
+K 代表的是基准时间到目标时间的周期数
## 语法
```sql
-DAY_FLOOR(<datetime>)
-DAY_FLOOR(<datetime>, <origin>)
-DAY_FLOOR(<datetime>, <period>)
-DAY_FLOOR(<datetime>, <period>, <origin>)
+DAY_FLOOR(<date_or_time_expr>)
+DAY_FLOOR(<date_or_time_expr>, <origin>)
+DAY_FLOOR(<date_or_time_expr>, <period>)
+DAY_FLOOR(<date_or_time_expr>, <period>, <origin>)
```
## 参数
| 参数 | 说明 |
| -- | -- |
-| `<datetime>` | 合法的日期表达式 |
-| `<period>` | 参数是指定每个周期有多少天组成 |
-| `<origin>` | 开始的时间起点,如果不填,默认是 0001-01-01T00:00:00 |
+| `<date_or_time_expr>` | 参数是合法的日期表达式,支持输入 date/datetime 类型,具体 datetime 和 date
格式请查看 [datetime
的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion)
和 [date
的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/date-conversion)
|
+| `<period>` | 参数是指定每个周期包含的天数,类型为 INT。若为负数或 0,返回 NULL;若未指定,默认周期为 1 天。 |
+| `<origin>` | 参数是周期计算的起始基准时间,支持 date/datetime 类型。若未指定,默认值为 0001-01-01
00:00:00;若输入无效格式,返回 NULL。 |
## 返回值
-返回最近向下取整时刻的日期。
+返回的是一个日期或时间值,表示将输入值向下舍入到指定天数周期的结果。
+
+若输入有效,返回与 datetime 类型一致的取整结果:
+
+`<date_or_time_expr>` 与 `<origin>` 输入都 DATE 类型时,返回 DATE 类型, 否则返回 DATETIME 类型.
+
+
+特殊情况:
+
+- 任何参数为 NULL 时,返回 NULL;
+- 若 period 为负数或 0,返回错误
+- 带有 scale 输入的符合日期时间,返回值带有 scale 且全部小数为 0
Review Comment:
这个就是正确的。所有相关的文档,得保证相同的描述一致
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]