我有一个像这样的蜂巢表:
CREATE TABLE `abtestmsg_orc`(
`eventname` string COMMENT 'AB测试方案上报事件:ABTest',
`eventtime` string COMMENT '事件上报时间',
`sessionid` string COMMENT 'Session标识',
`appkey` string COMMENT 'app标识',
`deviceid` string COMMENT 'device标识',
`content` string COMMENT 'AB测试方案的内容,格式是一个 json 字符串',
`item` array<struct<key:string,value:string>> COMMENT '扩展字段')
PARTITIONED BY (
`dt` string COMMENT '??')
ROW FORMAT SERDE
'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION
'hdfs://hdfsmaster/hive/connector_transfer/abtestmsg_orc'
现在,我想将文件格式从 ORC 更改为 parquet 并将位置更改为包含 parquet 文件的其他 hdfs 目录。所以我首先尝试更改格式:
alter table abtestmsg_orc1 set fileformat parquet;
但遗憾的是它抛出了一个异常:
失败:执行错误,返回代码 1 从
org.apache.hadoop.hive.ql.exec.DDLTask. Changing file format (from ORC) is not supported for table connector_transfer.abtestmsg_orc1
Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Changing file format (from ORC) is not supported for table connector_transfer.abtestmsg_orc1 (state=08S01,code=1)
我猜这个异常意味着当我更改 fileformat 时,hive 不仅会更改表元数据,而且还会尝试将所有数据格式从 orc 更改为 parquet。但是从官方文档中,它说:
ALTER TABLE table_name [PARTITION partition_spec] SET FILEFORMAT file_format;
**This statement changes the table's (or partition's) file format. For available file_format options, see the section above on CREATE TABLE. The operation only changes the table metadata. Any conversion of existing data must be done outside of Hive.**
但我想要实现的是将其位置设置为镶木地板目录。
那么,我能做些什么来实现这一目标呢?