Implementation of result fetching from handle.
(self, handle, max_rows=-1,
discard_results=False,
fetch_exec_summary=False,
profile_format=TRuntimeProfileFormat.STRING)
| 852 | return self.__fetch_results(operation_handle, max_rows, discard_results) |
| 853 | |
| 854 | def __fetch_results(self, handle, max_rows=-1, |
| 855 | discard_results=False, |
| 856 | fetch_exec_summary=False, |
| 857 | profile_format=TRuntimeProfileFormat.STRING): |
| 858 | """Implementation of result fetching from handle.""" |
| 859 | cursor = handle.get_handle() |
| 860 | assert cursor is not None |
| 861 | # Don't fetch data for queries with no results. |
| 862 | result_tuples = None |
| 863 | column_labels = None |
| 864 | column_types = None |
| 865 | if cursor.has_result_set: |
| 866 | desc = cursor.description |
| 867 | column_labels = [col_desc[0].upper() for col_desc in desc] |
| 868 | column_types = [col_desc[1].upper() for col_desc in desc] |
| 869 | if max_rows < 0: |
| 870 | result_tuples = cursor.fetchall() |
| 871 | else: |
| 872 | result_tuples = cursor.fetchmany(max_rows) |
| 873 | |
| 874 | result = None |
| 875 | if discard_results: |
| 876 | return result |
| 877 | |
| 878 | log = None |
| 879 | profile = None |
| 880 | exec_summary = None |
| 881 | if not self._is_hive: |
| 882 | if fetch_exec_summary: |
| 883 | exec_summary = self.get_exec_summary_table(handle) |
| 884 | if self._collect_profile_and_log: |
| 885 | log = self.get_log(handle) |
| 886 | profile = self.get_runtime_profile(handle, profile_format=profile_format) |
| 887 | |
| 888 | result = ImpylaHS2ResultSet(success=True, result_tuples=result_tuples, |
| 889 | column_labels=column_labels, column_types=column_types, |
| 890 | query=handle.sql_stmt(), log=log, profile=profile, |
| 891 | query_id=self.get_query_id(handle), |
| 892 | exec_summary=exec_summary) |
| 893 | return result |
| 894 | |
| 895 | |
| 896 | class ImpylaHS2ResultSet(object): |
no test coverage detected