Grokbase Groups Pig user July 2010
FAQ
myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\\Q32.21.12.\\E*';");

throws runtime error:


Exception in thread "main"
org.apache.pig.impl.logicalLayer.parser.TokenMgrError: Lexical error at
line 1, column 45. Encountered: "Q" (81), after : "\'\\"
at
org.apache.pig.impl.logicalLayer.parser.QueryParserTokenManager.getNextT
oken(QueryParserTokenManager.java:1693)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.jj_consume_token(Que
ryParser.java:7807)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PUnaryCond(QueryPars
er.java:1581)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PAndCond(QueryParser
.java:1433)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.POrCond(QueryParser.
java:1377)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PCond(QueryParser.ja
va:1343)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.FilterClause(QueryPa
rser.java:1253)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseExpr(QueryParser
.java:985)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.Expr(QueryParser.jav
a:795)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.Parse(QueryParser.ja
va:590)
at
org.apache.pig.impl.logicalLayer.LogicalPlanBuilder.parse(LogicalPlanBui
lder.java:60)
at org.apache.pig.PigServer.parseQuery(PigServer.java:298)
at org.apache.pig.PigServer.registerQuery(PigServer.java:266)
at org.apache.pig.PigServer.registerQuery(PigServer.java:352)

thoughts?

-----Original Message-----
From: Brian Adams
Sent: Tuesday, July 20, 2010 5:13 PM
To: pig-user@hadoop.apache.org
Subject: RE: Using Regex

double escape, in our setup

so a word break that is usually \b, needs to be '\\bthe\\b'


-----Original Message-----
From: Matthew Smith
Sent: Tue 7/20/2010 5:03 PM
To: pig-user@hadoop.apache.org
Subject: Using Regex

All,



I am using pig embedded in Java and need to use matches in my pig job.
However when I try to use escape characters in the pig line, the
compiler complains. How do I use complex regex while embedding?



Sample code that is throwing errors:



myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\Q34.21.12.*\E';");



error: invalid escape sequence.



Thanks,



Matt

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 5 | next ›
Discussion Overview
groupuser @
categoriespig, hadoop
postedJul 20, '10 at 8:58p
activeJul 20, '10 at 10:31p
posts5
users3
websitepig.apache.org

People

Translate

site design / logo © 2021 Grokbase