Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 在shell脚本变量中存储配置单元查询输出_Bash_Shell_Hadoop_Hiveql - Fatal编程技术网

Bash 在shell脚本变量中存储配置单元查询输出

Bash 在shell脚本变量中存储配置单元查询输出,bash,shell,hadoop,hiveql,Bash,Shell,Hadoop,Hiveql,当我试图通过shell脚本执行以下2个查询时,我无法回显输出: 查询: close_val=`hive -e "select count(1) from tst_db.dim_calendar where calendar_id =20171102"` close_val=$(hive -S -e "USE cars_dev; select count(1) from dim_calendar where calendar_id =20171103") echo $close_val 错误:

当我试图通过shell脚本执行以下2个查询时,我无法回显输出:

查询:

close_val=`hive -e "select count(1) from tst_db.dim_calendar where calendar_id =20171102"`
close_val=$(hive -S -e "USE cars_dev; select count(1) from dim_calendar where calendar_id =20171103")

echo $close_val
错误:

2017-11-03 00:55:11505 INFO[main]Configuration.deprecated(Configuration.java:warnOnceIfDeprecated(1011))-mapred.input.dir.recursive不推荐使用。相反,请使用mapreduce.input.fileinputformat.input.dir.recursive 2017-11-03 00:55:11508 INFO[main]Configuration.deprecate(Configuration.java:warnOnceIfDeprecated(1011))-mapred.max.split.size不推荐使用。相反,请使用mapreduce.input.fileinputformat.split.maxsize 2017-11-03 00:55:11508 INFO[main]Configuration.deprecate(Configuration.java:warnOnceIfDeprecated(1011))-mapred.min.split.size不推荐使用。相反,请使用mapreduce.input.fileinputformat.split.minsize 2017-11-03 00:55:11508 INFO[main]Configuration.deprecated(Configuration.java:warnOnceIfDeprecated(1011))-mapred.min.split.size.per.rack不推荐使用。相反,请使用mapreduce.input.fileinputformat.split.minsize.per.rack 2017-11-03 00:55:11508 INFO[main]Configuration.deprecated(Configuration.java:warnOnceIfDeprecated(1011))-不推荐使用mapred.min.split.size.per.node。相反,请使用mapreduce.input.fileinputformat.split.minsize.per.node 2017-11-03 00:55:11508 INFO[main]Configuration.deprecated(Configuration.java:warnOnceIfDeprecated(1011))-mapred.reduce.tasks不推荐使用。相反,请使用mapreduce.job.reduces 2017-11-03 00:55:11508 INFO[main]Configuration.deprecated(Configuration.java:warnOnceIfDeprecated(1011))-mapred.reduce.tasks.投机.execution不推荐使用。相反,请使用mapreduce.reduce.Projective 2017-11-03 00:55:11715警告[main]conf.HiveConf(HiveConf.java:initialize(1155))-已弃用:配置属性hive.metastore.local不再有效。如果要连接到远程元存储,请确保为hive.metastore.uri提供有效值。1. ./run_daily_jobs_night.sh:line 42:[:参数太多


我不确定您希望对close_val值做什么,但在您的情况下,您似乎希望得到一个数字,但蜂巢中似乎存在问题,您得到的是stacktrace。 接收到的跟踪不是一个简单的字符串,但被视为echo的多个参数,这些参数超过了它处理的数量

使用如下命令:

$ # Notice the cut at the end of the command
$ close_val=$(hive -S -e "USE cars_dev; select count(1) from dim_calendar where calendar_id =20171103" | cut -f 1)
将确保您的echo命令能够工作,但这里您真正的问题是您的配置单元命令失败