title: Hive with python transform function: "cannot recognize input near 'transform'" error
body: <p>I have a Hive table that tracks the status of an object moving through stages of a process. The table looks like this:</p>
  
  <pre><code>hive&gt; desc journeys;
  object_id           string                                      
  journey_statuses    array&lt;string&gt;
  </code></pre>
  
  <p>Here's a typical example of a record:</p>
  
  <pre><code>12345678    ["A","A","A","B","B","B","C","C","C","C","D"]
  </code></pre>
  
  <p>The records in the table were generated using Hive 0.13's <code>collect_list</code> and the statuses have an order (if order wasn't important, I would have used <code>collect_set</code>). For each object_id, I'd like to abbreviate the journey to return the journey statuses in the order that they appear.</p>
  
  <p>I wrote a quick Python script that reads from stdin:</p>
  
  <pre><code>#!/usr/bin/env python
  import sys
  import itertools
  
  for line in sys.stdin:
      inputList = eval(line.strip())
      readahead = iter(inputList)
      next(readahead)
      result = []
      for id, (a, b) in enumerate(itertools.izip(inputList, readahead)):
          if id == 0:
            result.append(a)
          if a != b:
            result.append(b)
      print result
  </code></pre>
  
  <p>I planned to use this in a Hive <code>transform</code> call. It seems to work when run locally:</p>
  
  <pre><code>$ echo '["A","A","A","B","B","B","C","C","C","C","D"]' | python abbreviate_list.py
  ['A', 'B', 'C', 'D']
  </code></pre>
  
  <p>However, when I add the file and try to execute within Hive, an error is returned:</p>
  
  <pre><code>hive&gt; add file abbreviateList.py;                                                                           
  Added resource: abbreviateList.py
  
  hive&gt; select
      &gt;   object_id,
      &gt;   transform(journey_statuses) using 'python abbreviateList.py' as journey_statuses_abbreviated
      &gt; from journeys;
  NoViableAltException( ... wall of Java error messages ... )
  FAILED: ParseException line 3:2 cannot recognize input near 'transform' '(' 'journey_statuses' in select expression
  </code></pre>
  
  <p>Can you see what I'm doing wrong?</p>