diff --git a/airflow/hooks/hive_hooks.py b/airflow/hooks/hive_hooks.py
index <HASH>..<HASH> 100644
--- a/airflow/hooks/hive_hooks.py
+++ b/airflow/hooks/hive_hooks.py
@@ -74,7 +74,7 @@ class HiveCliHook(BaseHook):
 
         with TemporaryDirectory(prefix='airflow_hiveop_') as tmp_dir:
             with NamedTemporaryFile(dir=tmp_dir) as f:
-                f.write(hql)
+                f.write(bytes(hql, 'UTF-8'))
                 f.flush()
                 fname = f.name
                 hive_bin = 'hive'
Convert to bytes for py3 compat