Skip to content

Commit

Permalink
Merge pull request #58 from cabhishek/fix_presto_semicolon
Browse files Browse the repository at this point in the history
Improve presto semicolon logic
  • Loading branch information
cabhishek authored Mar 19, 2020
2 parents 8583ec3 + 4881524 commit dea327c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pygenie/jobs/presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def cmd_args(self):
self._add_dependency(self._script)
elif self._script is not None:
if not self._script.strip().endswith(';'):
self._script = '{};'.format(self._script)
#\n ensures if the script ends with a comment ; still gets applied
self._script = '{}\n;'.format(self._script)
self._add_dependency({'name': filename, 'data': self._script})

options_str = ' '.join([
Expand Down
4 changes: 2 additions & 2 deletions tests/job_tests/test_prestojob.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def test_genie2_payload_adhoc_script(self, os_isfile, to_att):
u'attachments': [
{u'name': u'prestofile1', u'data': u'file contents'},
{u'name': u'prestofile2', u'data': u'file contents'},
{u'name': u'script.presto', u'data': u'SELECT * FROM DUAL;'}
{u'name': u'script.presto', u'data': u'SELECT * FROM DUAL\n;'}
],
u'clusterCriterias': [
{u'tags': [u'type:prestocluster1']},
Expand Down Expand Up @@ -351,7 +351,7 @@ def test_genie3_payload_adhoc_script(self, os_isfile, file_open):
u'attachments': [
(u'prestofile1', u"open file '/prestofile1'"),
(u'prestofile2', u"open file '/prestofile2'"),
(u'script.presto', u'SELECT * FROM DUAL;')
(u'script.presto', u'SELECT * FROM DUAL\n;')
],
u'clusterCriterias': [
{u'tags': [u'type:prestocluster1']},
Expand Down

0 comments on commit dea327c

Please sign in to comment.