Details
Description
The simplest way to do this is the following:
1) Download the hive tarball for CDH4.1.1
2) Unpack the tarball and copy the lib/py/thrift directory (found in any version of the Thrift source) into src/service/src/gen/thrift/gen-py
- For this repro I used version 0.7.0, but this can be seen all the way until tip
3) Run:
$ python
4) Type:
>>> from cli_service import TCLIService
The following stacktrace should appear
Python 2.6.8 (default, Sep 21 2012, 13:41:09)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from cli_service import TCLIService
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cli_service/TCLIService.py", line 8, in <module>
from ttypes import *
File "cli_service/ttypes.py", line 344, in <module>
class TPrimitiveTypeEntry:
File "cli_service/ttypes.py", line 352, in TPrimitiveTypeEntry
(1, TType.I32, 'type', None, None, ), # 1
AttributeError: class TType has no attribute 'I32'
This occurs because the python interpreter, when importing modules, ignores those that have already been imported and it thinks TType has already been imported. It then attempts to reference the local TType class, which has no I32 attribute. Changing the name of TType to TValueType in hive_service.thrift or something else that is more distinctly named solves this problem.
See also the comment on https://issues.apache.org/jira/browse/HIVE-2935?focusedCommentId=13485744&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13485744