Bläddra i källkod

HUE-4251 [editor] Explain on incorrect query should not error

Romain Rigaux 9 år sedan
förälder
incheckning
393a8b2

+ 4 - 1
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -384,7 +384,10 @@ class HS2Api(Api):
     session = self._get_session(notebook, snippet['type'])
     query = self._prepare_hql_query(snippet, response.pop('statement'), session)
 
-    explanation = db.explain(query)
+    try:
+      explanation = db.explain(query)
+    except QueryServerException, ex:
+      raise QueryError(ex.message)
 
     return {
       'status': 0,

+ 2 - 1
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -865,6 +865,7 @@
       }
 
       self.result.explanation('');
+      self.errors([]);
       self.progress(0);
       self.status('ready');
 
@@ -877,7 +878,7 @@
           self.result.fetchedOnce(true);
           self.result.explanation(data.explanation);
         } else {
-          $(document).trigger("error", data.message);
+          self._ajaxError(data);
         }
       });
     }