无法覆盖Hive表中的分区

时间:2019-06-27 12:53:57

标签: sql hive database-partitioning

我正在尝试覆盖表的某个分区。我的查询很大,但是我设法找到了一个最小的代码来重现该错误。当我尝试运行此代码时:

INSERT OVERWRITE TABLE sbx.calls_out PARTITION (date_call) 
SELECT
    z.corp,
    z.time_call,
    z.comp,
    z.serv
    z.date_call
FROM (
    SELECT
        'a' as corp,
        1 as time_call,
        'b' as comp,
        '20190625' as date_call,
        'c' as serv
) AS z;

这将返回以下错误:

Failed to recognize predicate '.'. Failed rule: 'regularBody' in statement

但是,如果我运行完全相同的代码但使用另一个表,则可以正常工作。这是什么原因造成的?

1 个答案:

答案 0 :(得分:0)

, 列之前缺少 z.date_call ,添加,并再次运行该语句。

INSERT OVERWRITE TABLE sbx.calls_out PARTITION (date_call) 
SELECT
    z.corp,
    z.time_call,
    z.comp,
    z.serv,
    z.date_call
FROM (
    SELECT
        'a' as corp,
        1 as time_call,
        'b' as comp,
        '20190625' as date_call,
        'c' as serv
) AS z;