-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement stop query functionality. (#2387)
* Implement stop query functionality. * Address comments
- Loading branch information
Showing
7 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from pyhive import presto | ||
|
||
|
||
# TODO(bogdan): Remove this when new pyhive release will be available. | ||
def cancel(self): | ||
if self._state == self._STATE_NONE: | ||
raise presto.ProgrammingError("No query yet") | ||
if self._nextUri is None: | ||
assert self._state == self._STATE_FINISHED, \ | ||
"Should be finished if nextUri is None" | ||
return | ||
|
||
response = presto.requests.delete(self._nextUri) | ||
if response.status_code != presto.requests.codes.no_content: | ||
fmt = "Unexpected status code after cancel {}\n{}" | ||
raise presto.OperationalError( | ||
fmt.format(response.status_code, response.content)) | ||
self._state = self._STATE_FINISHED | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters