def _create_executor(self, executor_name): query_options = { 'impala_beeswax': lambda: (execute_using_impala_beeswax, BeeswaxQueryExecConfig(plugin_runner=self.config.plugin_runner, exec_options=self.config.exec_options, use_kerberos=self.config.use_kerberos, user=self.config.user if self.config.password else None, password=self.config.password, use_ssl=self.config.use_ssl )), 'impala_jdbc': lambda: (execute_using_jdbc, JdbcQueryExecConfig(plugin_runner=self.config.plugin_runner) ), 'impala_hs2': lambda: (execute_using_impala_hs2, ImpalaHS2QueryConfig(plugin_runner=self.config.plugin_runner, use_kerberos=self.config.use_kerberos )), 'hive_hs2': lambda: (execute_using_hive_hs2, HiveHS2QueryConfig(hiveserver=self.config.hiveserver, plugin_runner=self.config.plugin_runner, exec_options=self.config.exec_options, user=self.config.user, use_kerberos=self.config.use_kerberos )) } [executor_name]() return query_options
def exec_and_compare_hive_and_impala_hs2(self, stmt, compare = lambda x, y: x == y): """Compare Hive and Impala results when executing the same statment over HS2""" # execute_using_jdbc expects a Query object. Convert the query string into a Query # object query = Query() query.query_str = stmt # Run the statement targeting Hive exec_opts = JdbcQueryExecConfig(impalad=HIVE_HS2_HOST_PORT, transport='SASL') hive_results = execute_using_jdbc(query, exec_opts).data # Run the statement targeting Impala exec_opts = JdbcQueryExecConfig(impalad=IMPALAD_HS2_HOST_PORT, transport='NOSASL') impala_results = execute_using_jdbc(query, exec_opts).data # Compare the results assert (impala_results is not None) and (hive_results is not None) assert compare(impala_results, hive_results)
def exec_and_compare_hive_and_impala_hs2(self, stmt): """Compare Hive and Impala results when executing the same statment over HS2""" # execute_using_jdbc expects a Query object. Convert the query string into a Query # object query = Query() query.query_str = stmt # Run the statement targeting Hive exec_opts = JdbcQueryExecConfig(impalad=HIVE_HS2_HOST_PORT) hive_results = execute_using_jdbc(query, exec_opts).data # Run the statement targeting Impala exec_opts = JdbcQueryExecConfig(impalad=IMPALAD_HS2_HOST_PORT) impala_results = execute_using_jdbc(query, exec_opts).data # Compare the results assert (impala_results is not None) and (hive_results is not None) for impala, hive in zip(impala_results, hive_results): assert impala == hive
def _create_executor(self, executor_name): query_options = { 'impala_beeswax': lambda: (execute_using_impala_beeswax, BeeswaxQueryExecConfig(plugin_runner=self.config.plugin_runner, exec_options=self.config.exec_options, use_kerberos=self.config.use_kerberos, )), 'jdbc': lambda: (execute_using_jdbc, JdbcQueryExecConfig(plugin_runner=self.config.plugin_runner) ) } [executor_name]() return query_options