逗号分隔的字符串到各个行-Impala SQL [英] Comma delimited string to individual rows - Impala SQL

查看:308
本文介绍了逗号分隔的字符串到各个行-Impala SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们有一张桌子:

Owner   | Pets
------------------------------
Jack    | "dog, cat, crocodile" 
Mary    | "bear, pig"

我想得到的结果是:

Owner   | Pets
------------------------------
Jack    | "dog"
Jack    | "cat"
Jack    | "crocodile" 
Mary    | "bear"
Mary    | "pig"

我通过谷歌搜索找到了类似问题的一些解决方案,但是Impala SQL不提供任何解决方案

I found some solutions to similar problems by googling, but Impala SQL does not offer any of these capabilities to apply the suggested solutions.

任何帮助将不胜感激!

推荐答案

以下在Impala中起作用:

The following works in Impala:

split_part(string source, string delimiter, bigint n)

您可以在此处找到文档:

You can find the documentation here:

https://www.cloudera.com/documentation/enterprise/5 -9-x / topics / impala_string_functions.html

这篇关于逗号分隔的字符串到各个行-Impala SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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