xuzifu666 commented on code in PR #4314:
URL: https://github.com/apache/calcite/pull/4314#discussion_r2051621394


##########
site/_docs/reference.md:
##########
@@ -2876,7 +2878,7 @@ In the following:
 | b | DATE_TRUNC(date, timeUnit)                     | Truncates *date* to the 
granularity of *timeUnit*, rounding to the beginning of the unit
 | 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
 | 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
-| f s | ENDSWITH(string1, string2)                   | Returns whether 
*string2* is a suffix of *string1*
+| f s i | ENDSWITH(string1, string2)                 | Returns whether 
*string2* is a suffix of *string1*

Review Comment:
   @NobiGo startswiths/endswith functions are not standard scalar functions, I 
remove the annotation in SQL Library Operators and test:
   ```
   final String query = "select startswith(\"brand_name\", 'a')\n"
           + "from \"product\"";
   
sql(query).withLibrary(SqlLibrary.CLICKHOUSE).withClickHouse().ok(expectedClickHouse);
   ```
   it would error out(this is the reason I add the annotation):
   ```
   org.apache.calcite.runtime.CalciteContextException: From line 1, column 8 to 
line 1, column 36: No match found for function signature 
STARTSWITH(<CHARACTER>, <CHARACTER>)
   org.apache.calcite.tools.ValidationException: 
org.apache.calcite.runtime.CalciteContextException: From line 1, column 8 to 
line 1, column 36: No match found for function signature 
STARTSWITH(<CHARACTER>, <CHARACTER>)
        at org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:228)
        at 
org.apache.calcite.rel.rel2sql.RelToSqlConverterTest$Sql.exec(RelToSqlConverterTest.java:10173)
        at 
org.apache.calcite.rel.rel2sql.RelToSqlConverterTest$Sql.ok(RelToSqlConverterTest.java:10139)
        at 
org.apache.calcite.rel.rel2sql.RelToSqlConverterTest.testStartsWith(RelToSqlConverterTest.java:7741)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to