Copilot commented on code in PR #2694:
URL: https://github.com/apache/doris-website/pull/2694#discussion_r2308952424


##########
versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/current-timestamp.md:
##########
@@ -18,25 +18,31 @@ CURRENT_TIMESTAMP([<precision>])
 
 ## Parameters
 
-| Parameter     | Description                                                  
                                                                                
                                                                                
                                                                                
                                                                                
               |
-|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| `<precision>` | Optional parameter specifying the precision of the 
fractional seconds part in the return value. The range is 0 to 6, and the 
default is 0 (no fractional seconds). <br/>Limited by the JDK implementation: 
if FE is built with JDK8, the precision supports up to milliseconds (3 
fractional digits), and higher precision digits will be filled with 0. If 
higher precision is required, please use JDK11. |
+| Parameter     | Description                                                  
                                                                                
|
+|---------------|----------------------------------------------------------------------------------------------------------------------------------------------|
+| `<precision>` | Optional parameter indicating the precision of the 
fractional seconds part of the return value, ranging from 0 to 6. Default is 0, 
which means no fractional seconds part is returned. <br/>Limited by JDK 
implementation, if users build FE with JDK8, precision is supported up to 
milliseconds (3 digits after decimal point), and higher precision digits will 
be filled with 0. If users need higher precision, please use JDK11. |
 
 ## Return Value
+- Returns the current system time as `DATETIME` type
+- If the specified `<precision>` is out of range (such as negative or greater 
than 6), the function will return an error.
 
-- Returns the current system time as a DATETIME type.
-- If the specified `<precision>` is out of range (e.g., negative or greater 
than 6), the function will return an error.
-
-## Example
+## Examples
 
 ```sql
+-- Return different scale
 select CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP(3),CURRENT_TIMESTAMP(6);
-```
 
-```text
 +---------------------+-------------------------+----------------------------+
 | now()               | now(3)                  | now(6)                     |
 +---------------------+-------------------------+----------------------------+
 | 2025-01-23 11:26:01 | 2025-01-23 11:26:01.771 | 2025-01-23 11:26:01.771000 |
 +---------------------+-------------------------+----------------------------+
+
+---Return NULL if input NULL

Review Comment:
   Missing article in the comment: should be '-- Return NULL if input is NULL' 
or '-- Returns NULL if input is NULL'.
   ```suggestion
   -- Return NULL if input is NULL
   ```



##########
versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md:
##########
@@ -7,107 +7,126 @@
 
 ## Description
 
-`date_ceil` rounds a given date to the next upper boundary of the specified 
time interval.
+The DATE_CEIL function is used to round up (ceil) a specified date or time 
value to the nearest start of a specified time interval period. That is, it 
returns the smallest periodic moment that is not less than the input date and 
time. The period rules are jointly defined by `period` (number of periods) and 
`type` (period unit), and all periods are calculated based on the fixed 
starting point 0001-01-01 00:00:00.
 
 ## Syntax
 
-`DATE_CEIL(<datetime>, INTERVAL <period> <type>)`
+`DATE_CEIL(<date_or_time_expr>, INTERVAL <period> <type>)`
 
 ## Parameters
 
 | Parameter | Description |
 | -- | -- |
-| `datetime` | The argument is a valid date expression |
-| `period` | The argument specifies how many units make up each period, with 
the start time being 0001-01-01T00:00:00 |
-| `type` | The argument can be: YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, 
SECOND|
-
-:::tip 
-QUARTER is supported since version 3.0.8 and 3.1.0.
-:::
+| `date_or_time_expr` | A valid date expression, supporting input of datetime 
or date type. For specific datetime and date formats, please refer to [cast to 
datetime](../../../../../../docs/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion)
 and [cast to 
date](../../../../../../docs/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion))|
+| `period` | Specifies the number of units each period consists of, of type 
INT. The starting time point is 0001-01-01T00:00:00 |
+| `type` | Can be: YEAR, Quarter, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND |
 
 ## Return Value
 
-The return value is a date or time, representing the result of rounding the 
input value up to the specified unit.
-
-## Examples
+Returns a date or time value representing the result of rounding up the input 
value to the specified unit.
+The rounded result is of the same type as datetime:
+- When input is DATE, returns DATE (only the date part, time defaults to 
00:00:00);
+- When input is DATETIME, returns DATETIME (including date and time).
+- For datetime with scale, the return value will also have scale.
 
-```sql
-select date_ceil("2023-07-13 22:28:18",interval 5 second);
-```
+Special cases:
+- Returns NULL if any parameter is NULL;
+- Returns an error if the rounded result exceeds the range supported by the 
date type (e.g., after '9999-12-31 23:59:59');
+- Throws an error if the period parameter is a non-positive integer.
 
-```text
-+--------------------------------------------------------------+
-| second_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
-+--------------------------------------------------------------+
-| 2023-07-13 22:28:20                                          |
-+--------------------------------------------------------------+
-```
+## Examples
 
 ```sql
+-- Round up seconds to the nearest 5-second interval
+mysql> select date_ceil(cast("2023-07-13 22:28:18" as datetime),interval 5 
second);
+
++------------------------------------------------------------------------+
+| date_ceil(cast("2023-07-13 22:28:18" as datetime),interval 5 second) |
++------------------------------------------------------------------------+
+| 2023-07-13 22:28:20.000000                                             |
++------------------------------------------------------------------------+
+
+-- Date time parameter with scale
+mysql> select date_ceil(cast("2023-07-13 22:28:18.123" as 
datetime(3)),interval 5 second);
++-----------------------------------------------------------------------------+
+| date_ceil(cast("2023-07-13 22:28:18.123" as datetime(3)),interval 5 second) |
++-----------------------------------------------------------------------------+
+| 2023-07-13 22:28:20.000                                                     |
++-----------------------------------------------------------------------------+
+
+-- Round up to the nearest 5-minute interval
 select date_ceil("2023-07-13 22:28:18",interval 5 minute);
 +--------------------------------------------------------------+
 | minute_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
 +--------------------------------------------------------------+
 | 2023-07-13 22:30:00                                          |
 +--------------------------------------------------------------+
-```
 
-```sql
+-- Round up to the nearest 5-week interval
+select date_ceil("2023-07-13 22:28:18",interval 5 WEEK);
++--------------------------------------------------+
+| date_ceil("2023-07-13 22:28:18",interval 5 WEEK) |
++--------------------------------------------------+
+| 2023-08-14 00:00:00                              |
++--------------------------------------------------+
+
+-- Round up to the nearest 5-hour interval
 select date_ceil("2023-07-13 22:28:18",interval 5 hour);
-```
 
-```text
-+------------------------------------------------------------+
-| hour_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
-+------------------------------------------------------------+
-| 2023-07-13 23:00:00                                        |
-+------------------------------------------------------------+
-```
++--------------------------------------------------+
+| date_ceil("2023-07-13 22:28:18",interval 5 hour) |
++--------------------------------------------------+
+| 2023-07-13 23:00:00                   |
++--------------------------------------------------+
 
-```sql
+-- Round up to the nearest 5-day interval
 select date_ceil("2023-07-13 22:28:18",interval 5 day);
-```
 
-```text
 +-----------------------------------------------------------+
 | day_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
 +-----------------------------------------------------------+
 | 2023-07-15 00:00:00                                       |
 +-----------------------------------------------------------+
-```
 
-```sql
+-- Round up to the nearest 5-month interval
 select date_ceil("2023-07-13 22:28:18",interval 5 month);
-```
 
-```text
 +-------------------------------------------------------------+
 | month_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
 +-------------------------------------------------------------+
 | 2023-12-01 00:00:00                                         |
 +-------------------------------------------------------------+
-```
 
-```sql
-select date_ceil("2023-07-13 22:28:18",interval 5 quarter);
-```
-
-```text
-+-----------------------------------------------------+
-| date_ceil("2023-07-13 22:28:18",interval 5 quarter) |
-+-----------------------------------------------------+
-| 2024-10-01 00:00:00                                 |
-+-----------------------------------------------------+
-```
 
-```sql
+-- Round up to the nearest 5-year interval
 select date_ceil("2023-07-13 22:28:18",interval 5 year);
-```
 
-```text
-+------------------------------------------------------------+
-| year_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
-+------------------------------------------------------------+
-| 2026-01-01 00:00:00                                        |
-+------------------------------------------------------------+
-```
\ No newline at end of file
++-------------------------------------------------------------+
+| month_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
++-------------------------------------------------------------+
+| 2023-12-01 00:00:00                                         |
++-------------------------------------------------------------+
+
+-- Exceeds the maximum year
+mysql> select date_ceil("9999-07-13",interval 5 year);
+ERROR 1105 (HY000): errCode = 2, detailMessage = (10.16.10.3)[E-218]Operation 
year_ceil of 9999-07-13 00:00:00, 5 out of range
+
+-- Any parameter is NULL
+mysql> select date_ceil("9900-07-13",interval NULL year);
++--------------------------------------------+
+| date_ceil("9900-07-13",interval NULL year) |
++--------------------------------------------+
+| NULL                                       |
++--------------------------------------------+
+
+mysql> select date_ceil(NULL,interval 5 year);
++---------------------------------+
+| date_ceil(NULL,interval 5 year) |
++---------------------------------+
+| NULL                            |
++---------------------------------+
+
+-- Invalid parameter, period is negative
+mysql> select date_ceil("2023-01-13 22:28:18",interval -5 month);
+ERROR 1105 (HY000): errCode = 2, detailMessage = 
(10.16.10.3)[INVALID_ARGUMENT]Operation month_ceil of 2023-01-13 22:28:18, -5 
input wrong parameters, period can`t be negative or zero

Review Comment:
   The word 'can`t' should use an apostrophe instead of a backtick: 'can't'.
   ```suggestion
   ERROR 1105 (HY000): errCode = 2, detailMessage = 
(10.16.10.3)[INVALID_ARGUMENT]Operation month_ceil of 2023-01-13 22:28:18, -5 
input wrong parameters, period can't be negative or zero
   ```



##########
versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/date-time-functions/date-ceil.md:
##########
@@ -7,91 +7,125 @@
 
 ## Description
 
-`date_ceil` rounds a given date to the next upper boundary of the specified 
time interval.
+The DATE_CEIL function is used to round up (ceil) a specified date or time 
value to the nearest start of a specified time interval period. That is, it 
returns the smallest periodic moment that is not less than the input date and 
time. The period rules are jointly defined by `period` (number of periods) and 
`type` (period unit), and all periods are calculated based on the fixed 
starting point 0001-01-01 00:00:00.
 
 ## Syntax
 
-`DATE_CEIL(<datetime>, INTERVAL <period> <type>)`
+`DATE_CEIL(<date_or_time_expr>, INTERVAL <period> <type>)`
 
 ## Parameters
 
 | Parameter | Description |
 | -- | -- |
-| `datetime` | The argument is a valid date expression |
-| `period` | The argument specifies how many units make up each period, with 
the start time being 0001-01-01T00:00:00 |
-| `type` | The argument can be: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND|
+| `date_or_time_expr` | A valid date expression, supporting input of datetime 
or date type. For specific datetime and date formats, please refer to [cast to 
datetime](../../../../../../docs/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion)
 and [cast to 
date](../../../../../../docs/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion))|
+| `period` | Specifies the number of units each period consists of, of type 
INT. The starting time point is 0001-01-01T00:00:00 |
+| `type` | Can be: YEAR, Quarter, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND |
 
 ## Return Value
 
-The return value is a date or time, representing the result of rounding the 
input value up to the specified unit.
+Returns a date or time value representing the result of rounding up the input 
value to the specified unit.
+The rounded result is of the same type as datetime:
+- When input is DATE, returns DATE (only the date part, time defaults to 
00:00:00);
+- When input is DATETIME, returns DATETIME (including date and time).
+- For datetime with scale, the return value will also have scale.
 
-## Examples
-
-```sql
-select date_ceil("2023-07-13 22:28:18",interval 5 second);
-```
+Special cases:
+- Returns NULL if any parameter is NULL;
+- Returns an error if the rounded result exceeds the range supported by the 
date type (e.g., after '9999-12-31 23:59:59');
+- Throws an error if the period parameter is a non-positive integer.
 
-```text
-+--------------------------------------------------------------+
-| second_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
-+--------------------------------------------------------------+
-| 2023-07-13 22:28:20                                          |
-+--------------------------------------------------------------+
-```
+## Examples
 
 ```sql
+-- Round up seconds to the nearest 5-second interval
+mysql> select date_ceil(cast("2023-07-13 22:28:18" as datetime),interval 5 
second);
+
++------------------------------------------------------------------------+
+| date_ceil(cast("2023-07-13 22:28:18" as datetime),interval 5 second) |
++------------------------------------------------------------------------+
+| 2023-07-13 22:28:20.000000                                             |
++------------------------------------------------------------------------+
+
+-- Date time parameter with scale
+mysql> select date_ceil(cast("2023-07-13 22:28:18.123" as 
datetime(3)),interval 5 second);
++-----------------------------------------------------------------------------+
+| date_ceil(cast("2023-07-13 22:28:18.123" as datetime(3)),interval 5 second) |
++-----------------------------------------------------------------------------+
+| 2023-07-13 22:28:20.000                                                     |
++-----------------------------------------------------------------------------+
+
+-- Round up to the nearest 5-minute interval
 select date_ceil("2023-07-13 22:28:18",interval 5 minute);
 +--------------------------------------------------------------+
 | minute_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
 +--------------------------------------------------------------+
 | 2023-07-13 22:30:00                                          |
 +--------------------------------------------------------------+
-```
 
-```sql
+-- Round up to the nearest 5-week interval
+select date_ceil("2023-07-13 22:28:18",interval 5 WEEK);
++--------------------------------------------------+
+| date_ceil("2023-07-13 22:28:18",interval 5 WEEK) |
++--------------------------------------------------+
+| 2023-08-14 00:00:00                              |
++--------------------------------------------------+
+
+-- Round up to the nearest 5-hour interval
 select date_ceil("2023-07-13 22:28:18",interval 5 hour);
-```
 
-```text
-+------------------------------------------------------------+
-| hour_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
-+------------------------------------------------------------+
-| 2023-07-13 23:00:00                                        |
-+------------------------------------------------------------+
-```
++--------------------------------------------------+
+| date_ceil("2023-07-13 22:28:18",interval 5 hour) |
++--------------------------------------------------+
+| 2023-07-13 23:00:00                   |
++--------------------------------------------------+
 
-```sql
+-- Round up to the nearest 5-day interval
 select date_ceil("2023-07-13 22:28:18",interval 5 day);
-```
 
-```text
 +-----------------------------------------------------------+
 | day_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
 +-----------------------------------------------------------+
 | 2023-07-15 00:00:00                                       |
 +-----------------------------------------------------------+
-```
 
-```sql
+-- Round up to the nearest 5-month interval
 select date_ceil("2023-07-13 22:28:18",interval 5 month);
-```
 
-```text
 +-------------------------------------------------------------+
 | month_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
 +-------------------------------------------------------------+
 | 2023-12-01 00:00:00                                         |
 +-------------------------------------------------------------+
-```
 
-```sql
+-- Round up to the nearest 5-year interval
 select date_ceil("2023-07-13 22:28:18",interval 5 year);
-```
 
-```text
-+------------------------------------------------------------+
-| year_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
-+------------------------------------------------------------+
-| 2026-01-01 00:00:00                                        |
-+------------------------------------------------------------+
-```
\ No newline at end of file
++-------------------------------------------------------------+
+| month_ceil('2023-07-13 22:28:18', 5, '0001-01-01 00:00:00') |
++-------------------------------------------------------------+
+| 2023-12-01 00:00:00                                         |
++-------------------------------------------------------------+
+
+-- Exceeds the maximum year
+mysql> select date_ceil("9999-07-13",interval 5 year);
+ERROR 1105 (HY000): errCode = 2, detailMessage = (10.16.10.3)[E-218]Operation 
year_ceil of 9999-07-13 00:00:00, 5 out of range
+
+-- Any parameter is NULL
+mysql> select date_ceil("9900-07-13",interval NULL year);
++--------------------------------------------+
+| date_ceil("9900-07-13",interval NULL year) |
++--------------------------------------------+
+| NULL                                       |
++--------------------------------------------+
+
+mysql> select date_ceil(NULL,interval 5 year);
++---------------------------------+
+| date_ceil(NULL,interval 5 year) |
++---------------------------------+
+| NULL                            |
++---------------------------------+
+
+-- Invalid parameter, period is negative
+mysql> select date_ceil("2023-01-13 22:28:18",interval -5 month);
+ERROR 1105 (HY000): errCode = 2, detailMessage = 
(10.16.10.3)[INVALID_ARGUMENT]Operation month_ceil of 2023-01-13 22:28:18, -5 
input wrong parameters, period can`t be negative or zero

Review Comment:
   The word 'can`t' should use an apostrophe instead of a backtick: 'can't'.
   ```suggestion
   ERROR 1105 (HY000): errCode = 2, detailMessage = 
(10.16.10.3)[INVALID_ARGUMENT]Operation month_ceil of 2023-01-13 22:28:18, -5 
input wrong parameters, period can't be negative or zero
   ```



-- 
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]

Reply via email to