hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samuel Yuan (JIRA)" <>
Subject [jira] [Updated] (HIVE-4322) SkewedInfo in Metastore Thrift API cannot be deserialized in Python
Date Fri, 12 Apr 2013 02:07:18 GMT


Samuel Yuan updated HIVE-4322:

    Status: Patch Available  (was: Open)
> SkewedInfo in Metastore Thrift API cannot be deserialized in Python
> -------------------------------------------------------------------
>                 Key: HIVE-4322
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore, Thrift API
>    Affects Versions: 0.11.0
>            Reporter: Samuel Yuan
>            Assignee: Samuel Yuan
>            Priority: Minor
>         Attachments: HIVE-4322.HIVE-4322.HIVE-4322.HIVE-4322.D10203.1.patch
> The Thrift-generated Python code that deserializes Thrift objects fails whenever a complex
type is used as a map key, because by default mutable Python objects such as lists do not
have a hash function. See for related discussion.
> The SkewedInfo struct contains a map which uses a list as a key, breaking the Python
Thrift interface. It is not possible to specify the mapping from Thrift types to Python types,
or otherwise we could map Thrift lists to Python tuples. Instead, the proposed workaround
wraps the list inside a new struct. This alone does not accomplish anything, but allows Python
clients to define a hash function for the struct class, e.g.:
> def f(object):
>     return hash(tuple(object.skewedValueList))
> SkewedValueList.__hash__ = f
> In practice a more efficient hash might be defined that does not involve copying the
list. The advantage of wrapping the list inside a struct is that the client does not have
to define the hash on the list itself, which would change the behaviour of lists everywhere
else in the code.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message