Răsfoiți Sursa

HUE-6361 [editor] Only send the string of the active statement when executing a query

Johan Ahlen 8 ani în urmă
părinte
comite
5da84834e7

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

@@ -632,7 +632,7 @@ DROP TABLE IF EXISTS `%(table)s`;
     statement_id = snippet['result']['handle'].get('statement_id', 0)
     statements_count = snippet['result']['handle'].get('statements_count', 1)
 
-    statements = self._get_statements(snippet['statement']['statement'])
+    statements = self._get_statements(snippet['statement'])
 
     statement_id = min(statement_id, len(statements) - 1) # In case of removal of statements
     previous_statement_hash = self.__compute_statement_hash(statements[statement_id]['statement'])

+ 5 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -3114,7 +3114,11 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
       });
 
       huePubSub.subscribe('editor.active.statement.changed', function (statementDetails) {
-        viewModel.selectedNotebook().snippets()[0].positionStatement(statementDetails.activeStatement);
+        if (statementDetails.activeStatement) {
+          viewModel.selectedNotebook().snippets()[0].positionStatement(statementDetails.activeStatement.statement);
+        } else {
+          viewModel.selectedNotebook().snippets()[0].positionStatement('');
+        }
       });
 
       viewModel.selectedNotebook.subscribe(function (newVal) {