ashb commented on a change in pull request #5206: AIRFLOW-4434 fix support for 
impala in hive hook
URL: https://github.com/apache/airflow/pull/5206#discussion_r279709800
 
 

 ##########
 File path: airflow/hooks/hive_hooks.py
 ##########
 @@ -797,11 +801,14 @@ def _get_results(self, hql, schema='default', 
fetch_size=None, hive_conf=None):
                 contextlib.closing(conn.cursor()) as cur:
             cur.arraysize = fetch_size or 1000
 
-            env_context = get_context_from_env_var()
-            if hive_conf:
-                env_context.update(hive_conf)
-            for k, v in env_context.items():
-                cur.execute("set {}={}".format(k, v))
+            # not all query services (e.g. impala AIRFLOW-4434) support the 
set command
+            db = self.get_connection(self.hiveserver2_conn_id)
+            if not db.extra_dejson.get('run_set_variable_statements', 
'true').lower() == 'false':
 
 Review comment:
   If it's json why is this checking strings rather than True/False? Also the 
`if not x == 'false'` is a double negative which we should avoid:
   
   ```suggestion
               if db.extra_dejson.get('run_set_variable_statements', True):
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to