[ 
https://issues.apache.org/jira/browse/PIG-427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635018#action_12635018
 ] 

Olga Natkovich commented on PIG-427:
------------------------------------

I am seeing 2 problems with the patch while ranning some tests:

Script 1:

a = load 'studentnulltab10k' as (name:chararray, age:int, gpa:double);
b = group a ALL;
c = foreach b generate SUM(a.age);

the output looks like:

(449650.0)

Notice that it got casted to double even though we have version of SUM that 
accepts an int and produces long

Script 2:

a = load 'studentnulltab10k' as (name:chararray, age:int, gpa:double);
b = group a ALL;
c = foreach b generate MIN(a.name);

This query fails with the following error stack:

2008-09-26 13:54:28,374 [main] ERROR 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.Launcher - Error 
message from task (map) task_200809241441_1550_m_000000java.io.IOException: 
Received Error while processing the reduce plan.
        at 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigCombiner$Combine.reduce(PigCombiner.java:166)
        at 
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigCombiner$Combine.reduce(PigCombiner.java:56)
        at 
org.apache.hadoop.mapred.MapTask$MapOutputBuffer.combineAndSpill(MapTask.java:904)
        at 
org.apache.hadoop.mapred.MapTask$MapOutputBuffer.sortAndSpill(MapTask.java:785)
        at 
org.apache.hadoop.mapred.MapTask$MapOutputBuffer.flush(MapTask.java:698)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:228)
        at 
org.apache.hadoop.mapred.TaskTracker$Child.main(TaskTracker.java:2207)


> casting parameters of a UDF
> ---------------------------
>
>                 Key: PIG-427
>                 URL: https://issues.apache.org/jira/browse/PIG-427
>             Project: Pig
>          Issue Type: Improvement
>    Affects Versions: types_branch
>            Reporter: Olga Natkovich
>            Assignee: Shravan Matthur Narayanamurthy
>             Fix For: types_branch
>
>         Attachments: 427-1.patch, 427-2.patch, 427.patch
>
>
> Currently if we have a UDF that declares via getArgToFuncMapping that it can 
> only handle a subset of types, passing any other types to the function would 
> result in an error. However, some types can be promoted to others and it 
> would be useful if typechecker to perform best fit cast. For instance, if the 
> input parameter has type of Long and the UDF support Int and Double, the code 
> should cast the paraneter into Double.
> This would be very useful for conversion of the UDFs from the piigybank to 
> the new code.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to