使用"作为选择"创建 Hive 表,并指定 TBL 属性



例如,当使用镶木地板格式时,我希望能够指定压缩方案(("parquet.compression"="SNAPPY")(。运行此查询:

CREATE TABLE table_a_copy
STORED AS PARQUET
TBLPROPERTIES("parquet.compression"="SNAPPY")
AS
SELECT * FROM table_a

返回错误:

Error: Error while compiling statement: FAILED: ParseException line 1:69 cannot recognize input near 'parquet' '.' 'compression' in table properties list (state=42000,code=40000)

没有TBLPROPERTIES的相同查询工作正常。

这类似于这个问题:使用"as select"或"like"创建hive表,并指定分隔符。但是我不知道如何使TBLPROPERTIES使用这种方法。我正在使用 Hive 1.1。

我能够在Hive 2.1.1版本中运行完全相同的语句。

Try with this workaround:

CREATE TABLE table_a_copy like table_a STORED AS PARQUET;
alter table set TBLPROPERTIES("parquet.compression"="SNAPPY");
insert into table table_a_copy select * from table_a ;

最新更新