deemoliu commented on code in PR #12437: URL: https://github.com/apache/pinot/pull/12437#discussion_r1515186487
########## pinot-common/src/main/java/org/apache/pinot/common/function/scalar/StringFunctions.java: ########## @@ -597,6 +596,39 @@ public static String splitPart(String input, String delimiter, int index) { } } + /** + * @param input the input String to be split into parts. + * @param delimiter the specified delimiter to split the input string. + * @param index the specified index for the splitted parts to be returned. + * @param max the max count of parts that the input string can be splitted into. + * @return splits string on the delimiter with the limit count and returns String at specified index from the split. + */ + @ScalarFunction + public static String splitPart(String input, String delimiter, int index, int max) { + String[] splitString = StringUtils.splitByWholeSeparator(input, delimiter, max); + if (index < splitString.length) { + return splitString[index]; + } else { + return "null"; + } + } + + /** + * @param input the input String to be split into parts. + * @param delimiter the specified delimiter to split the input string. + * @param index the specified index for the splitted parts to be returned. + * @return splits string on the delimiter with the limit count and returns String at specified index from the split. + */ + @ScalarFunction + public static String splitPartFromEnd(String input, String delimiter, int index) { Review Comment: i see. that's a good idea. let me take a look, thanks -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org