Copilot commented on code in PR #17642:
URL: https://github.com/apache/pinot/pull/17642#discussion_r2831424551
##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/StringFunctions.java:
##########
@@ -73,6 +73,40 @@ public static String upper(String input) {
return input.toUpperCase();
}
+ /**
+ * Converts the first letter of each word to uppercase and the rest to
lowercase.
+ * Words are delimited by whitespace characters.
+ * This is a standard SQL function for title case conversion.
+ *
+ * @param input the input string to convert
+ * @return string with the first letter of each word capitalized and the
rest in lowercase
+ */
+ @ScalarFunction
+ public static String initcap(String input) {
+ if (input == null || input.isEmpty()) {
+ return input;
+ }
+
Review Comment:
The null check is inconsistent with other string functions in this class
(e.g., `lower()`, `upper()`, `trim()`, `concat()`). According to the codebase
conventions, methods and parameters are non-null by default unless annotated
with `@Nullable`. Consider removing the null check to maintain consistency. The
`isEmpty()` check provides a minor optimization but is not strictly necessary
since the loop would handle empty strings correctly.
```suggestion
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]