使用“as select"创建配置单元表或“喜欢"并指定分隔符 [英] Create hive table using "as select" or "like" and also specify delimiter
本文介绍了使用“as select"创建配置单元表或“喜欢"并指定分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以做一个
创建表
使用
行格式分隔字段以'|'结尾;
或者做一个
创建表
语言手册似乎没有表明......但有些让我感到痒痒的,我过去曾实现过这一点.
解决方案
在 Hive 中可以将表创建为选择 (CTAS).
你可以试试下面的命令:
创建表 new_test行格式分隔以|"结尾的字段存储为 RCFileAS select * from source where col=1
- 目标不能是分区表.
- 目标不能是外部表.
- 它复制结构和数据
<块引用>
在 Hive 中也可以创建类似的表.
- 它只是复制源表定义.
Is it possible to do a
create table <mytable> as select <query statement>
using
row format delimited fields terminated by '|';
or to do a
create table <mytable> like <other_table> row format delimited fields terminated by '|';
The Language Manual seems to indicate not.. but something tickles me I had achieved this in the past.
解决方案
Create Table as select (CTAS) is possible in Hive.
You can try out below command:
CREATE TABLE new_test
row format delimited
fields terminated by '|'
STORED AS RCFile
AS select * from source where col=1
- Target cannot be partitioned table.
- Target cannot be external table.
- It copies the structure as well as the data
Create table like is also possible in Hive.
- It just copies the source table definition.
这篇关于使用“as select"创建配置单元表或“喜欢"并指定分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文