Skip to content

Commit

Permalink
[CALCITE-6483] Enable LEN and LENGTH in the correct function libraries
Browse files Browse the repository at this point in the history
Enabled the LEN function for:
* Amazon Redshift
* Snowflake
* Spark

Enabled the LENGTH function for:
* BigQuery
* Hive
* PostgreSQL
* Amazon Redshift
* Snowflake
* Spark
  • Loading branch information
normanj-bitquill authored and rubenada committed Jul 21, 2024
1 parent f47ca1c commit ed1f54f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ private static SqlCall transformConvert(SqlValidator validator, SqlCall call) {
public static final SqlFunction IFNULL = NVL.withName("IFNULL");

/** The "LEN(string)" function. */
@LibraryOperator(libraries = {SNOWFLAKE, SPARK})
@LibraryOperator(libraries = {REDSHIFT, SNOWFLAKE, SPARK})
public static final SqlFunction LEN =
SqlStdOperatorTable.CHAR_LENGTH.withName("LEN");

/** The "LENGTH(string)" function. */
@LibraryOperator(libraries = {BIG_QUERY, SNOWFLAKE, SPARK})
@LibraryOperator(libraries = {BIG_QUERY, HIVE, POSTGRESQL, SNOWFLAKE, SPARK})
public static final SqlFunction LENGTH =
SqlStdOperatorTable.CHAR_LENGTH.withName("LENGTH");

Expand Down
4 changes: 2 additions & 2 deletions site/_docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2804,8 +2804,8 @@ In the following:
| m | JSON_STORAGE_SIZE(jsonValue) | Returns the number of bytes used to store the binary representation of *jsonValue*
| b o p r s | LEAST(expr [, expr ]* ) | Returns the least of the expressions
| b m p r s | LEFT(string, length) | Returns the leftmost *length* characters from the *string*
| f s | LEN(string) | Equivalent to `CHAR_LENGTH(string)`
| b f s | LENGTH(string) | Equivalent to `CHAR_LENGTH(string)`
| f r s | LEN(string) | Equivalent to `CHAR_LENGTH(string)`
| b f h p r s | LENGTH(string) | Equivalent to `CHAR_LENGTH(string)`
| h s | LEVENSHTEIN(string1, string2) | Returns the Levenshtein distance between *string1* and *string2*
| b | LOG(numeric1 [, base ]) | Returns the logarithm of *numeric1* to base *base*, or base e if *base* is not present, or error if *numeric1* is 0 or negative
| m s | LOG([, base ], numeric1) | Returns the logarithm of *numeric1* to base *base*, or base e if *base* is not present, or null if *numeric1* is 0 or negative
Expand Down

0 comments on commit ed1f54f

Please sign in to comment.