Skip to content

Commit

Permalink
Make argument name more concise
Browse files Browse the repository at this point in the history
  • Loading branch information
herunkang2018 committed Oct 28, 2023
1 parent af7cf24 commit f01dbfe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1078,12 +1078,17 @@ public static int levenshtein(String string1, String string2) {
return LEVENSHTEIN_DISTANCE.apply(string1, string2);
}

/** SQL FIND_IN_SET(string, stringArray) function.
* Returns the index (1-based) of the given string
* in the comma-delimited list stringArray. Returns 0,
* if the string was not found or if the given string
/** SQL FIND_IN_SET(matchStr, textStr) function.
* Returns the index (1-based) of the given matchStr
* in the comma-delimited list textStr. Returns 0,
* if the matchStr is not found or if the matchStr
* contains a comma. */
public static int findInSet(String matchStr, String textStr) {
public static @Nullable Integer findInSet(
@Nullable String matchStr,
@Nullable String textStr) {
if (matchStr == null || textStr == null) {
return null;
}
if (matchStr.contains(String.valueOf(COMMA_DELIMITER))) {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding operatorBinding,
OperandTypes.STRING_STRING_OPTIONAL_STRING,
SqlFunctionCategory.STRING);

/** The "FIND_IN_SET(string, stringArray)" function. */
/** The "FIND_IN_SET(matchStr, textStr)" function. */
@LibraryOperator(libraries = {HIVE, SPARK})
public static final SqlFunction FIND_IN_SET =
SqlBasicFunction.create("FIND_IN_SET",
Expand Down
2 changes: 1 addition & 1 deletion site/_docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,7 @@ BigQuery's type system uses confusingly different names for types and functions:
| o | EXTRACT(xml, xpath, [, namespaces ]) | Returns the XML fragment of the element or elements matched by the XPath expression. The optional namespace value that specifies a default mapping or namespace mapping for prefixes, which is used when evaluating the XPath expression
| 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.
| m | EXTRACTVALUE(xml, xpathExpr)) | Returns the text of the first text node which is a child of the element or elements matched by the XPath expression.
| h s | FIND_IN_SET(string, stringArray) | Returns the index (1-based) of the given *string* in the comma-delimited *stringArray*. Returns 0, if the given *string* was not found or if *string* contains a comma. For example, FIND_IN_SET('bc', 'a,bc,def') returns 2
| h s | FIND_IN_SET(matchStr, textStr) | Returns the index (1-based) of the given *matchStr* in the comma-delimited *textStr*. Returns 0, if the given *matchStr* is not found or if the *matchStr* contains a comma. For example, FIND_IN_SET('bc', 'a,bc,def') returns 2
| b | FLOOR(value) | Similar to standard `FLOOR(value)` except if *value* is an integer type, the return type is a double
| b | FORMAT_DATE(string, date) | Formats *date* according to the specified format *string*
| b | FORMAT_DATETIME(string, timestamp) | Formats *timestamp* according to the specified format *string*
Expand Down

0 comments on commit f01dbfe

Please sign in to comment.