【问题标题】:Create Hive table using “as select” and also specify TBLPROPERTIES使用“as select”创建 Hive 表并指定 TBLPROPERTIES
【发布时间】:2019-10-03 23:35:02
【问题描述】:

例如,当使用 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 的相同查询可以正常工作。

这类似于这个问题:Create hive table using "as select" or "like" and also specify delimiter。但我不知道如何让TBLPROPERTIES 使用这种方法。我正在使用 Hive 1.1。

【问题讨论】:

  • 您好,table_a 是什么类型的表?是镶木地板吗?
  • @F.Lazarescu:就这个问题而言,我宁愿获得一个独立于源表的解决方案。

标签: hive


【解决方案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 ;

【讨论】:

  • 确实,我有一个旧版本的 Hive,v1.1。解决方法虽然有效!
猜你喜欢
  • 2020-05-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-05
  • 1970-01-01
  • 2016-03-18
  • 1970-01-01
相关资源
最近更新 更多