Hive 配置单元更新lastAccessTime
我想在hive表上更新lastAccessTime,在google进入web后,我得到了一个解决方案:Hive 配置单元更新lastAccessTime,hive,Hive,我想在hive表上更新lastAccessTime,在google进入web后,我得到了一个解决方案: set hive.exec.pre.hooks = org.apache.hadoop.hive.ql.hooks.UpdateInputAccessTimeHook$PreExec; 但是如果我有两个数据库A和B,那么配置单元sql: set hive.exec.pre.hooks = org.apache.hadoop.hive.ql.hooks.UpdateInputAc
set hive.exec.pre.hooks = org.apache.hadoop.hive.ql.hooks.UpdateInputAccessTimeHook$PreExec;
但是如果我有两个数据库A和B,那么配置单元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
要检索表的“LastAccessTime”,请通过配置单元外壳运行以下命令,将[database_name]和[table_name]替换为相关值
use [database_name];
show table extended like '[table_name]';
这将返回几个指标,包括自历元以来经过的毫秒数(而不是秒数)。要将该数字格式化为表示当前系统时区中该时刻的时间戳的字符串,请从该数字中删除最后三位数字,然后通过以下命令运行该数字:
select from_unixtime([last_access_time]);
我恰好想要同样的效果。 花点时间,最终成功; 你的方法是对的,只是价值观
<property>
<name>hive.security.authorization.sqlstd.confwhitelist.append</name>
<value>hive\.exec\.pre\.hooks</value>
</property>
<property>
<name>hive.exec.pre.hooks</name>
<value>org.apache.hadoop.hive.ql.hooks.UpdateInputAccessTimeHook$PreExec</value>
</property>
hive.security.authorization.sqlstd.confwhitelist.append
蜂巢\.exec\.pre\.hooks
hive.exec.pre.hooks
org.apache.hadoop.hive.ql.hooks.UpdateInputAccessTimeHook$PreExec
如果仍然不工作,可能是你的蜂巢有一个bug。
如果您使用cdh,则在CDH5.15中修复。您知道如何更新此值吗?我似乎不知道,是否存在某种缓存?以及什么是“访问”,是否有任何表读取导致此更新?我的情况是,此时间戳似乎已更新,而配置单元元数据存储中的最后\u访问\u时间为0。这对我来说没有任何意义,知道吗?