pig-user  

Re: QuotedString and escaping Quotes

Alan Gates
Fri, 19 Sep 2008 10:30:42 -0700

At this point the pig scanner does not escape strings. If you want to add backslash escaping I think that would be great.

Alan.

Iván de Prado wrote:
Hello,
I am having a problem when giving parameters to a load function that
loads data from a database. It receives a SQL query as parameter.
Something like that:

A = LOAD 'dbparams.cfg' USING  DBPigStorage('select if(field is null,
\'null\',field) from table');

But I am having a problem with quotes. I don't know how to escape quotes
in order to insert them into a quotedString.
I have taken a look to the grammar file:

<quotedstring> := "'"<string>"'"

But doesn't say nothing about string and escaping. Can I escape the
quotes in a quotedstring using "\'"?
If they are not any escaping in quoted strings, I propose to add
java-like escaping with "\".
Any other solution?

Thanks, Iván de Prado Alonso
www.ivanprado.es