Hive 配置单元脚本中的日期shell命令

Hive 配置单元脚本中的日期shell命令,hive,Hive,我想在配置单元脚本中运行date命令。作为一个shell命令,我尝试使用前面的“!”命令。尝试了以下操作: hive (default)> !date --date="6 months ago"; date: extra operand `ago"' Try `date --help' for more information. Command failed with exit code = 1 正如@samson在comment配置单元中提到的那样,它不解析命令--date=“6个月前

我想在配置单元脚本中运行date命令。作为一个shell命令,我尝试使用前面的“!”命令。尝试了以下操作:

hive (default)> !date --date="6 months ago";
date: extra operand `ago"'
Try `date --help' for more information.
Command failed with exit code = 1

正如@samson在comment配置单元中提到的那样,它不解析命令
--date=“6个月前”。您可以使用下面的变通方法

select add_months(current_date(),-6);

是 啊配置单元解析器在解析命令时不接受引号,因此它尝试使用3个参数执行
date
,即
--date=“6
然后
个月
然后
之前”
。你没有解决办法。空格不能转义。