You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Santhosh Srinivasan (JIRA)" <ji...@apache.org> on 2009/05/12 03:08:45 UTC

[jira] Commented: (PIG-796) support conversion from numeric types to chararray

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

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 ClassCastException.

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.

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

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.