title: select non-existing data as null using HIVE LATERAL VIEW
body: <p>I am trying to get non existing data as null using outer explode in hive but my query is not returning anything.
  EDIT :
  Table - year string, companyrank </p>
  
  <pre><code>year:string,topcompanies:array&lt;struct&lt;name:string,rank:string&gt;&gt;
  </code></pre>
  
  <p>sample data
  EDIT:</p>
  
  <pre><code>    2015,
    "topcompanies":[
    {"name":"apple","rank":"1"},
    {"name":"samsung","rank":"2"},
    {"name":"SONY","rank":"3"},
    ]
  
    2016,
    "topcompanies":[
    {"name":"apple","rank":"1"},
    {"name":"samsung","rank":"2"},
    {"name":"SONY","rank":"3"},
    {"name":"LG","rank":"4"}
    ]
  </code></pre>
  
  <p>query to get data</p>
  
  <pre><code>select  year, rank1, rank2, rank3, rank4
  FROM companyrank
  LATERAL VIEW outer explode(topcompanies) rank1_t as rank1_v
  LATERAL VIEW outer explode(topcompanies) rank2_t as rank2_v
  LATERAL VIEW outer explode(topcompanies) rank3_t as rank3_v
  LATERAL VIEW outer explode(topcompanies) rank4_t as rank4_v
  WHERE 
   (rank1_v.rank = 1 or rank1_v.rank is null)
   AND (rank2_v.rank = 2 or rank2_v.rank is null)
   AND (rank3_v.rank = 3 or rank3_v.rank is null)
   AND (rank4_v.rank = 4 or rank4_v.rank is null)
  </code></pre>
  
  <p>expected output-</p>
  
  <pre><code>expected output when rank4 does not exists
  year  rank1 rank2   rank3   rank4
  2016  apple samsung SONY    null
  </code></pre>
  
  <p>if rank4 data exists then </p>
  
  <pre><code>    year rank1  rank2   rank3   rank4
      2015 apple  samsung SONY    LG
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I need to get all 4 ranks for each year, if any of the ranks does not exists then the rank should show NULL.</p>