2017-11-03 8 views
0

私はシェルスクリプトを経由して2以下のクエリを実行しようとすると、私は出力をエコーすることができないよ:シェルスクリプトでハイブクエリ出力を格納する変数

Querys:

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:11,505 INFO [main] Configuration.deprecation (Configuration.java:warnOnceIfDeprecated(1011)) - mapred.input.dir.recursive is deprecated. Instead, use mapreduce.input.fileinputformat.input.dir.recursive 2017-11-03 00:55:11,508 INFO [main] Configuration.deprecation (Configuration.java:warnOnceIfDeprecated(1011)) - mapred.max.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.maxsize 2017-11-03 00:55:11,508 INFO [main] Configuration.deprecation (Configuration.java:warnOnceIfDeprecated(1011)) - mapred.min.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize 2017-11-03 00:55:11,508 INFO [main] Configuration.deprecation (Configuration.java:warnOnceIfDeprecated(1011)) - mapred.min.split.size.per.rack is deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize.per.rack 2017-11-03 00:55:11,508 INFO [main] Configuration.deprecation (Configuration.java:warnOnceIfDeprecated(1011)) - mapred.min.split.size.per.node is deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize.per.node 2017-11-03 00:55:11,508 INFO [main] Configuration.deprecation (Configuration.java:warnOnceIfDeprecated(1011)) - mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces 2017-11-03 00:55:11,508 INFO [main] Configuration.deprecation (Configuration.java:warnOnceIfDeprecated(1011)) - mapred.reduce.tasks.speculative.execution is deprecated. Instead, use mapreduce.reduce.speculative 2017-11-03 00:55:11,715 WARN [main] conf.HiveConf (HiveConf.java:initialize(1155)) - DEPRECATED: Configuration property hive.metastore.local no longer has any effect. Make sure to provide a valid value for hive.metastore.uris if you are connecting to a remote metastore. 1 ./run_daily_jobs_night.sh: line 42: [: too many arguments

答えて

0

close_valの値ではどういうことを期待しているのか分かりませんが、状況によっては数値が予想されるようですが、ハイブに問題があるようで、代わりにスタックトレースを取得するようです。 受信したトレースは単純な文字列ではありませんが、処理する番号を超えるエコーのいくつかのパラメータとみなされます。以下のようなコマンドを使用して

$ # 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コマンドが動作することを保証しますが、ここであなたの本当の問題は、

を失敗している、あなたのハイブのコマンドであります
関連する問題