Browse Source

HUE-5714 [hive] Close SQL canary query "Select "Hello World""

Impala too.
Romain Rigaux 8 năm trước cách đây
mục cha
commit
7065edbd8b

+ 8 - 1
apps/beeswax/src/beeswax/conf.py

@@ -29,6 +29,7 @@ from desktop.lib.exceptions import StructuredThriftTransportException
 
 
 from beeswax.settings import NICE_NAME
 from beeswax.settings import NICE_NAME
 
 
+
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 
 
 
@@ -220,6 +221,7 @@ AUTH_PASSWORD_SCRIPT = Config(
 def config_validator(user):
 def config_validator(user):
   # dbms is dependent on beeswax.conf (this file)
   # dbms is dependent on beeswax.conf (this file)
   # import in method to avoid circular dependency
   # import in method to avoid circular dependency
+  from beeswax.design import hql_query
   from beeswax.server import dbms
   from beeswax.server import dbms
 
 
   res = []
   res = []
@@ -227,7 +229,12 @@ def config_validator(user):
     try:
     try:
       if not 'test' in sys.argv: # Avoid tests hanging
       if not 'test' in sys.argv: # Avoid tests hanging
         server = dbms.get(user)
         server = dbms.get(user)
-        server.execute_statement("SELECT 'Hello World!';")
+        query = hql_query("SELECT 'Hello World!';")
+        handle = server.execute_and_wait(query, timeout_sec=10.0)
+
+        if handle:
+          server.fetch(handle, rows=100)
+          server.close(handle)
     except StructuredThriftTransportException, e:
     except StructuredThriftTransportException, e:
       if 'Error validating the login' in str(e):
       if 'Error validating the login' in str(e):
         msg = 'Failed to authenticate to HiveServer2, check authentication configurations.'
         msg = 'Failed to authenticate to HiveServer2, check authentication configurations.'

+ 8 - 1
apps/impala/src/impala/conf.py

@@ -27,6 +27,7 @@ from desktop.lib.exceptions import StructuredThriftTransportException
 
 
 from impala.settings import NICE_NAME
 from impala.settings import NICE_NAME
 
 
+
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 
 
 
@@ -174,6 +175,7 @@ AUTH_PASSWORD_SCRIPT = Config(
 def config_validator(user):
 def config_validator(user):
   # dbms is dependent on beeswax.conf (this file)
   # dbms is dependent on beeswax.conf (this file)
   # import in method to avoid circular dependency
   # import in method to avoid circular dependency
+  from beeswax.design import hql_query
   from beeswax.server import dbms
   from beeswax.server import dbms
   from beeswax.server.dbms import get_query_server_config
   from beeswax.server.dbms import get_query_server_config
 
 
@@ -183,7 +185,12 @@ def config_validator(user):
       if not 'test' in sys.argv: # Avoid tests hanging
       if not 'test' in sys.argv: # Avoid tests hanging
         query_server = get_query_server_config(name='impala')
         query_server = get_query_server_config(name='impala')
         server = dbms.get(user, query_server)
         server = dbms.get(user, query_server)
-        server.execute_statement("SELECT 'Hello World!';")
+        query = hql_query("SELECT 'Hello World!';")
+        handle = server.execute_and_wait(query, timeout_sec=10.0)
+
+        if handle:
+          server.fetch(handle, rows=100)
+          server.close(handle)
     except StructuredThriftTransportException, ex:
     except StructuredThriftTransportException, ex:
       if 'TSocket read 0 bytes' in str(ex):  # this message appears when authentication fails
       if 'TSocket read 0 bytes' in str(ex):  # this message appears when authentication fails
         msg = "Failed to authenticate to Impalad, check authentication configurations."
         msg = "Failed to authenticate to Impalad, check authentication configurations."