Skip to content

Commit

Permalink
Added EXTRACT(<time unit> FROM <date/datetime/time col) as pruning fu…
Browse files Browse the repository at this point in the history
…nction
  • Loading branch information
mjonss committed Aug 4, 2024
1 parent c660771 commit e3bedaf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions partition-pruning.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ If the `fn` function is monotonous, for any `x` and `y`, if `x > y`, then `fn(x)

* [`UNIX_TIMESTAMP()`](/functions-and-operators/date-and-time-functions.md)
* [`TO_DAYS()`](/functions-and-operators/date-and-time-functions.md)
* [`EXTRACT(<time unit> FROM <DATETIME/DATE/TIME column>)`](/functions-and-operators/date-and-time-functions.md); For DATE and DATETIME columns YEAR, and YEAR_MONTH time units are considered monotonous functions, and for TIME columns HOUR, HOUR_MINUTE, HOUR_SECOND and HOUR_MICROSECOND are considered monotonous. Also note that WEEK is not supported as time unit in EXTRACT for partition pruning.

For example, partition pruning takes effect when the partition expression is in the form of `fn(col)`, where the `fn` is monotonous function `to_days`:

Expand Down
1 change: 1 addition & 0 deletions partitioned-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,7 @@ Currently, partition pruning does not work with `LIKE` conditions.

* [`UNIX_TIMESTAMP()`](/functions-and-operators/date-and-time-functions.md)
* [`TO_DAYS()`](/functions-and-operators/date-and-time-functions.md)
* [`EXTRACT(<time unit> FROM <DATETIME/DATE/TIME column>)`](/functions-and-operators/date-and-time-functions.md); For DATE and DATETIME columns YEAR, and YEAR_MONTH time units are considered monotonous functions, and for TIME columns HOUR, HOUR_MINUTE, HOUR_SECOND and HOUR_MICROSECOND are considered monotonous. Also note that WEEK is not supported as time unit in EXTRACT for partition pruning.

For example, the partition expression is a simple column:

Expand Down

0 comments on commit e3bedaf

Please sign in to comment.