蜂巢更新lastAccessTime [英] hive update lastAccessTime
问题描述
我想更新配置单元表上的lastAccessTime,谷歌进入网络后,我得到了一个解决方案:
I wanted to update lastAccessTime on hive table ,After google in the web,I get a solution :
set hive.exec.pre.hooks = org.apache.hadoop.hive.ql.hooks.UpdateInputAccessTimeHook$PreExec;
但是如果我有两个数据库A&B配置单元sql:
But If I have two database A & B the hive sql:
set hive.exec.pre.hooks =
org.apache.hadoop.hive.ql.hooks.UpdateInputAccessTimeHook$PreExec;
use A;
insert overwrite A.xxx
select c1,c2 from B.xxx;
蜂巢还给我
org.apache.hadoop.hive.ql.metadata.InvalidTableException(表不找到了B.xxx
org.apache.hadoop.hive.ql.metadata.InvalidTableException(Table not found B.xxx
推荐答案
要检索表的"LastAccessTime",请通过Hive Shell运行以下命令,并用相关值替换[database_name]和[table_name].
To retrieve a table's 'LastAccessTime', run the following commands through the Hive shell, replacing [database_name] and [table_name] with the relevant values.
use [database_name];
show table extended like '[table_name]';
这将返回几个指标,包括自从Epoch以来经过的毫秒数(而不是秒数).要将数字格式化为代表当前系统时区中该时刻的时间戳的字符串,请从数字中删除最后三位数字,然后通过以下命令运行它:
This will return several metrics including the number of milliseconds (rather than the number of seconds) elapsed since Epoch. To format that number as a string representing the timestamp of that moment in the current system's time zone, remove the last three digits from the number and run it through the following command:
select from_unixtime([last_access_time]);
这篇关于蜂巢更新lastAccessTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!