我有一个leftJoin(DB::raw('(report_comments, library_comments)')
,其结构如下:
Table_1
从ID ABR CTG DATERNG VAL1 VAL2 VAL3 IND
001 BVF NJ 06/01/2019-07/30/2019 9.4 7.8 8.9 Y
002 BHT JP 05/01/2018-05/08/2019 89.5 55.4 67.4 N
003 GHT JK 09/09/2017-03/03/2018 45.4 45.3 0.0 N
..
尝试另一个Table_2
编写以下简单的配置单元查询片段:
Table_1
但是收到以下CREATE TABLE Table_2
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'
AS SELECT * FROM Table_1;
消息:
error
任何帮助/建议来解决该问题。由于我没有得到查询中的问题...
答案 0 :(得分:1)
您能否一次尝试使用以下语法。
hive> CREATE TABLE Table_2 stored as parquet
AS SELECT * FROM Table_1;
(或)
By using ROW FORMAT SERDE:
CREATE TABLE Table_2
ROW FORMAT SERDE
'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'
as SELECT * FROM Table_1;
AFAIK分隔符对实木复合地板格式没有任何影响,并且在非文本格式表的情况下,hive在内部管理分隔符。
如果您还需要包含定界符:
Then create table_2:
CREATE TABLE Table_2(col1 int) --specify column names
ROW FORMAT delimited
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat';
然后运行insert语句将数据从表_1加载到表_2
insert into Table_2 select * from Table_1;