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

Graham Lea commented on PIG-2303:
---------------------------------

Hi Daniel.

If you just add a schema to the definition of 'C' in your own script, you will 
see the problem:
{code}
C = foreach B generate MAX(A.name) as maxName: chararray; 
{code}

Result:
{noformat}
ERROR 1022: Type mismatch merging schema prefix. Field Schema: double. Other 
Field Schema: maxName: chararray
{noformat}

Interestingly, without the schema a describe of C produces "C: {chararray}".
So it seems that the type of the function is correct (chararray in, chararray 
out) but perhaps the schema processing of FOREACH is incorrectly inferring the 
result type to be double?
                
> Documentation says the MAX function can be used on chararray, but it can't
> --------------------------------------------------------------------------
>
>                 Key: PIG-2303
>                 URL: https://issues.apache.org/jira/browse/PIG-2303
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.9.0
>            Reporter: Graham Lea
>            Priority: Trivial
>
> Here: http://pig.apache.org/docs/r0.9.0/func.html#max
> It says MIN/Max can be used on chararray, but the result of those functions 
> is always a double.
> Had to search through the Pig Javadoc to find that I should use 
> StringMin/StringMax instead.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to