last_processed_time=`hive -S -e "USE db; select MAX(processed_time) from job_details where event_id = 'XXXX'"`
`echo $last_processed_time
pig -useHCatalog -Dmapred.job.queue.name=highPriority -Dtez.queue.name=highPriority -x tez -param last_processed_time=$last_processed_time test.pig`
> After executing above shell , It displays the required MAX value as
> well as pass the same value to Pig as external parameter for internal
> use within pig. Hope this will be helpful to make the same case with
> hive call using 'hiveconf'
5条答案
按热度按时间oiopk7p51#
这将给出变量a中表的第一行以逗号分隔的输出
xeufq47z2#
jgzswidk3#
没有直接的方法可以做到这一点。。。。
通过shell的一种简单方法是:
catchData=$(beeline/hive -u jdbc:hive2://$hiveServer2:10000 -n $userName -e "select count(*) from table")
但这是无效的,因为它甚至会打印hiveconnect语句、info&warn语句以及数据2最好的办法是。。
希望这一点2有帮助。。。
332nm8kg4#
嗯,这很简单。在你的壳里,
在您的file.hql中使用
${countNum}
在您的查询中。vzgqcmou5#
用shell脚本做这件事有点困难。
我可以建议您使用perl脚本吗?因为在perl中这是相当容易的。
您可以在perl脚本中这样做。