hive 如何将数组转成字符串_Hive Struct to String转换(Hive Struct to String conversion)

当在Hive中尝试将含有结构体的表数据插入到字符串字段时,会出现结构体值被不正确地连接。解决方法是通过使用LATERAL VIEW和explode函数,分别提取struct字段的每个组件并存入单独的字符串列。
摘要由CSDN通过智能技术生成

Hive Struct to String转换(Hive Struct to String conversion)

我有一个包含结构的表 - 让我们说:

create external table table1 (

a int,

b STRUCT ,

e string

)

我在这张桌子上执行选择,得到类似的东西 -

1100 {“c”:12.3,“d”:45.6} str

但是当我将这些数据插入另一个表格时 -

create external table table2 (

a string,

b string,

c string

)

insert overwrite table table2

select a,b,c

from table1;

我得到以下奇怪的行为,表明在hive中struct和string之间的转换不能按预期工作

select * from table2;

会导致 -

1100 12.345.6 str

结果是结构中的一种奇怪的值连接,甚至在处理更复杂的结构时也会发生奇怪的事情

有没有办法阻止这种自动转换? 在这种情况下让hive抛出错误?

有没有一种干净的方法来改变这种自动转换以不同的方式工作?

I have a table that has a struct in it - let's say:

create external table table1 (

a int,

b STRUCT ,

e string

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值