Shell Hive - 识别整个 Hive 数据库中的列
Shell Hive - Identify a column in entire Hive Database
如果我将第一行更改为 hive -S -e 'show databases like 'abc_xyz%'
'|,则以下代码不会进入循环
你能帮忙解决这个问题吗?`
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```
show databases command 模式中的通配符只能是任何字符的“*”或“|”选择 Hive < 4.0.0.
例如像这样:
show databases like 'abc_xyz*|bcd_xyz*'
SQL-style patterns '%' for any character(s), and '_' for a single character work only since Hive 4.0.0
如果我将第一行更改为 hive -S -e 'show databases like 'abc_xyz%'
'|,则以下代码不会进入循环
你能帮忙解决这个问题吗?`
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```
show databases command 模式中的通配符只能是任何字符的“*”或“|”选择 Hive < 4.0.0.
例如像这样:
show databases like 'abc_xyz*|bcd_xyz*'
SQL-style patterns '%' for any character(s), and '_' for a single character work only since Hive 4.0.0