是否有可能做一个
create table <mytable> as select <query statement>
使用
row format delimited fields terminated by '|';或者去做一个
create table <mytable> like <other_table> row format delimited fields terminated by '|';
《语言手册》似乎表明不..但有件事让我很开心,我以前就做到过。
发布于 2014-03-07 22:55:37
在配置单元中,
创建表作为选择是可能的。
您可以尝试使用以下命令:
CREATE TABLE new_test
row format delimited
fields terminated by '|'
STORED AS RCFile
AS select * from source where col=1在配置单元中也可以使用
Create table like。
发布于 2018-06-08 07:10:34
假设我们有一个名为employee的外部表
hive> SHOW CREATE TABLE employee;
OK
CREATE EXTERNAL TABLE employee(
id string,
fname string,
lname string,
salary double)
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'colelction.delim'=':',
'field.delim'=',',
'line.delim'='\n',
'serialization.format'=',')
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
'maprfs:/user/hadoop/data/employee'
TBLPROPERTIES (
'COLUMN_STATS_ACCURATE'='false',
'numFiles'='0',
'numRows'='-1',
'rawDataSize'='-1',
'totalSize'='0',
'transient_lastDdlTime'='1487884795')使用
employee的person表CREATE TABLE person LIKE employee;
person外部表,如employeeCREATE TABLE person LIKE employee LOCATION 'maprfs:/user/hadoop/data/person';
DESC person;查看新创建的表架构。发布于 2020-10-19 10:59:20
上面提供的两个答案都工作得很好。
https://stackoverflow.com/questions/22249739
复制相似问题