Bläddra i källkod

HUE-5765 [editor] Show correct error line number when statement is not on top

Romain Rigaux 8 år sedan
förälder
incheckning
23da3a46e2

+ 1 - 1
apps/beeswax/src/beeswax/design.py

@@ -127,7 +127,7 @@ class HQLdesign(object):
   @property
   def statements(self):
     hql_query = strip_trailing_semicolon(self.hql_query)
-    return [strip_trailing_semicolon(statement.strip()) for (start_row, start_col), (end_row, end_col), statement in split_statements(hql_query)]
+    return [strip_trailing_semicolon(statement) for (start_row, start_col), (end_row, end_col), statement in split_statements(hql_query)]
 
   @staticmethod
   def get_default_data_dict():

+ 1 - 1
desktop/libs/notebook/src/notebook/api.py

@@ -123,7 +123,7 @@ def _execute_notebook(request, notebook, snippet):
           _snippet['result']['handle'] = response['handle']
           _snippet['result']['statements_count'] = response['handle'].get('statements_count', 1)
           _snippet['result']['statement_id'] = response['handle'].get('statement_id', 0)
-          _snippet['result']['handle']['statement'] = response['handle'].get('statement', snippet['statement']) # For non HS2, as non multi query yet
+          _snippet['result']['handle']['statement'] = response['handle'].get('statement', snippet['statement']).strip() # For non HS2, as non multi query yet
         else:
           _snippet['status'] = 'failed'
 

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

@@ -615,7 +615,7 @@ DROP TABLE IF EXISTS `%(table)s`;
           'row': end_row,
           'column': end_col
         },
-        'statement': strip_trailing_semicolon(statement.strip())
+        'statement': strip_trailing_semicolon(statement.rstrip())
       })
     return statements
 
@@ -626,6 +626,7 @@ DROP TABLE IF EXISTS `%(table)s`;
     statements_count = snippet['result']['handle'].get('statements_count', 1)
 
     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'])
     non_edited_statement = previous_statement_hash == snippet['result']['handle'].get('previous_statement_hash') or not snippet['result']['handle'].get('previous_statement_hash')