在hadoop/hive中执行脚本

在hadoop/hive中执行脚本,hadoop,hive,Hadoop,Hive,我是hadoop/hive新手。我想在我的hadoop数据库中找到一个特定的列。我是从另一个stackoverflow的帖子上得到这个问题的。但它看起来更像是unix命令,我不确定应该在哪里执行它 hive -S -e 'show databases'| while read database do eval "hive -S -e 'show tables in $database'"| while read line do if eval "hive -S -e 'desc

我是hadoop/hive新手。我想在我的hadoop数据库中找到一个特定的列。我是从另一个stackoverflow的帖子上得到这个问题的。但它看起来更像是unix命令,我不确定应该在哪里执行它

hive -S -e 'show databases'|
while read database
do
   eval "hive -S -e 'show tables in $database'"|
   while read line
   do
if eval "hive -S -e 'describe $database.$line'"| grep -q "<column_name"; then
  output="Required table name: $database.$line"'\n';
else
output=""'\n';
fi
echo -e "$output"
done
done

这只是一个bash脚本

在配置单元命令可用的计算机上运行它

但不要在互联网上运行任何你不知道它的功能的代码提示:这不仅仅是一个专栏

如果您真的想找到所有数据库表的特定列,那么查询您的配置单元元存储将要快得多,假设它位于Mysql、Postgres、SQL server等中