Преглед изворни кода

HUE-8747 [editor] Fix support oozie jobs for tasks.

jdesjean пре 6 година
родитељ
комит
79c1033d2e
1 измењених фајлова са 5 додато и 6 уклоњено
  1. 5 6
      desktop/libs/notebook/src/notebook/sql_utils.py

+ 5 - 6
desktop/libs/notebook/src/notebook/sql_utils.py

@@ -44,18 +44,17 @@ def get_statements(hql_query):
 def get_current_statement(snippet):
   # Multiquery, if not first statement or arrived to the last query
   should_close = False
-  if not snippet['result'].get('handle'):
-    return should_close, {}
-  statement_id = snippet['result']['handle'].get('statement_id', 0)
-  statements_count = snippet['result']['handle'].get('statements_count', 1)
+  handle = snippet['result'].get('handle', {})
+  statement_id = handle.get('statement_id', 0)
+  statements_count = handle.get('statements_count', 1)
 
   statements = get_statements(snippet['statement'])
 
   statement_id = min(statement_id, len(statements) - 1) # In case of removal of statements
   previous_statement_hash = 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')
+  non_edited_statement = previous_statement_hash == handle.get('previous_statement_hash') or not handle.get('previous_statement_hash')
 
-  if snippet['result']['handle'].get('has_more_statements'):
+  if handle.get('has_more_statements'):
     should_close = True
     if non_edited_statement:
       statement_id += 1