NPE thrown by ABS
-----------------

                 Key: PIG-2155
                 URL: https://issues.apache.org/jira/browse/PIG-2155
             Project: Pig
          Issue Type: Bug
    Affects Versions: 0.9.0
            Reporter: Shubham Chopra


Input data :
--file 'a' starts--
A|1
B|2

--file 'a' ends--
(Note the empty line at the end)

The following script does not work.
a = load 'a' using PigStorage('|') as (x:chararray, y:double);
b = foreach a generate *, ABS(y - 2*y) as test;
dump b;

The function ABS throws a NPE instead of giving out a null for the last line in 
the input:
java.lang.NullPointerException
        at org.apache.pig.builtin.DoubleAbs.exec(DoubleAbs.java:45)
        at org.apache.pig.builtin.DoubleAbs.exec(DoubleAbs.java:28)
        at 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc.getNext(POUserFunc.java:216)
        at 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc.getNext(POUserFunc.java:281)
        at 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.getNext(PhysicalOperator.java:324)
        at 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.processPlan(POForEach.java:332)
        at 
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNext(POForEach.java:284)
        at 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapBase.runPipeline(PigMapBase.java:261)
        at 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapBase.map(PigMapBase.java:256)
        at 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapBase.map(PigMapBase.java:58)
        at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:621)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305)
        at org.apache.hadoop.mapred.Child.main(Child.java:170)


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to