浏览代码

HUE-8370 [pig] Imported old version Pig script missing properties fields

Ying Chen 7 年之前
父节点
当前提交
134febcd54
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      desktop/core/src/desktop/api2.py

+ 8 - 0
desktop/core/src/desktop/api2.py

@@ -223,6 +223,14 @@ def _get_document_helper(request, uuid, with_data, with_dependencies, path):
       notebook = Notebook(document=document)
       notebook = upgrade_session_properties(request, notebook)
       data = json.loads(notebook.data)
+      if document.type == 'query-pig': # Import correctly from before Hue 4.0
+        properties = data['snippets'][0]['properties']
+        if 'hadoopProperties' not in properties:
+          properties['hadoopProperties'] = []
+        if 'parameters' not in properties:
+          properties['parameters'] = []
+        if 'resources' not in properties:
+          properties['resources'] = []
       if data.get('uuid') != document.uuid: # Old format < 3.11
         data['uuid'] = document.uuid