You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Shin Chan <ha...@gmx.com> on 2012/04/04 12:23:55 UTC

Regex variable using param file

Hi All

 I am trying to use param file to import certain regex variables into Pig

 I have file written something like

 isoDate = '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z'

 When i try to use it with

 pig -x local -param_file myparam mypig.pig

 I get error as

 2012-04-03 05:12:35,319 [main] ERROR org.apache.pig.Main - ERROR 2999: Unexpected internal error. String index out of range: 26

 The error log is

 ERROR 2999: Unexpected internal error. String index out of range: 26

 java.lang.StringIndexOutOfBoundsException: String index out of range: 26
 at java.lang.String.charAt(String.java:686)
 at java.util.regex.Matcher.appendReplacement(Matcher.java:711)
 at java.util.regex.Matcher.replaceFirst(Matcher.java:861)
 at java.lang.String.replaceFirst(String.java:2146)
 at org.apache.pig.tools.parameters.PreprocessorContext.substitute(PreprocessorContext.java:236)
 at org.apache.pig.tools.parameters.PigFileParser.input(PigFileParser.java:65)
 at org.apache.pig.tools.parameters.PigFileParser.Parse(PigFileParser.java:43)
 at org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor.parsePigFile(ParameterSubstitutionPreprocessor.java:105)
 at org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor.genSubstitutedFile(ParameterSubstitutionPreprocessor.java:98)
 at org.apache.pig.Main.runParamPreprocessor(Main.java:718)
 at org.apache.pig.Main.run(Main.java:525)
 at org.apache.pig.Main.main(Main.java:111)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
 ================================================================================

 The error i feel points at incorrect parsing of regex , but i was not able to figure it out.

 Can you guys help.

 Thanks in advance

 :)

Re: Regex variable using param file

Posted by Bill Graham <bi...@gmail.com>.
This error is happening when trying to substitute this value into your pig
script. What does mypig.pig look like?

On Wed, Apr 4, 2012 at 3:23 AM, Shin Chan <ha...@gmx.com> wrote:

> Hi All
>
>  I am trying to use param file to import certain regex variables into Pig
>
>  I have file written something like
>
>  isoDate = '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z'
>
>  When i try to use it with
>
>  pig -x local -param_file myparam mypig.pig
>
>  I get error as
>
>  2012-04-03 05:12:35,319 [main] ERROR org.apache.pig.Main - ERROR 2999:
> Unexpected internal error. String index out of range: 26
>
>  The error log is
>
>  ERROR 2999: Unexpected internal error. String index out of range: 26
>
>  java.lang.StringIndexOutOfBoundsException: String index out of range: 26
>  at java.lang.String.charAt(String.java:686)
>  at java.util.regex.Matcher.appendReplacement(Matcher.java:711)
>  at java.util.regex.Matcher.replaceFirst(Matcher.java:861)
>  at java.lang.String.replaceFirst(String.java:2146)
>  at
> org.apache.pig.tools.parameters.PreprocessorContext.substitute(PreprocessorContext.java:236)
>  at
> org.apache.pig.tools.parameters.PigFileParser.input(PigFileParser.java:65)
>  at
> org.apache.pig.tools.parameters.PigFileParser.Parse(PigFileParser.java:43)
>  at
> org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor.parsePigFile(ParameterSubstitutionPreprocessor.java:105)
>  at
> org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor.genSubstitutedFile(ParameterSubstitutionPreprocessor.java:98)
>  at org.apache.pig.Main.runParamPreprocessor(Main.java:718)
>  at org.apache.pig.Main.run(Main.java:525)
>  at org.apache.pig.Main.main(Main.java:111)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:597)
>  at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
>
>  ================================================================================
>
>  The error i feel points at incorrect parsing of regex , but i was not
> able to figure it out.
>
>  Can you guys help.
>
>  Thanks in advance
>
>  :)
>



-- 
*Note that I'm no longer using my Yahoo! email address. Please email me at
billgraham@gmail.com going forward.*