Section 9:92. String Manipulation – Substr and Split

1. SUBSTR: Extracts a substring from a given string.

Example: SELECT SUBSTR(‘Hello World’, 1, 5);

Output: Hello 

Here is the example

2.In Hive, the SPLIT function is used to split a string into an array of substrings based on a delimiter. The syntax of the SPLIT function is as follows:

SPLIT(string str, string delimiter)

Here, str is the string to be split, and delimiter is the delimiter used to split the string. The SPLIT function returns an array of substrings.The EXPLODE function is used to break up an array into multiple rows. For example, if you have a table with a column that contains an array of values, you can use the EXPLODE function to create a new row for each value in the array.

For example, consider the following query:

Share this post