在 google dataproc 上执行配置单元作业时如何使用 params/properties 标志值
How to use params/properties flag values when executing hive job on google dataproc
我正在尝试使用以下 gcloud 命令在 google dataproc 中执行配置单元作业:
gcloud dataproc 作业提交配置单元 --cluster=msm-test-cluster --file hive.sql --properties=[bucket1=abcd]
gcloud dataproc 作业提交配置单元 --cluster=msm-test-cluster --file hive.sql --params=[bucket1=abcd]
但是上述 2 个命令中的 none 能够将 'bucket1' 变量设置为 'x' 变量。
hive脚本如下:
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' 无法获取我在 gcloud 命令中传递的 'bucket1' 变量。
我该怎么做?请推荐
这两个示例都应该稍作调整。
在 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
相关问题:
How to set variables in HIVE scripts
我正在尝试使用以下 gcloud 命令在 google dataproc 中执行配置单元作业:
gcloud dataproc 作业提交配置单元 --cluster=msm-test-cluster --file hive.sql --properties=[bucket1=abcd]
gcloud dataproc 作业提交配置单元 --cluster=msm-test-cluster --file hive.sql --params=[bucket1=abcd]
但是上述 2 个命令中的 none 能够将 'bucket1' 变量设置为 'x' 变量。
hive脚本如下:
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' 无法获取我在 gcloud 命令中传递的 'bucket1' 变量。
我该怎么做?请推荐
这两个示例都应该稍作调整。
在
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
相关问题: How to set variables in HIVE scripts