Note that there are some explanatory texts on larger screens.

plurals
  1. POpig REPLACE gives error
    text
    copied!<p>Let's assume that my file is named 'data' and looks like this:</p> <p>2343234 {23.8375,-2.339921102} {(343.34333,-2.0000022)} 5-23-2013-11-am</p> <p>I need to convert the 2nd field to a pair of coordinate numbers. So I wrote the follwoing code and called it basic.pig:</p> <pre><code>A = LOAD 'data' AS (f1:int, f2:chararray, f3:chararray. f4:chararray); B = foreach A generate STRSPLIT(f2,',').$0 as f5, STRSPLIT(f2,',').$1 as f6; C = foreach B generate REPLACE(f5,'{',' ') as f7, REPLACE(f6,'}',' ') as f8; </code></pre> <p>and then used (float) to convert the string to a float. But, the command 'REPLACE' fails to work and I get the following error:</p> <pre><code>-bash-3.2$ pig -x local basic.pig 2013-06-24 16:38:45,030 [main] INFO org.apache.pig.Main - Apache Pig version 0.11.1 (r1459641) compiled Mar 22 2013, 02:13:53 2013-06-24 16:38:45,031 [main] INFO org.apache.pig.Main - Logging error messages to: /home/--/p/--test/pig_1372117125028.log 2013-06-24 16:38:45,321 [main] INFO org.apache.pig.impl.util.Utils - Default bootup file /home/isl/pmahboubi/.pigbootup not found 2013-06-24 16:38:45,425 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: file:/// 2013-06-24 16:38:46,069 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during parsing. Lexical error at line 7, column 0. Encountered: &lt;EOF&gt; after : "" Details at logfile: /home/--/p/--test/pig_1372117125028.log </code></pre> <p>And this is the details of the pig_137..log</p> <pre><code>Pig Stack Trace --------------- ERROR 1000: Error during parsing. Lexical error at line 7, column 0. Encountered: &lt;EOF&gt; after : "" org.apache.pig.tools.pigscript.parser.TokenMgrError: Lexical error at line 7, column 0. Encountered: &lt;EOF&gt; after : "" at org.apache.pig.tools.pigscript.parser.PigScriptParserTokenManager.getNextToken(PigScriptParserTokenManager.java:3266) at org.apache.pig.tools.pigscript.parser.PigScriptParser.jj_ntk(PigScriptParser.java:1134) at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:104) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:170) at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:84) at org.apache.pig.Main.run(Main.java:604) at org.apache.pig.Main.main(Main.java:157) 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:197) ================================================================================ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload