title: Hive Partition with NULL
body: <p>When I try to insert overwrite into hive table B from another table A, i see that there is one extra partition created with NULL value for table B. the source in table A is dynamically partitioned.
  I get the like below</p>
  
  <pre><code>partition (ds=2015-08-21, source=null)
  Loading partition {ds=2015-08-21, source=xxxxx}
  Loading partition {ds=2015-08-21, source=xxxxx}
  </code></pre>
  
  <p>It should be not created like partition (ds=2015-08-21, source=null). There is no records in the with source as null in the original table.
  But when I look at the table partitions, it shows only the two valid partitions.</p>
  
  <pre><code>ds=2015-08-21, source=xxxxx
  ds=2015-08-21, source=xxxxx
  </code></pre>
  
  <p>Again, When I try to insert into another table C from table B (inserted above). it gives "<strong>FAILED: NullPointerException null</strong>" error.
  Please help
  Here the query:</p>
  
  <pre><code> INSERT OVERWRITE TABLE AAAAAAAAAAAAAAAAAAAA
                     PARTITION (ds='${date_string}',source)
    SELECT
      f1,f2,f3,f4,f5,f6,f7,f8
      latest_item.source AS source
    FROM (
      SELECT
       f1,f2,f3,f4,f5,f6,f7,f8,
        top.col6 AS source
      FROM (
        SELECT
          customer_id,
          item_id,
          greatest_n(1, visit_date, order_nbr, base_item_id, cat, subcat, source) top_n
        FROM BBBBBBBBBBBBBBBBBB
        WHERE visit_date &gt;= '${ds_window}'
          AND visit_date &lt;= '${date_string}'
          AND source IS NOT NULL
          AND source != ''
        GROUP BY customer_id, item_id
      ) top_ns
      LATERAL VIEW explode(top_n) t AS top
    ) latest_item
    WHERE latest_item.customer_id IS NOT NULL
      AND latest_item.customer_id != ''
      AND latest_item.item_id IS NOT NULL
      AND latest_item.item_id != ''
      AND latest_item.days_since_last_purchase &gt; 0
      AND latest_item.subcat IS NOT NULL
      AND latest_item.subcat != ''
      AND latest_item.source != ''
      AND latest_item.source IS NOT NULL
  </code></pre>