I always thought that ''
and ""
were the same in pig
, but today I got the
Unexpected character '"'
error on
register datafu-pig-1.2.1.jar
define Coalesce datafu.pig.util.Coalesce;
...
Coalesce(x,"a")
while
Coalesce(x,'a')
works just fine.
So, what is the difference between single and double quotes?
Pig doesn't support double quotes for string literals(ie chararray). All the chararray must be enclosed within single quotes.
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'
Reference:http://chimera.labs.oreilly.com/books/1234000001811/ch04.html#scalar_types