(query, query_config)
| 54 | |
| 55 | |
| 56 | def execute_using_hive_hs2(query, query_config): |
| 57 | exec_result = HiveQueryResult(query, query_config=query_config) |
| 58 | plugin_runner = query_config.plugin_runner |
| 59 | cursor = getattr(threading.current_thread(), 'cursor', None) |
| 60 | if cursor is None: |
| 61 | cursor = get_hs2_hive_cursor(query_config.hiveserver, |
| 62 | user=query_config.user, |
| 63 | database=query.db, |
| 64 | use_kerberos=query_config.use_kerberos, |
| 65 | execOptions=query_config.exec_options) |
| 66 | threading.current_thread().cursor = cursor |
| 67 | |
| 68 | if cursor is None: return exec_result |
| 69 | |
| 70 | if plugin_runner: plugin_runner.run_plugins_pre(scope="Query") |
| 71 | try: |
| 72 | exec_result.start_time, start = datetime.now(), time() |
| 73 | cursor.execute(query.query_str) |
| 74 | exec_result.data = cursor.fetchall() |
| 75 | exec_result.time_taken = time() - start |
| 76 | exec_result.success = True |
| 77 | except Exception as e: |
| 78 | LOG.error(str(e)) |
| 79 | exec_result.query_error = str(e) |
| 80 | finally: |
| 81 | if plugin_runner: plugin_runner.run_plugins_post(scope="Query") |
| 82 | return exec_result |
| 83 | |
| 84 | |
| 85 | def get_hs2_impala_cursor(impalad, use_kerberos=False, database=None): |
nothing calls this directly
no test coverage detected