hive - 表中的 Hive 爆炸结果
问题描述
有人可以告诉我这段代码有什么问题吗?如果我只运行 select 语句,那么它会返回结果。
如果我删除“位置”或“存储为文本文件”这一行,代码就可以工作。如果我也可以指定“分隔符”,请告诉我。
create table exploderesults
location '/user/cloudera/sometest'
stored as textfile
as
select id,ph as phone, ct as city from explodetest
lateral view explode(phone)p as ph
lateral view explode(city)c as ct;
谢谢
解决方案
交换两行stored as
和location
。根据手册,它们必须按特定顺序排列
create table exploderesults
stored as textfile
location '/user/cloudera/sometest'
as
select id,ph as phone, ct as city from explodetest
lateral view explode(phone)p as ph
lateral view explode(city)c as ct;
如果要指定分隔符,
create table exploderesults
row format delimited fields terminated by ','
stored as textfile
location '/user/cloudera/sometest'
as
select id,ph as phone, ct as city from explodetest
lateral view explode(phone)p as ph
lateral view explode(city)c as ct;
推荐阅读
- html - 自动将 CSS 规则应用于网站?
- javascript - 带有动态组件的 Vue 3 过渡不允许子组件中有多个根对象
- c++ - C++中的继承和初始化列表
- google-chrome - 按下chrome扩展快捷键时,如果按下快捷键,操作将继续执行
- angular - Angular10将脚本标签添加到谷歌职位发布的索引中
- python - python-如何将值传递给类装饰器?
- r - 将虚拟变量隐藏为R中的单个分类?
- f# - 为什么这个 F# 引用在运行时失败?
- angular - Bearer 在 Angular 8 和 QT 中的授权问题
- javascript - 看不懂 shouldComponentUpdate() 中的 nextProps?