You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by lu...@china-inv.cn on 2019/03/07 11:23:44 UTC

How to update the metadata of a Hive table?

Hi, All,

We use the 'alter table foo set location new-hdfs-folder' to force table 
foo to use the latest data

The command is executed successfully and the new data can be accessed 
through table foo.

But the metadata of the table 'foo' is not correct. e.g. rowNumber and 
table size,

I tried 'analyze table foo compute statistics' and 'msck repair table foo'
But both don't work.

Does anyone know how to tell hive to update the metadata of a table?

Thanks a lot.

Boying 



 
本邮件内容包含保密信息。如阁下并非拟发送的收件人,请您不要阅读、保存、对外
披露或复制本邮件的任何内容,或者打开本邮件的任何附件。请即回复邮件告知发件
人,并立刻将该邮件及其附件从您的电脑系统中全部删除,不胜感激。

 
This email message may contain confidential and/or privileged information. 
If you are not the intended recipient, please do not read, save, forward, 
disclose or copy the contents of this email or open any file attached to 
this email. We will be grateful if you could advise the sender immediately 
by replying this email, and delete this email and any attachment or links 
to this email completely and immediately from your computer system. 




答复: Re: How to update the metadata of a Hive table?

Posted by lu...@china-inv.cn.
Not, it is NOT an external table.

Both tables are managed tables and have no partitions.

The analyze command only update the row number but not other meta data 
such as table size.





发件人: 
"Ashutosh Bapat" <as...@gmail.com>
收件人:
user@hive.apache.org
日期:
2019/03/11 13:01
主题:
Re: How to update the metadata of a Hive table?





On Thu, Mar 7, 2019 at 4:54 PM <lu...@china-inv.cn> wrote:
Hi, All, 

We use the 'alter table foo set location new-hdfs-folder' to force table 
foo to use the latest data 

Is foo an external table?
 

The command is executed successfully and the new data can be accessed 
through table foo. 

But the metadata of the table 'foo' is not correct. e.g. rowNumber and 
table size, 

I tried 'analyze table foo compute statistics' and 'msck repair table foo' 

But both don't work. 

Looking at the documentation at 
https://cwiki.apache.org/confluence/display/Hive/StatsDev#StatsDev-ExistingTables%E2%80%93ANALYZE
, it looks like ANALYZE table foo compute statistics should correct the 
statistics.

--
Best Wishes,
Ashutosh Bapat




 
本邮件内容包含保密信息。如阁下并非拟发送的收件人,请您不要阅读、保存、对外
披露或复制本邮件的任何内容,或者打开本邮件的任何附件。请即回复邮件告知发件
人,并立刻将该邮件及其附件从您的电脑系统中全部删除,不胜感激。

 
This email message may contain confidential and/or privileged information. 
If you are not the intended recipient, please do not read, save, forward, 
disclose or copy the contents of this email or open any file attached to 
this email. We will be grateful if you could advise the sender immediately 
by replying this email, and delete this email and any attachment or links 
to this email completely and immediately from your computer system. 




答复: Re: How to update the metadata of a Hive table?

Posted by lu...@china-inv.cn.
The both tables have NO partitions. 




发件人: 
"Sahibdeep Singh" <sa...@gmail.com>
收件人:
user@hive.apache.org
日期:
2019/03/11 13:09
主题:
Re: How to update the metadata of a Hive table?



Does the new location have old partitions as well? OR some partitions lie 
in old location and some in new location?

On Sun, Mar 10, 2019 at 10:01 PM Ashutosh Bapat <
ashutosh.bapat.oss@gmail.com> wrote:


On Thu, Mar 7, 2019 at 4:54 PM <lu...@china-inv.cn> wrote:
Hi, All, 

We use the 'alter table foo set location new-hdfs-folder' to force table 
foo to use the latest data 

Is foo an external table?
 

The command is executed successfully and the new data can be accessed 
through table foo. 

But the metadata of the table 'foo' is not correct. e.g. rowNumber and 
table size, 

I tried 'analyze table foo compute statistics' and 'msck repair table foo' 

But both don't work. 

Looking at the documentation at 
https://cwiki.apache.org/confluence/display/Hive/StatsDev#StatsDev-ExistingTables%E2%80%93ANALYZE
, it looks like ANALYZE table foo compute statistics should correct the 
statistics.

--
Best Wishes,
Ashutosh Bapat




 
本邮件内容包含保密信息。如阁下并非拟发送的收件人,请您不要阅读、保存、对外
披露或复制本邮件的任何内容,或者打开本邮件的任何附件。请即回复邮件告知发件
人,并立刻将该邮件及其附件从您的电脑系统中全部删除,不胜感激。

 
This email message may contain confidential and/or privileged information. 
If you are not the intended recipient, please do not read, save, forward, 
disclose or copy the contents of this email or open any file attached to 
this email. We will be grateful if you could advise the sender immediately 
by replying this email, and delete this email and any attachment or links 
to this email completely and immediately from your computer system. 




Re: How to update the metadata of a Hive table?

Posted by Sahibdeep Singh <sa...@gmail.com>.
Does the new location have old partitions as well? OR some partitions lie
in old location and some in new location?

On Sun, Mar 10, 2019 at 10:01 PM Ashutosh Bapat <
ashutosh.bapat.oss@gmail.com> wrote:

>
>
> On Thu, Mar 7, 2019 at 4:54 PM <lu...@china-inv.cn> wrote:
>
>> Hi, All,
>>
>> We use the 'alter table foo set location new-hdfs-folder' to force table
>> foo to use the latest data
>>
>
> Is foo an external table?
>
>
>>
>> The command is executed successfully and the new data can be accessed
>> through table foo.
>>
>> But the metadata of the table 'foo' is not correct. e.g. rowNumber and
>> table size,
>>
>> I tried 'analyze table foo compute statistics' and 'msck repair table foo'
>> But both don't work.
>>
>
> Looking at the documentation at
> https://cwiki.apache.org/confluence/display/Hive/StatsDev#StatsDev-ExistingTables%E2%80%93ANALYZE,
> it looks like ANALYZE table foo compute statistics should correct the
> statistics.
>
> --
> Best Wishes,
> Ashutosh Bapat
>

Re: How to update the metadata of a Hive table?

Posted by Ashutosh Bapat <as...@gmail.com>.
On Thu, Mar 7, 2019 at 4:54 PM <lu...@china-inv.cn> wrote:

> Hi, All,
>
> We use the 'alter table foo set location new-hdfs-folder' to force table
> foo to use the latest data
>

Is foo an external table?


>
> The command is executed successfully and the new data can be accessed
> through table foo.
>
> But the metadata of the table 'foo' is not correct. e.g. rowNumber and
> table size,
>
> I tried 'analyze table foo compute statistics' and 'msck repair table foo'
> But both don't work.
>

Looking at the documentation at
https://cwiki.apache.org/confluence/display/Hive/StatsDev#StatsDev-ExistingTables%E2%80%93ANALYZE,
it looks like ANALYZE table foo compute statistics should correct the
statistics.

--
Best Wishes,
Ashutosh Bapat