python connection impala, SQL execution error expecting list of size 2 for struct args

This error troubled for a long time, because more than one cluster, temporarily put on several other machines to perform the SQL operations, has been looking for a solution, inadvertently get it completely, overjoyed ah

Error message:

Traceback (most recent call last):
  File "b.py", line 3, in <module>
    cur=conn.cursor()
  File "/usr/local/python2.7/lib/python2.7/site-packages/impyla-v0.14.0-py2.7.egg/impala/hiveserver2.py", line 125, in cursor
    session = self.service.open_session(user, configuration)
  File "/usr/local/python2.7/lib/python2.7/site-packages/impyla-v0.14.0-py2.7.egg/impala/hiveserver2.py", line 995, in open_session
    resp = self._rpc('OpenSession', req)
  File "/usr/local/python2.7/lib/python2.7/site-packages/impyla-v0.14.0-py2.7.egg/impala/hiveserver2.py", line 923, in _rpc
    response = self._execute(func_name, request)
  File "/usr/local/python2.7/lib/python2.7/site-packages/impyla-v0.14.0-py2.7.egg/impala/hiveserver2.py", line 940, in _execute
    return func(request)
  File "/usr/local/python2.7/lib/python2.7/site-packages/impyla-v0.14.0-py2.7.egg/impala/_thrift_gen/TCLIService/TCLIService.py", line 174, in OpenSession
    self.send_OpenSession(req)
  File "/usr/local/python2.7/lib/python2.7/site-packages/impyla-v0.14.0-py2.7.egg/impala/_thrift_gen/TCLIService/TCLIService.py", line 181, in send_OpenSession
    args.write(self._oprot)
  File "/usr/local/python2.7/lib/python2.7/site-packages/impyla-v0.14.0-py2.7.egg/impala/_thrift_gen/TCLIService/TCLIService.py", line 1069, in write
    oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
TypeError: expecting list of size 2 for struct args

Solution:

[root@cdh3 tmp]# pip install thrift==0.9.3
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting thrift==0.9.3
  Downloading http://mirrors.tencentyun.com/pypi/packages/ae/58/35e3f0cd290039ff862c2c9d8ae8a76896665d70343d833bdc2f748b8e55/thrift-0.9.3.tar.gz
Installing collected packages: thrift
  Found existing installation: thrift 0.13.0
    Uninstalling thrift-0.13.0:
      Successfully uninstalled thrift-0.13.0
  Running setup.py install for thrift ... done
Successfully installed thrift-0.9.3

The reason: It should be thrift module version of the problem

Thrift is a Facebook rpc service framework for cross-language developed in 2007 to provide multi-language compiler functions, and provides a variety of server operating mode; to describe the user interface functions and data types through the Thrift IDL (Interface Definition Language), then by Thrift build environment to generate various types of language interface files, the user can according to their needs using different language to develop client-side code and server-side code.

 

Guess you like

Origin www.cnblogs.com/hello-wei/p/11899490.html