配置单元分区为空

myss37ts  于 2021-06-26  发布在  Hive
关注(0)|答案(0)|浏览(283)

当我尝试从另一个表a向配置单元表b插入覆盖时,我看到有一个额外的分区是用空值为表b创建的。表a中的源是动态分区的。我得到下面的结果

partition (ds=2015-08-21, source=null)
Loading partition {ds=2015-08-21, source=xxxxx}
Loading partition {ds=2015-08-21, source=xxxxx}

它不应该像分区一样创建(ds=2015-08-21,source=null)。源中没有原始表中为null的记录。但是当我查看表分区时,它只显示两个有效分区。

ds=2015-08-21, source=xxxxx
ds=2015-08-21, source=xxxxx

同样,当我试图从表b(插入上面)插入另一个表c时。它给出“failed:nullpointerexception null”错误。请在此帮助查询:

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 >= '${ds_window}'
        AND visit_date <= '${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 > 0
    AND latest_item.subcat IS NOT NULL
    AND latest_item.subcat != ''
    AND latest_item.source != ''
    AND latest_item.source IS NOT NULL

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题