【问题标题】:How to create a bucketed ORC transactional table in Hive that is modeled after a non-transactional table如何在 Hive 中创建以非事务表为模型的分桶 ORC 事务表
【发布时间】:2021-05-03 20:12:09
【问题描述】:

假设我在 Hive 中有一个名为“ccm”的非事务性表。它有数百列和一个分区字段。

我知道如何使用“create table abc like ccm”创建副本,但我希望将 abc 分桶、ORC,并通过 TBLPROPERTIES 设置事务支持。

我在编写 HQL 时不想提及 ccm 中的所有列。

我可以这样做吗?

【问题讨论】:

    标签: hive hiveql orc


    【解决方案1】:

    这个答案可能对你的情况有正确的处理方法,它也解释了所用方法的一些限制。

    Create hive table using "as select" or "like" and also specify delimiter

    因此,从示例中,您应该添加缺少的部分:

    • 集群方式
    • TBLPROPERTIES ("transactional"="true")

    我怀疑您能否完全达到您的预期结果,但我认为这是向前迈出的一步

    【讨论】:

    • 目标表已分区;我运行此程序时收到的消息:hive> create table test clustered by (acctnum) into 50 buckets stored as ORC tblproperties('transactional'='true') as select * from ccm; 是:FAILED: SemanticException [Error 10068]: CREATE-TABLE-AS-SELECT does not support partitioning in the target table
    • 这也是我的印象,我认为这里的集群无法使用。如果我找到另一种方式,我会在这里发布。目前,我没有什么了不起的方法
    • 您是否尝试过使用 CTAS 创建并在创建后使用 ALTER ddl 更改表?
    • 我的意图是创建一个“类似于”大表示例的表,但要使该表具有事务性。我失败了,因为大型示例表已分区。
    猜你喜欢
    • 1970-01-01
    • 2017-08-25
    • 1970-01-01
    • 2016-04-16
    • 2019-11-08
    • 1970-01-01
    • 1970-01-01
    • 2018-10-19
    • 2019-05-14
    相关资源
    最近更新 更多