You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by dm...@apache.org on 2023/04/06 08:45:28 UTC
[calcite] 01/01: [CALCITE-5634] Add LEAST, GREATEST for PostgreSQL
This is an automated email from the ASF dual-hosted git repository.
dmsysolyatin pushed a commit to branch feature/CALCITE-5634
in repository https://gitbox.apache.org/repos/asf/calcite.git
commit 78d0943238fd5c98abb70f6196dd6c250b4f2794
Author: dssysolyatin <dm...@gmail.com>
AuthorDate: Thu Apr 6 11:45:01 2023 +0300
[CALCITE-5634] Add LEAST, GREATEST for PostgreSQL
---
.../src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java | 4 ++--
site/_docs/reference.md | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java b/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java
index af3aa62f27..3a44e46836 100644
--- a/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java
+++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java
@@ -383,14 +383,14 @@ public abstract class SqlLibraryOperators {
SUBSTR.withKind(SqlKind.SUBSTR_POSTGRESQL);
/** The "GREATEST(value, value)" function. */
- @LibraryOperator(libraries = {BIG_QUERY, ORACLE})
+ @LibraryOperator(libraries = {BIG_QUERY, ORACLE, POSTGRESQL})
public static final SqlFunction GREATEST =
SqlBasicFunction.create(SqlKind.GREATEST,
ReturnTypes.LEAST_RESTRICTIVE.andThen(SqlTypeTransforms.TO_NULLABLE),
OperandTypes.SAME_VARIADIC);
/** The "LEAST(value, value)" function. */
- @LibraryOperator(libraries = {BIG_QUERY, ORACLE})
+ @LibraryOperator(libraries = {BIG_QUERY, ORACLE, POSTGRESQL})
public static final SqlFunction LEAST =
SqlBasicFunction.create(SqlKind.LEAST,
ReturnTypes.LEAST_RESTRICTIVE.andThen(SqlTypeTransforms.TO_NULLABLE),
diff --git a/site/_docs/reference.md b/site/_docs/reference.md
index c1a441db80..ddbba3dfc7 100644
--- a/site/_docs/reference.md
+++ b/site/_docs/reference.md
@@ -2688,7 +2688,7 @@ BigQuery's type system uses confusingly different names for types and functions:
| b | FORMAT_DATETIME(string, timestamp) | Formats *timestamp* according to the specified format *string*
| b | FORMAT_TIME(string, time) | Formats *time* according to the specified format *string*
| b | FORMAT_TIMESTAMP(string timestamp) | Formats *timestamp* according to the specified format *string*
-| b o | GREATEST(expr [, expr ]*) | Returns the greatest of the expressions
+| b o p | GREATEST(expr [, expr ]*) | Returns the greatest of the expressions
| b h s | IF(condition, value1, value2) | Returns *value1* if *condition* is TRUE, *value2* otherwise
| b | IFNULL(value1, value2) | Equivalent to `NVL(value1, value2)`
| p | string1 ILIKE string2 [ ESCAPE string3 ] | Whether *string1* matches pattern *string2*, ignoring case (similar to `LIKE`)
@@ -2703,7 +2703,7 @@ BigQuery's type system uses confusingly different names for types and functions:
| m | JSON_REPLACE(jsonValue, path, val[, path, val]*) | Returns a JSON document replace a data of *jsonValue*, *path*, *val*
| m | JSON_SET(jsonValue, path, val[, path, val]*) | Returns a JSON document set a data of *jsonValue*, *path*, *val*
| m | JSON_STORAGE_SIZE(jsonValue) | Returns the number of bytes used to store the binary representation of *jsonValue*
-| b o | LEAST(expr [, expr ]* ) | Returns the least of the expressions
+| b o p | LEAST(expr [, expr ]* ) | Returns the least of the expressions
| b m p | LEFT(string, length) | Returns the leftmost *length* characters from the *string*
| b | LENGTH(string) | Equivalent to `CHAR_LENGTH(string)`
| b o | LPAD(string, length[, pattern ]) | Returns a string or bytes value that consists of *string* prepended to *length* with *pattern*