sds
sds

Reputation: 60004

What is the difference between double and single quotes in pig?

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?

Upvotes: 4

Views: 533

Answers (1)

Sivasakthi Jayaraman
Sivasakthi Jayaraman

Reputation: 4724

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

Upvotes: 1

Related Questions