配置单元:表创建失败,原因是“由于自身任务失败,顶点未成功”

wvt8vs2t  于 2021-06-24  发布在  Hive
关注(0)|答案(1)|浏览(303)

我有一个 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_2Table_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 信息:

Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive 
Runtime Error while processing row (tag=0) {"key":{},"value": 
{"_col0":001,"_col1":"BVF","_col2":"NJ","_col3":"06/01/2019- 
07/30/2019","_col4":"9.4","_col5":7.8,"_col6":8.9,"_col7":"Y"}}

Vertex did not succeed due to OWN_TASK_FAILURE, failedTasks:1 
killedTasks:0, Vertex vertex_1558653107192_0189_1_01 [Reducer 2] 
killed/failed due to:OWN_TASK_FAILURE]DAG did not succeed due to 
VERTEX_FAILURE. failedVertices:1 killedVertices:0

任何解决问题的帮助/建议。因为我不知道问题出在哪里。。。

ffscu2ro

ffscu2ro1#

你能试一下下面的语法吗。

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分隔符对parquet格式没有任何影响,对于非文本格式的表,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;

相关问题