rom
rom

Reputation: 3672

change default location when creating an external table in hive

I would like to create an external table in hive from a view and change the default location:

CREATE external TABLE market.resultats like v_ca_mag
LOCATION '/user/training/market/db/resultats';

The table is created and is external but the location is the default one /user/hive/warehouse/market.db/resultats.

Why is the location not taken into account?

I am using cdh 5.4.

Upvotes: 1

Views: 1454

Answers (1)

notNull
notNull

Reputation: 31540

Probably it's a bug please open a jira to account for this issue.

As a work around once you are done with creating external table then execute alter table statement to change the location of your newly created table to the desired location.

hive> CREATE external TABLE market.resultats like v_ca_mag;
hive> alter table market.resultats set location 'hdfs://nnaddress/user/training/market/db/resultats';

Upvotes: 1

Related Questions