title: In Hive, what is the difference between explode() and lateral view explode()
body: <p>Assume there is a table <code>employee</code>:</p>
  
  <pre><code>+-----------+------------------+
  | col_name  |    data_type     |
  +-----------+------------------+
  | id        | string           |
  | perf      | map&lt;string,int&gt;  |
  +-----------+------------------+
  </code></pre>
  
  <p>and the data inside this table:</p>
  
  <pre><code>+-----+------------------------------------+--+
  | id  |                perf                |
  +-----+------------------------------------+--+
  | 1   | {"job":80,"person":70,"team":60}   |
  | 2   | {"job":60,"team":80}               |
  | 3   | {"job":90,"person":100,"team":70}  |
  +-----+------------------------------------+--+
  </code></pre>
  
  <p>I tried the following two queries but they all return the same result:</p>
  
  <pre><code>1. select explode(perf) from employee;
  2. select key,value from employee lateral view explode(perf) as key,value;
  </code></pre>
  
  <p>The result:</p>
  
  <p><code>+---------+--------+--+
  |   key   | value  |
  +---------+--------+--+
  | job     | 80     |
  | team    | 60     |
  | person  | 70     |
  | job     | 60     |
  | team    | 80     |
  | job     | 90     |
  | team    | 70     |
  | person  | 100    |
  +---------+--------+--+</code></p>
  
  <p>So, what is the difference between them? I did not find suitable examples. Any help is appreciated.</p>