You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "dalongliu (Jira)" <ji...@apache.org> on 2022/03/31 06:41:00 UTC

[jira] [Created] (FLINK-26940) Add SUBSTRING_INDEX supported in SQL & Table API

dalongliu created FLINK-26940:
---------------------------------

             Summary: Add SUBSTRING_INDEX supported in SQL & Table API
                 Key: FLINK-26940
                 URL: https://issues.apache.org/jira/browse/FLINK-26940
             Project: Flink
          Issue Type: Sub-task
          Components: Table SQL / API
            Reporter: dalongliu
             Fix For: 1.16.0


Returns the substring of {{expr}} before {{count}} occurrences of the delimiter {{{}delim{}}}.

Syntax:
{code:java}
substring_index(expr, delim, count){code}
Arguments:
 * {{{}expr{}}}: A STRING or BINARY expression.

 * {{{}delim{}}}: An expression matching the type of {{expr}} specifying the delimiter.

 * {{{}count{}}}: An INTEGER expression to count the delimiters.

Returns:

The result matches the type of {{{}expr{}}}.

If {{count}} is positive, everything to the left of the final delimiter (counting from the left) is returned.

If {{count}} is negative, everything to the right of the final delimiter (counting from the right) is returned.

Examples:
{code:java}
> SELECT substring_index('www.apache.org', '.', 2);
 www.apache {code}
See more:
 * [Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+udf]
 * [Databricks SQL |https://docs.databricks.com/spark/latest/spark-sql/language-manual/functions/substring_index.html]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)