Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.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
List 配置单元中命令行参数中的传递列表_List_Hive_Command Line Arguments_Where In - Fatal编程技术网

List 配置单元中命令行参数中的传递列表

List 配置单元中命令行参数中的传递列表,list,hive,command-line-arguments,where-in,List,Hive,Command Line Arguments,Where In,基本上,我想自动化基于配置单元查询的作业。它将从文件中获取列表作为输入,查询将通过使用此输入应用过滤器生成报告。输入是一个列表,我想在配置单元查询中将其作为“where in”条件传递。我的问题是 //temp.sql// 插入表1 从表2中选择*,其中像素id为($pixel) 我试图像这样在命令行中传递输入, 配置单元-f temp.sql-d PIXEL='('608207'、'608206'、'608205'、'608204'、'608203'、'608201'、'608184'、'60

基本上,我想自动化基于配置单元查询的作业。它将从文件中获取列表作为输入,查询将通过使用此输入应用过滤器生成报告。输入是一个列表,我想在配置单元查询中将其作为“where in”条件传递。我的问题是

//temp.sql// 插入表1 从表2中选择*,其中像素id为($pixel)

我试图像这样在命令行中传递输入, 配置单元-f temp.sql-d PIXEL='('608207'、'608206'、'608205'、'608204'、'608203'、'608201'、'608184'、'608198'、'608189')>temp.log 2>&1&

我不确定这是不是正确的方式

有人有办法解决这个问题吗


请给我建议一些解决方法

如果pixel_id是number,您可以使用以下简单脚本:

  • 使用
    hive-e“select*from orders where order_id in(${1})”创建shell脚本script.sh
  • 通过运行chmod+x script.sh保存并更改权限
  • 通过将值作为参数传递来运行shell脚本,例如。/script.sh“1,2,3,4”

  • 您可以通过转义“like this”\“1\”、“2\”对字符串列执行此操作。请尝试像字符串一样传递,并使用“,”分隔列表-

    在bash上运行此命令:
    hive-hiveconf myargs=“1”、“2”、“3”、“4”

    考虑到您的脚本如下所示:
    SELECT*from mytable where my_id in(“${hiveconf:myargs}”);

    以下是一些指导原则。提供的答案可能是正确的,但可以从解释中受益。仅代码的答案不被视为“好”答案。从。