(self)
| 84 | client.close_query(handle) |
| 85 | |
| 86 | def test_client_fetch_time_stats(self): |
| 87 | num_rows = 27 |
| 88 | client = MinimalHS2Connection(IMPALAD_HS2_HOST_PORT) |
| 89 | query = "select sleep(10) from functional.alltypes limit {0}".format(num_rows) |
| 90 | handle = client.execute_async(query) |
| 91 | try: |
| 92 | # Wait until the query is 'FINISHED' and results are available for fetching. |
| 93 | client.wait_for_finished_timeout(handle, 30) |
| 94 | |
| 95 | # This loop will do 6 fetches that contain data and a final fetch with |
| 96 | # no data. The last fetch is after eos has been set, so it does not count. |
| 97 | rows_fetched = 0 |
| 98 | while True: |
| 99 | result = client.fetch(query, handle, max_rows=5) |
| 100 | assert result is not None |
| 101 | rows_fetched += len(result) |
| 102 | # If no rows are returned, we are done. |
| 103 | if len(result) == 0: |
| 104 | break |
| 105 | sleep(0.1) |
| 106 | |
| 107 | # After fetching all rows, sleep before closing the query. This should not |
| 108 | # count as client wait time, because the query is already done. |
| 109 | sleep(2.5) |
| 110 | finally: |
| 111 | client.close_query(handle) |
| 112 | |
| 113 | runtime_profile = client.get_runtime_profile(handle) |
| 114 | |
| 115 | summary_stats = get_time_summary_stats_counter("ClientFetchWaitTimeStats", |
| 116 | runtime_profile) |
| 117 | assert len(summary_stats) == 1 |
| 118 | assert summary_stats[0].total_num_values == 6 |
| 119 | # The 2.5 second sleep should not count, so the max must be less than 2.5 seconds. |
| 120 | assert summary_stats[0].max_value < 2500000000 |
| 121 | assert summary_stats[0].min_value > 0 |
| 122 | client.close() |
| 123 | |
| 124 | def test_client_fetch_time_stats_incomplete(self): |
| 125 | num_rows = 27 |
nothing calls this directly
no test coverage detected