how can I achieve splitting a string field delimited by semicolons in hive?
select split(f1,";")[0] from table;
Hive split(string A, string pattern) Function The split function splits the string around the pattern pat and returns an array of strings. You can also specify regular expressions as patterns.
To split a string with comma, use the split() method in Java. str. split("[,]", 0);
You can write this way
select split(f1,'\073')[0] from table;
Wanted to re-iterate that this is indeed a Hue bug, but only in the Hortonworks version. The latest Cloudera version of the Hue runs this fine.
The below command will work:
1;Neethu KV
2;Ram KV
query 1:
select split(name,"\\;")[0],school from table_test
, where name refers to your column name to be split.
1 KV
2 KV
Query 2 :
select split(name,"\\;")[1],school from table_test
, where name refers to your column name to be split.
Neethu KV
Ram KV
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With