【问题标题】:Hive create new table having complex types from an existing tableHive 从现有表中创建具有复杂类型的新表
【发布时间】:2017-01-23 11:33:35
【问题描述】:

给定一个 Hive 表

create table movie_1(id int, movie_title string, actor string, gender string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ';'  

vi movies.txt 
1;hero;john penn;male 
2;hero;maggie mcguirre;female 
3;lost;peter jones;male

假设一个新表movie_2,但字段类型为STRUCT

create table movie_2(id int, movie_title string, STRUCT <actor:string, gender:string>) 

如何从现有表movie_1 中创建一个新表movie_2,即从movies_1 中选择插入新表movies_2?

【问题讨论】:

    标签: hadoop hive hiveql


    【解决方案1】:

    检查此link。在这种情况下,您可以使用 to_map UDF 来创建具有复杂数据类型的新表。

    【讨论】:

      猜你喜欢
      • 2020-09-07
      • 1970-01-01
      • 2016-09-25
      • 2014-06-29
      • 1970-01-01
      • 1970-01-01
      • 2021-10-03
      • 2021-05-14
      相关资源
      最近更新 更多