hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mich Talebzadeh <mich.talebza...@gmail.com>
Subject Re: How to rename a hive table without changing location?
Date Sun, 13 Mar 2016 00:17:12 GMT
I do not see much point in renaming a table from A to B but still looking
at files A for this table. What is the purpose of renaming the table but
having the same file system?

hive>
*create table a (col1 int);*hive>
*show create table a;*CREATE TABLE `a`(
  `col1` int)
ROW FORMAT SERDE
  'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
STORED AS INPUTFORMAT
  'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'

*LOCATION*
* 'hdfs://rhes564:9000/user/hive/warehouse/test.db/a'*

hive>
*alter table a rename to b;*hive> *show create table a;*
FAILED: SemanticException [Error 10001]: Table not found a

hive> *show create table b;*
CREATE TABLE `b`(
  `col1` int)
ROW FORMAT SERDE
  'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
STORED AS INPUTFORMAT
  'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'

*LOCATION*
*'hdfs://rhes564:9000/user/hive/warehouse/test.db/b'*

HTH

Dr Mich Talebzadeh



LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*



http://talebzadehmich.wordpress.com



On 13 March 2016 at 00:01, Rex X <dnsring@gmail.com> wrote:

> Based on the Hive doc below:
>
>
> Rename Table
>
> *ALTER TABLE table_name RENAME TO new_table_name;*
>
> This statement lets you change the name of a table to a different name.
>
> *As of version 0.6, a rename on a managed table moves its HDFS location as
> well. (Older Hive versions just renamed the table in the metastore without
> moving the HDFS location.)*
>
>
> Is there any way to rename a table without changing the location?
>

Mime
View raw message