Hive 有字符串拆分功能吗? [英] Does Hive have a String split function?

查看:37
本文介绍了Hive 有字符串拆分功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Hive 中寻找内置的字符串拆分功能?例如如果字符串是:

I am looking for a in-built String split function in Hive? e.g. if String is:

A|B|C|D|E

然后我想要一个函数:

array<string> split(string input, char delimiter)

这样我就回来了:

[A,B,C,D,E]

Hive 中是否存在这种内置的拆分功能.

Does such a in-built split function exist in Hive.

我只能看到regexp_extractregexp_replace.我很想看到 indexOf()split() 字符串函数.

I can only see regexp_extract and regexp_replace. I would love to see a indexOf() and split() string functions.

推荐答案

确实存在基于正则表达式的拆分功能.它没有在在教程中列出,但在维基上的语言手册:

There does exist a split function based on regular expressions. It's not listed in the tutorial, but it is listed on the language manual on the wiki:

split(string str, string pat)
   Split str around pat (pat is a regular expression) 

在您的情况下,分隔符|"作为正则表达式具有特殊意义,因此应将其称为\|".

In your case, the delimiter "|" has a special meaning as a regular expression, so it should be referred to as "\|".

这篇关于Hive 有字符串拆分功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆