hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pi Song (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIG-123) cannot escape single quotes in single quoted strings when using the eq or match operator
Date Tue, 26 Feb 2008 11:32:05 GMT

    [ https://issues.apache.org/jira/browse/PIG-123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572433#action_12572433

Pi Song commented on PIG-123:

After having a look, currently there is no escape character implementation in our grammar.

By changing the definition of quoted string in grammar file from

TOKEN : { <QUOTEDSTRING : "'" (~["'"])* "'"> }
TOKEN : { <QUOTEDSTRING : "'" ( (~["'","\\"]) | ("\\" (["\\","'"] ) )* "'"> }

and changing the state manipulation in Grunt not to switch out of IN_STRING after  *"\'"*
(backslash and a quote) is encountered, this should work.

****However**** the real problem of doing this is the semantic change. As we introduce an
escape character, we no longer treat the character as itself. People using "\" in their code
will get a weird error message.

Here are what will be affected from the above grammar change (Similar to Java) :-

"\\"  will be interpreted as "\"
"\'"  will be interpreted as "'"
"\"+(char) will no longer allowed. ***An error will be raised***.

****Another concern**** is I don't know how having a single quote in the expression evaluation
engine (which sometimes uses encoded text notation internally) will be affected.

Need to listen to others!!!

> cannot escape single quotes in single quoted strings when using the eq or match operator
> ----------------------------------------------------------------------------------------
>                 Key: PIG-123
>                 URL: https://issues.apache.org/jira/browse/PIG-123
>             Project: Pig
>          Issue Type: Bug
>            Reporter: andrei badulescu
> a query like this :
> filter c by ( c.string eq 'hell\'s angels' OR c.string eq 'blue\'s clues')  
> generates an error with the pig parser, because the parser does not allow single quotes
(') within single quotes, even if they are escaped with a backslash. 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message