From 247521efc154d54b6241660700c768a0d202260c Mon Sep 17 00:00:00 2001 From: simo <48942089+wangsimo0@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:13:19 +0800 Subject: [PATCH] [Doc]Update create_partitioned_materialized_view.md (#50603) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: simo <48942089+wangsimo0@users.noreply.github.com> Signed-off-by: 絵空事スピリット Co-authored-by: 絵空事スピリット (cherry picked from commit 10f0f68cc2278b01ad9f36ae5762a305ffaaaf6e) --- .../materialized_view/CREATE_MATERIALIZED_VIEW.md | 2 +- .../create_partitioned_materialized_view.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/en/sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.md b/docs/en/sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.md index 12a23610d1555..2bf39b6cbba5d 100644 --- a/docs/en/sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.md +++ b/docs/en/sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.md @@ -242,7 +242,7 @@ Valid values: - `column_name`: The name of the column used for partitioning. The expression `PARTITION BY dt` means to partition the materialized view according to the `dt` column. - `date_trunc` function: The function used to truncate the time unit. `PARTITION BY date_trunc("MONTH", dt)` means that the `dt` column is truncated to month as the unit for partitioning. The `date_trunc` function supports truncating time to units including `YEAR`, `MONTH`, `DAY`, `HOUR`, and `MINUTE`. - `str2date` function: The function used to partition string type parititions of base table into materialized view's partition. `PARTITION BY str2date(dt, "%Y%m%d")` means that the `dt` column is a string date type whose date format is `"%Y%m%d"`. The `str2date` function supports a lot of date formats, you can refer to [str2date](../../sql-functions/date-time-functions/str2date.md) for more information. Supported from v3.1.4. -- `time_slice` or `date_slice` functions: From v3.1 onwards, you can further use these functions to convert the given time into the beginning or end of a time interval based on the specified time granularity, for example, `PARTITION BY date_trunc("MONTH", time_slice(dt, INTERVAL 7 DAY))` where time_slice and date_slice must have a finer granularity than date_trunc. You can use them to specify a GROUP BY column with a finer granularity than that of the partitioning key, for example, `GROUP BY time_slice(dt, INTERVAL 1 MINUTE) PARTITION BY date_trunc('DAY', ts)`. +- `time_slice` function: From v3.1 onwards, you can further use these functions to convert the given time into the beginning or end of a time interval based on the specified time granularity, for example, `PARTITION BY date_trunc("MONTH", time_slice(dt, INTERVAL 7 DAY))` where time_slice must have a finer granularity than date_trunc. You can use them to specify a GROUP BY column with a finer granularity than that of the partitioning key, for example, `GROUP BY time_slice(dt, INTERVAL 1 MINUTE) PARTITION BY date_trunc('DAY', ts)`. If this parameter is not specified, no partitioning strategy is adopted by default. diff --git a/docs/en/using_starrocks/create_partitioned_materialized_view.md b/docs/en/using_starrocks/create_partitioned_materialized_view.md index 7ee9bad91d83f..e9cf9458dd896 100644 --- a/docs/en/using_starrocks/create_partitioned_materialized_view.md +++ b/docs/en/using_starrocks/create_partitioned_materialized_view.md @@ -197,17 +197,17 @@ You can create a materialized view whose partitioning granularity is larger than ### Align partitions at a customized time granularity -The partition rollup method mentioned above only allows partitioning the materialized view based on specific time granularities and does not permit customizing the partition time range. If your business scenario requires partitioning using a customized time granularity, you can create a materialized view and define the time granularity for its partitions by using the date_trunc function with the [time_slice](../sql-reference/sql-functions/date-time-functions/time_slice.md) or [date_slice](../sql-reference/sql-functions/date-time-functions/date_slice.md) function, which can convert a given time into the beginning or end of a time interval based on the specified time granularity. +The partition rollup method mentioned above only allows partitioning the materialized view based on specific time granularities and does not permit customizing the partition time range. If your business scenario requires partitioning using a customized time granularity, you can create a materialized view and define the time granularity for its partitions by using the date_trunc function with the [time_slice](../sql-reference/sql-functions/date-time-functions/time_slice.md) function, which can convert a given time into the beginning or end of a time interval based on the specified time granularity. -You need to define the new time granularity (interval) by using the time_slice or date_slice function on the Partitioning Key of the base table in the SELECT list, set an alias for it, and use it in the date_trunc function to specify the Partitioning Key of the materialized view. +You need to define the new time granularity (interval) by using the time_slice function on the Partitioning Key of the base table in the SELECT list, set an alias for it, and use it in the date_trunc function to specify the Partitioning Key of the materialized view. ```SQL PARTITION BY date_trunc(, ) AS SELECT - -- You can use time_slice or date_slice. - date_slice(, ) AS + -- You can use time_slice. + time_slice(, ) AS ``` Example: