Skip to content

Commit 3224539

Browse files
committed
[CALCITE-7352] Incorrect SqlLibrary enum value used in ClickHouse SQL test
1 parent 3d14332 commit 3224539

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import static org.apache.calcite.sql.fun.SqlLibrary.ALL;
6565
import static org.apache.calcite.sql.fun.SqlLibrary.BIG_QUERY;
6666
import static org.apache.calcite.sql.fun.SqlLibrary.CALCITE;
67+
import static org.apache.calcite.sql.fun.SqlLibrary.CLICKHOUSE;
6768
import static org.apache.calcite.sql.fun.SqlLibrary.HIVE;
6869
import static org.apache.calcite.sql.fun.SqlLibrary.MSSQL;
6970
import static org.apache.calcite.sql.fun.SqlLibrary.MYSQL;
@@ -424,7 +425,7 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding operatorBinding,
424425
OperandTypes.STRING_SAME_SAME);
425426

426427
/** The "ENDSWITH(value1, value2)" function (Snowflake). */
427-
@LibraryOperator(libraries = {SNOWFLAKE, SPARK})
428+
@LibraryOperator(libraries = {SNOWFLAKE, SPARK, CLICKHOUSE})
428429
public static final SqlFunction ENDSWITH = ENDS_WITH.withName("ENDSWITH");
429430

430431
/** The "STARTS_WITH(value1, value2)" function (BigQuery, PostgreSQL). */
@@ -434,7 +435,7 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding operatorBinding,
434435
OperandTypes.STRING_SAME_SAME);
435436

436437
/** The "STARTSWITH(value1, value2)" function (Snowflake). */
437-
@LibraryOperator(libraries = {SNOWFLAKE, SPARK})
438+
@LibraryOperator(libraries = {SNOWFLAKE, SPARK, CLICKHOUSE})
438439
public static final SqlFunction STARTSWITH = STARTS_WITH.withName("STARTSWITH");
439440

440441
/** BigQuery's "SUBSTR(string, position [, substringLength ])" function. */

core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8414,7 +8414,7 @@ private void checkLiteral2(String expression, String expected) {
84148414
sql(query).withLibrary(SqlLibrary.SNOWFLAKE).withPostgresql().ok(expectedPostgres);
84158415
sql(query).withLibrary(SqlLibrary.SNOWFLAKE).withSnowflake().ok(expectedSnowflake);
84168416
sql(query).withLibrary(SqlLibrary.SPARK).withSpark().ok(expectedSpark);
8417-
sql(query).withLibrary(SqlLibrary.SPARK).withClickHouse().ok(expectedClickHouse);
8417+
sql(query).withLibrary(SqlLibrary.CLICKHOUSE).withClickHouse().ok(expectedClickHouse);
84188418
}
84198419

84208420
/** Test case for
@@ -8463,7 +8463,7 @@ private void checkLiteral2(String expression, String expected) {
84638463
sql(query).withLibrary(SqlLibrary.SNOWFLAKE).withPostgresql().ok(expectedPostgres);
84648464
sql(query).withLibrary(SqlLibrary.SNOWFLAKE).withSnowflake().ok(expectedSnowflake);
84658465
sql(query).withLibrary(SqlLibrary.SPARK).withSpark().ok(expectedSpark);
8466-
sql(query).withLibrary(SqlLibrary.SPARK).withClickHouse().ok(expectedClickHouse);
8466+
sql(query).withLibrary(SqlLibrary.CLICKHOUSE).withClickHouse().ok(expectedClickHouse);
84678467
}
84688468

84698469
/** Test case for

site/_docs/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,7 +2920,7 @@ In the following:
29202920
| b | DATE_TRUNC(date, timeUnit) | Truncates *date* to the granularity of *timeUnit*, rounding to the beginning of the unit
29212921
| o r s h | DECODE(value, value1, result1 [, valueN, resultN ]* [, default ]) | Compares *value* to each *valueN* value one by one; if *value* is equal to a *valueN*, returns the corresponding *resultN*, else returns *default*, or NULL if *default* is not specified
29222922
| p r | DIFFERENCE(string, string) | Returns a measure of the similarity of two strings, namely the number of character positions that their `SOUNDEX` values have in common: 4 if the `SOUNDEX` values are same and 0 if the `SOUNDEX` values are totally different
2923-
| f s | ENDSWITH(string1, string2) | Returns whether *string2* is a suffix of *string1*
2923+
| f s i | ENDSWITH(string1, string2) | Returns whether *string2* is a suffix of *string1*
29242924
| b | ENDS_WITH(string1, string2) | Equivalent to `ENDSWITH(string1, string2)`
29252925
| s | EXISTS(array, func) | Returns whether a predicate *func* holds for one or more elements in the *array*
29262926
| o | EXISTSNODE(xml, xpath, [, namespaces ]) | Determines whether traversal of a XML document using a specified xpath results in any nodes. Returns 0 if no nodes remain after applying the XPath traversal on the document fragment of the element or elements matched by the XPath expression. Returns 1 if any nodes remain. The optional namespace value that specifies a default mapping or namespace mapping for prefixes, which is used when evaluating the XPath expression.
@@ -3041,7 +3041,7 @@ In the following:
30413041
| m s h | SPACE(integer) | Returns a string of *integer* spaces; returns an empty string if *integer* is less than 1
30423042
| b | SPLIT(string [, delimiter ]) | Returns the string array of *string* split at *delimiter* (if omitted, default is comma). If the *string* is empty it returns an empty array, otherwise, if the *delimiter* is empty, it returns an array containing the original *string*.
30433043
| p | SPLIT_PART(string, delimiter, n) | Returns the *n*th field in *string* using *delimiter*; returns empty string if *n* is less than 1 or greater than the number of fields, and the n can be negative to count from the end.
3044-
| f s | STARTSWITH(string1, string2) | Returns whether *string2* is a prefix of *string1*
3044+
| f s i | STARTSWITH(string1, string2) | Returns whether *string2* is a prefix of *string1*
30453045
| b p | STARTS_WITH(string1, string2) | Equivalent to `STARTSWITH(string1, string2)`
30463046
| m | STRCMP(string, string) | Returns 0 if both of the strings are same and returns -1 when the first argument is smaller than the second and 1 when the second one is smaller than the first one
30473047
| b r p | STRPOS(string, substring) | Equivalent to `POSITION(substring IN string)`

0 commit comments

Comments
 (0)