使用“as select”创建配置单元表,并指定tblproperty

68bkxrlz  于 2021-06-27  发布在  Hive
关注(0)|答案(1)|浏览(351)

例如,在使用parquet格式时,我希望能够指定压缩方案( ("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”创建配置单元表,并指定分隔符。但我不知道该怎么做 TBLPROPERTIES 用这种方法工作。我用的是Hive1.1。

gzszwxb4

gzszwxb41#

我能用同样的语句 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 ;

相关问题