[pig] Add hcat support in the Pig Editor in Hue
@@ -4201,12 +4201,21 @@ class WorkflowBuilder():
}
def get_pig_document_node(self, document, user):
- node = self._get_pig_node(document.uuid, is_document_node=True)
+ statement = json.loads(document.data)['snippets'][0]['statement']
+ credentials = []
+ if self._use_hcatalog(statement) and SECURITY_ENABLED.get():
+ credentials.append('hcat')
+
+ node = self._get_pig_node(document.uuid, credentials=credentials, is_document_node=True)
node['properties']['uuid'] = document.uuid
return node
+ def _use_hcatalog(self, statement):
+ return ('org.apache.hcatalog.pig.HCatStorer' in statement or 'org.apache.hcatalog.pig.HCatLoader' in statement) or \
+ ('org.apache.hive.hcatalog.pig.HCatLoader' in statement or 'org.apache.hive.hcatalog.pig.HCatStorer' in statement)
+
def _get_pig_node(self, node_id, credentials=None, is_document_node=False):
if credentials is None:
credentials = []
