cloudera / impyla

Python DB API 2.0 client for Impala and Hive (HiveServer2 protocol)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to tell if HS2Service is opened, it can fail close

EggDice opened this issue · comments

If the close() method is called on HS2Service it is possible that the _iprot is already closed, and it raises an exception:

File "/Users/eggdice/.pyenv/versions/3.6.2/lib/python3.6/site-packages/impala/hiveserver2.py", line 71, in close
    self.service.close()
  File "/Users/eggdice/.pyenv/versions/3.6.2/lib/python3.6/site-packages/impala/hiveserver2.py", line 1171, in close
    self.client._iprot.trans.close()
  File "/Users/eggdice/.pyenv/versions/3.6.2/lib/python3.6/site-packages/thrift/transport/TTransport.py", line 156, in close
    return self.__trans.close()
  File "/Users/eggdice/.pyenv/versions/3.6.2/lib/python3.6/site-packages/impala/_thrift_api.py", line 162, in close
    self.__http.close()
AttributeError: 'NoneType' object has no attribute 'close'

It should handle this edge case or it should expose an isOpen() method