title: Stripping whitespace in Hive
body: <p>Consider the following table, <code>tab</code>:</p>
  
  <pre><code>id   fruits
  1    orange, banana
  2    orange
  3    apple, banana, grape
  </code></pre>
  
  <p>I want to "explode" this table on the <code>fruits</code> column:</p>
  
  <pre><code>select
  
  id
  individual_fruit
  
  from tab
  
  lateral view explode(split(fruits, ',')) the_fruits as individual_fruit
  </code></pre>
  
  <p>Which gives me this:</p>
  
  <pre><code>id individual_fruit
  1  orange
  1   banana
  2  orange
  3  apple
  3   banana
  3   grape
  </code></pre>
  
  <p>The leading whitespace in several of those rows makes it difficult to join this new table with other tables. How can I strip the whitespace in the new <code>fruit</code> column? I'm used to Python, and some of Hive seems Python-esque, so something like <code>map(str.strip, individual_fruit))</code> would make sense to me (but this obviously doesn't work in Hive!).</p>