瀏覽代碼

HUe-5119 [oozie] Define statements for Hive snippets of notebooks

Romain Rigaux 9 年之前
父節點
當前提交
9932445825
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      desktop/libs/liboozie/src/liboozie/submission2.py

+ 5 - 4
desktop/libs/liboozie/src/liboozie/submission2.py

@@ -199,12 +199,13 @@ class Submission(object):
           self.job.override_subworkflow_id(action, workflow.id) # For displaying the correct graph
           self.properties['workspace_%s' % workflow.uuid] = workspace # For pointing to the correct workspace
 
-        elif action.data['type'] == 'hive-document' or action.data['type'] == 'hive2':
+        elif action.data['type'] == 'hive-document':
           from notebook.models import Notebook
           if action.data['properties'].get('uuid'):
             notebook = Notebook(document=Document2.objects.get_by_uuid(user=self.user, uuid=action.data['properties']['uuid']))
-            #statements = notebook.get_str()
-            statements = '\n\n\n'.join([snippet['statement_raw'] for snippet in notebook.get_data()['snippets']])
+            statements = notebook.get_str()
+          else:
+            statements = action.data['properties'].get('statements')
 
           if self.properties.get('send_result_path'):
             statements = """
@@ -215,7 +216,7 @@ WITH SERDEPROPERTIES (
    "quoteChar"     = "'",
    "escapeChar"    = "\\"
 )
-STORED AS TEXTFILE %s""" % (self.properties.get('send_result_path'), statements)
+STORED AS TEXTFILE %s""" % (self.properties.get('send_result_path'), '\n\n\n'.join([snippet['statement_raw'] for snippet in notebook.get_data()['snippets']]))
 
           if statements is not None:
             self._create_file(deployment_dir, action.data['name'] + '.sql', statements)