gpt4 book ai didi

hadoop - 配置单元分区 View 未显示分区信息

转载 作者:行者123 更新时间:2023-12-02 20:38:46 26 4
gpt4 key购买 nike

我在Hive中创建了一个分区 View ,如下所示

create view if not exists view_name
PARTITIONED ON(date)
as
select col1,col2,date
from table1
union all
select col1,col2,date
from table2

基础表在“日期”列上分区。当我使用 DESCRIBE FORMATTED VIEW_NAME时,我可以在屏幕快照中看到分区信息为null。
enter image description here

如果我使用SHOW CREATE TABLE View_Name,则会得到不带分区的 View 定义,如下所示
create view if not exists view_name
as
select col1,col2,date
from table1
union all
select col1,col2,date
from table2

请让我知道我在想什么

最佳答案

从配置单元文档

Although there is currently no connection between the view partition and underlying table partitions, Hive does provide dependency information as part of the hook invocation for ALTER VIEW ADD PARTITION. It does this by compiling an internal query of the form



换句话说,有关基础表的 View 中没有可用的分区信息。一种变通方法(取决于您的 View 查询的复杂程度)如下添加分区
ALTER VIEW view_name ADD [IF NOT EXISTS] partition_spec partition_spec

至少从用户 Angular 来看,它将提供有关基础表中可用分区的信息。

关于hadoop - 配置单元分区 View 未显示分区信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50292450/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com