猪的双引号和单引号有什么区别?

时间:2014-11-24 17:22:58

标签: apache-pig quotes

我一直认为''""pig中是相同的,但今天我得到了

Unexpected character '"' 

上的

错误

register datafu-pig-1.2.1.jar
define Coalesce datafu.pig.util.Coalesce;
...
Coalesce(x,"a")

,而

Coalesce(x,'a')

工作正常。

那么,单引号和双引号之间有什么区别?

1 个答案:

答案 0 :(得分:1)

Pig不支持字符串文字的双引号(即chararray)。所有chararray必须用单引号括起来。

A String or Chararrays are represented in interfaces by java.lang.String. 
Constant chararrays are expressed as string literals with single quotes, for example, 'fred'

参考:http://chimera.labs.oreilly.com/books/1234000001811/ch04.html#scalar_types