Santhosh Srinivasan commented on PIG-796:

Pig supports conversion of numeric types to chararray. The issue being talked 
about in this jira is about conversion of types that come out of maps. 
Currently, Pig assumes that bytearray is the type of the value. However, when 
users use non-bytearray types, (like Double, Integer, etc.), then conversions 
fail. Pig is expecting a bytearray and finds a different type, resulting in 

An example to illustrate the point. In the script below, the user is explicitly 
casting the value to a chararray. If the map returns an Integer or a Double, 
then Pig will bail out with a ClassCastException.

foreach input generate (chararray)mymap#'key' as myvalue;

A proposal to address this issue.

Instead of bailing out, Pig should examine the type of the value. Depending on 
the expected type (implicit/explicit casts), perform a conversion. These 
changes are localized to the POCast.java The implication of this change is a 
possible slower performance that can be minimized by caching the value type.

On a side note, this issue plays a role in the larger issue of handling unknown 
types. That is a much bigger topic.

> support  conversion from numeric types to chararray
> ---------------------------------------------------
>                 Key: PIG-796
>                 URL: https://issues.apache.org/jira/browse/PIG-796
>             Project: Pig
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Olga Natkovich

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