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

Rohini Palaniswamy commented on PIG-4734:
-----------------------------------------

Doesn't it relax the type checking too much?

{code}
public static LogicalFieldSchema merge(LogicalFieldSchema fs1, 
LogicalFieldSchema fs2, MergeMode mode) {
.....
            /else {
                // Union schema
                if (fs1.type==DataType.BYTEARRAY) {
                    mergedType=fs2.type;
                } else if (fs2.type==DataType.BYTEARRAY) {
                    mergedType = fs1.type;
                }
                else {
                    // Take the more specific type
                    mergedType = DataType.mergeType(fs1.type, fs2.type);
                    if (mergedType == DataType.ERROR) {
                        // True incompatible, set to bytearray
                        mergedType = DataType.BYTEARRAY;
                    }
                }
            }
....
}
{code}

> TOMAP schema inferring breaks some scripts in type checking for bincond
> -----------------------------------------------------------------------
>
>                 Key: PIG-4734
>                 URL: https://issues.apache.org/jira/browse/PIG-4734
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Rohini Palaniswamy
>            Assignee: Daniel Dai
>             Fix For: 0.16.0, 0.15.1
>
>         Attachments: PIG-4734-1.patch
>
>
> PIG-4674 added schema inferring for TOMAP.
> {code}
> FOREACH A GENERATE (val == 'x' ? TOMAP('key', floatfield1) : (val == 'y' ? 
> GenerateFloatMap('key', floatfield2) : NULL)) as floatmap:map[float],
> {code}
> The following line fails with
> {code}
> Two inputs of BinCond must have compatible schemas. left hand side: 
> #675:map(#676:float) right hand side: #801:map
>       at 
> org.apache.pig.newplan.logical.visitor.TypeCheckingExpVisitor.visit(TypeCheckingExpVisitor.java:616)
>       ... 45 more
> {code}
> GenerateFloatMap is a UDF that returns new HashMap<String, Float>(), but does 
> not have outputSchema() defined. It worked earlier because TOMAP also did not 
> have outputSchema() defined.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to