HIVE:我怎样才能传递包含单引号的hiveconf?

时间:2013-04-17 20:19:29

标签: string hadoop amazon-web-services hive elastic-map-reduce

我想传递一个包含字符串中单引号的hive arg。这会导致EMR作业失败,并显示以下错误:

sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
Command exiting with ret '255'

所需变量:

-hiveconf "myvar=Today's a great day for a test!"

有什么想法吗?感谢。

1 个答案:

答案 0 :(得分:0)

尝试:

SET myvar="Today's a great day for a test!";

然后调用它:

SELECT * FROM myTable WHERE test_today=${hiveconf:myvar}

当我尝试时,这对我有用,但是当我尝试时:

SET myvar=Today's a great day for a test! (withoutquotes)

我收到错误。希望这有帮助