abeboparebop
abeboparebop

Reputation: 7755

Create Hive table using “as select” and also specify TBLPROPERTIES

For example, when using Parquet format, I'd like to be able to specify the compression scheme (("parquet.compression"="SNAPPY")). Running this query:

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

returns an error:

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

The same query without the TBLPROPERTIES works just fine.

This is similar to this question: Create hive table using "as select" or "like" and also specify delimiter. But I can't figure out how to make TBLPROPERTIES work with that approach. I'm using Hive 1.1.

Upvotes: 1

Views: 1306

Answers (1)

notNull
notNull

Reputation: 31490

I was able to run same exact statement in Hive 2.1.1 version.

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 ;

Upvotes: 2

Related Questions