我正在尝试使用以下gcloud命令在Google dataproc中执行配置单元作业:
gcloud dataproc作业提交hive --cluster = msm-test-cluster --file hive.sql --properties = [bucket1 = abcd]
gcloud dataproc作业提交hive --cluster = msm-test-cluster --file hive.sql --params = [bucket1 = abcd]
但上述2个命令中没有一个能够设置“#1”桶1和#39;变量为' x'变量。
配置单元脚本如下:
set x=${bucket1};
set x;
drop table T1;
create external table T1( column1 bigint, column2 float, column3 int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE LOCATION 'gs://${hiveconf:x}/output/prod';
但变量' x'无法采取#bucket;'我在gcloud命令中传递的变量。
我该怎么做?请建议
答案 0 :(得分:3)
这两个例子都应该适用于小调整。
在cloud dataproc jobs submit hive --cluster=msm-test-cluster --file hive.sql --properties bucket1=abcd
中,您可以将变量视为${bucket1}
在gcloud dataproc jobs submit hive --cluster=msm-test-cluster --file hive.sql --params bucket1=abcd
中,您可以将变量视为${hivevar:bucket1}
测试这个的简单方法是提交这样的脚本来转储所有变量:
gcloud dataproc jobs submit hive --cluster msm-test-cluster -e "set;" --properties foo=bar --params bar=baz
输出应包含:
| foo=bar
| hivevar:bar=baz