MCPcopy Create free account
hub / github.com/apache/impala / execute_using_hive_hs2

Function execute_using_hive_hs2

tests/performance/query_exec_functions.py:56–82  ·  view source on GitHub ↗
(query, query_config)

Source from the content-addressed store, hash-verified

54
55
56def 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
85def get_hs2_impala_cursor(impalad, use_kerberos=False, database=None):

Callers

nothing calls this directly

Calls 9

HiveQueryResultClass · 0.90
get_hs2_hive_cursorFunction · 0.85
timeFunction · 0.85
current_threadMethod · 0.80
run_plugins_preMethod · 0.80
nowMethod · 0.80
run_plugins_postMethod · 0.80
executeMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected