PyHive icon indicating copy to clipboard operation
PyHive copied to clipboard

Fix #144, don't show unrelated assertion

Open ttogola opened this issue 7 years ago β€’ 2 comments

Fixes #144 by correctly setting the state after an invalid hive execute.

Whenever a fetch is invoked, there are checks in DBAPICursor.fetchone to determine whether the current state is _STATE_NONE or _STATE_FINISHED. https://github.com/dropbox/PyHive/blob/master/pyhive/common.py#L101 https://github.com/dropbox/PyHive/blob/master/pyhive/common.py#L105

On the presto side, an invalid execute results in _STATE_FINISHED and subsequent fetches return nothing. https://github.com/dropbox/PyHive/blob/master/pyhive/presto.py#L280

To keep consistency, my proposed change on the hive side also sets the state to _STATE_FINISHED when an invalid execute is detected. @jingw if we prefer that a ProgrammingError be raised I can instead set the state to _STATE_NONE such that the ProgrammingError is triggered on subsequent fetches. We could also create a new state, something like _STATE_FAILED.

(Dropbox CLA signed)

ttogola avatar Oct 31 '17 09:10 ttogola

Codecov Report

Merging #172 into master will increase coverage by 0.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #172      +/-   ##
==========================================
+ Coverage   95.71%   95.72%   +0.01%     
==========================================
  Files          14       14              
  Lines        1422     1426       +4     
  Branches      147      147              
==========================================
+ Hits         1361     1365       +4     
  Misses         40       40              
  Partials       21       21
Impacted Files Coverage Ξ”
pyhive/hive.py 90.27% <100%> (+0.18%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 8cda132...d39669a. Read the comment docs.

codecov-io avatar Oct 31 '17 09:10 codecov-io

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Tieme Togola seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 16 '22 21:04 CLAassistant