title: hive explode with sequence number
body: <p>The data is like below:</p>
  
  <pre><code>col1  Col2  pathstr
  3   5   some_string_a&gt; some_string_b&gt;some_string_c
  8   6   some_string_d&gt; some_string_e&gt;some_string_f
  </code></pre>
  
  <p>The third column "pathstr" is a path data with order. I user explode function as below: </p>
  
  <pre><code>SELECT col1, col2, path,
  FROM table_paths
  LATERAL VIEW explode(split(pathstr,'&gt;')) subView as path;
  </code></pre>
  
  <p>and got the following:</p>
  
  <pre><code>3 5 some_string_a
  3 5 some_string_b
  3 5 some_string_c
  8 6 some_string_d
  8 6 some_string_e
  8 6 some_string_f
  </code></pre>
  
  <p>However, exploded data loses the order information of the path string.  I wonder if I can generate an extra 'sequence' column like below. Or there is a better way to do it. </p>
  
  <pre><code>3 5 some_string_a, 1
  3 5 some_string_b, 2
  3 5 some_string_c, 3
  8 6 some_string_d, 1
  8 6 some_string_e, 2
  8 6 some_string_f, 3
  </code></pre>