FAQ
Strings (or other typed data) stored in maps cause problems with implicit casts in operations
---------------------------------------------------------------------------------------------

Key: PIG-463
URL: https://issues.apache.org/jira/browse/PIG-463
Project: Pig
Issue Type: Bug
Affects Versions: types_branch
Reporter: Pradeep Kamath
Assignee: Pradeep Kamath
Fix For: types_branch


If a map in pig (say returned from a UDF) has a key with the value being a string, then a lookup of that key being used in a context which expects a string will cause an implicit cast to a string. This is because the Pig frontented (logical layer) thinks of all map "values" as bytearrays and hence introduces a Cast to convert the bytearray to string. The POCast class then assumes its input is a DataByteArray and first tries to cast its input to DataByteArray. This fails because the object in the input to the case which is the value in the map is in fact already a string. So in these cases, we should not try to cast but just return the input object in the POCast.

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

Search Discussions

  • Pradeep Kamath (JIRA) at Sep 27, 2008 at 5:54 am
    [ https://issues.apache.org/jira/browse/PIG-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Pradeep Kamath updated PIG-463:
    -------------------------------

    Attachment: PIG-463.patch

    Attached patch - augments TestPOCast to test for the fix.
    TestJobSubmission and TestLocalJobSubmission unit tests fail but were failing even before the patch on the current code in svn and are not due to the patch
    Strings (or other typed data) stored in maps cause problems with implicit casts in operations
    ---------------------------------------------------------------------------------------------

    Key: PIG-463
    URL: https://issues.apache.org/jira/browse/PIG-463
    Project: Pig
    Issue Type: Bug
    Affects Versions: types_branch
    Reporter: Pradeep Kamath
    Assignee: Pradeep Kamath
    Fix For: types_branch

    Attachments: PIG-463.patch


    If a map in pig (say returned from a UDF) has a key with the value being a string, then a lookup of that key being used in a context which expects a string will cause an implicit cast to a string. This is because the Pig frontented (logical layer) thinks of all map "values" as bytearrays and hence introduces a Cast to convert the bytearray to string. The POCast class then assumes its input is a DataByteArray and first tries to cast its input to DataByteArray. This fails because the object in the input to the case which is the value in the map is in fact already a string. So in these cases, we should not try to cast but just return the input object in the POCast.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Olga Natkovich (JIRA) at Sep 27, 2008 at 4:56 pm
    [ https://issues.apache.org/jira/browse/PIG-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Olga Natkovich updated PIG-463:
    -------------------------------

    Status: Patch Available (was: Open)
    Strings (or other typed data) stored in maps cause problems with implicit casts in operations
    ---------------------------------------------------------------------------------------------

    Key: PIG-463
    URL: https://issues.apache.org/jira/browse/PIG-463
    Project: Pig
    Issue Type: Bug
    Affects Versions: types_branch
    Reporter: Pradeep Kamath
    Assignee: Pradeep Kamath
    Fix For: types_branch

    Attachments: PIG-463.patch


    If a map in pig (say returned from a UDF) has a key with the value being a string, then a lookup of that key being used in a context which expects a string will cause an implicit cast to a string. This is because the Pig frontented (logical layer) thinks of all map "values" as bytearrays and hence introduces a Cast to convert the bytearray to string. The POCast class then assumes its input is a DataByteArray and first tries to cast its input to DataByteArray. This fails because the object in the input to the case which is the value in the map is in fact already a string. So in these cases, we should not try to cast but just return the input object in the POCast.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Olga Natkovich (JIRA) at Sep 27, 2008 at 7:46 pm
    [ https://issues.apache.org/jira/browse/PIG-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Olga Natkovich updated PIG-463:
    -------------------------------

    Resolution: Fixed
    Status: Resolved (was: Patch Available)

    patch committed; thanks, pradeep
    Strings (or other typed data) stored in maps cause problems with implicit casts in operations
    ---------------------------------------------------------------------------------------------

    Key: PIG-463
    URL: https://issues.apache.org/jira/browse/PIG-463
    Project: Pig
    Issue Type: Bug
    Affects Versions: types_branch
    Reporter: Pradeep Kamath
    Assignee: Pradeep Kamath
    Fix For: types_branch

    Attachments: PIG-463.patch


    If a map in pig (say returned from a UDF) has a key with the value being a string, then a lookup of that key being used in a context which expects a string will cause an implicit cast to a string. This is because the Pig frontented (logical layer) thinks of all map "values" as bytearrays and hence introduces a Cast to convert the bytearray to string. The POCast class then assumes its input is a DataByteArray and first tries to cast its input to DataByteArray. This fails because the object in the input to the case which is the value in the map is in fact already a string. So in these cases, we should not try to cast but just return the input object in the POCast.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriespig, hadoop
postedSep 26, '08 at 8:58p
activeSep 27, '08 at 7:46p
posts4
users1
websitepig.apache.org

1 user in discussion

Olga Natkovich (JIRA): 4 posts

People

Translate

site design / logo © 2022 Grokbase