You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Mathias Fryde <ma...@mimesis-republic.com> on 2009/02/16 14:36:14 UTC

casting map values

Hello ,
I have a map with a Int in it, something like : [*data:userID#232340*
,data:Time#1234464616347L,metaData:agentVersion#1.0-beta,metaData:eventName#Event_PlayerAuthentication]

By doing this code :

*maptest =     LOAD 'myfile' USING PigStorage('\t')  AS ( themap: map [])  ;
A = FILTER maptest BY themap#'metaData:eventName' ==
'Event_PlayerAuthentication';
B = LIMIT A 15;
C = FOREACH B GENERATE themap#'data:userID' ;
D = FOREACH C GENERATE (chararray)$0;     -- in order to concat if it work
smth like CONCAT('toto',(chararray)$0)
DESCRIBE A;
DESCRIBE B;
DESCRIBE C;
DESCRIBE D;
DUMP D;*

I have the following Error message :
*
$ pig -x local myscript.pig
2009-02-16 14:33:53,616 [main] WARN  org.apache.hadoop.conf.Configuration -
bad conf file: element not <property>
2009-02-16 14:33:53,786 [main] WARN  org.apache.pig.PigServer - bytearray is
implicitly cast to chararray under LOEqual Operator
A: {themap: map[ ]}
2009-02-16 14:33:53,795 [main] WARN  org.apache.pig.PigServer - bytearray is
implicitly cast to chararray under LOEqual Operator
B: {themap: map[ ]}
2009-02-16 14:33:53,802 [main] WARN  org.apache.pig.PigServer - bytearray is
implicitly cast to chararray under LOEqual Operator
C: {bytearray}
2009-02-16 14:33:53,808 [main] WARN  org.apache.pig.PigServer - bytearray is
implicitly cast to chararray under LOEqual Operator
D: {chararray}
2009-02-16 14:33:53,827 [main] WARN  org.apache.pig.PigServer - bytearray is
implicitly cast to chararray under LOEqual Operator
2009-02-16 14:33:53,896 [main] ERROR
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POStore
- Received error from storer function:
org.apache.pig.backend.executionengine.ExecException: ERROR 1081: Cannot
cast to chararray. Expected bytearray but received: int
2009-02-16 14:33:53,898 [main] INFO
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Failed
jobs!!
2009-02-16 14:33:53,898 [main] INFO
org.apache.pig.backend.local.executionengine.LocalPigLauncher - 1 out of 1
failed!
2009-02-16 14:33:53,900 [main] ERROR org.apache.pig.tools.grunt.Grunt -
ERROR 1066: Unable to open iterator for alias D
Details at logfile: pig_1234791233483.log

ERROR 1066: Unable to open iterator for alias D
org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to
open iterator for alias D
    at org.apache.pig.PigServer.openIterator(PigServer.java:429)
    at
org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:350)
    at
org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:189)
    at
org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:98)
    at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:88)
    at org.apache.pig.Main.main(Main.java:323)
Caused by: java.io.IOException: Job terminated with anomalous status FAILED
    at org.apache.pig.PigServer.openIterator(PigServer.java:423)
    ... 5 more

*