Contains the results of a query execution. Parameters: Required: query (Query): The query object associated with this result. start_time (datetime): Timestamp at the start of execution. query_config (HiveHS2QueryExecConfig) client_name (int): The thread id Optiona
| 71 | |
| 72 | |
| 73 | class HiveQueryResult(object): |
| 74 | """Contains the results of a query execution. |
| 75 | |
| 76 | Parameters: |
| 77 | Required: |
| 78 | query (Query): The query object associated with this result. |
| 79 | start_time (datetime): Timestamp at the start of execution. |
| 80 | query_config (HiveHS2QueryExecConfig) |
| 81 | client_name (int): The thread id |
| 82 | |
| 83 | Optional: |
| 84 | time_taken (float): Time taken to execute the query. |
| 85 | summary (str): query exection summary (ex. returned 10 rows) |
| 86 | data (list of str): Query results returned by Impala. |
| 87 | success (bool): True if the execution was successful. |
| 88 | |
| 89 | Attributes - these are modified by another class: |
| 90 | query_error (str): Empty string if the query succeeded. Error returned by the client |
| 91 | if it failed. |
| 92 | executor_name (str) |
| 93 | """ |
| 94 | |
| 95 | def __init__(self, query, **kwargs): |
| 96 | self.query = query |
| 97 | self.time_taken = kwargs.get('time_taken', 0.0) |
| 98 | self._summary = kwargs.get('summary', str()) |
| 99 | self.data = kwargs.get('data', str()) |
| 100 | self.start_time = kwargs.get('start_time') |
| 101 | self.query_config = kwargs.get('query_config') |
| 102 | self.client_name = kwargs.get('client_name') |
| 103 | self.success = kwargs.get('success', False) |
| 104 | self.query_error = str() |
| 105 | self.executor_name = str() |
| 106 | |
| 107 | @property |
| 108 | def summary(self): |
| 109 | return self._summary |
| 110 | |
| 111 | @summary.setter |
| 112 | def summary(self, value): |
| 113 | self._summary = value |
| 114 | |
| 115 | def __str__(self): |
| 116 | """Print human readable query execution details""" |
| 117 | msg = "Query: %s, Start Time: %s, Time Taken: %s, Client Name: %s" % (self.query, |
| 118 | self.start_time, self.time_taken, self.client_name) |
| 119 | if not self.success: msg += " Error: %s" % self.query_error |
| 120 | return msg |
| 121 | |
| 122 | |
| 123 | class ImpalaQueryResult(HiveQueryResult): |
no outgoing calls
no test coverage detected