如何更改hive表的Hue中的列类型?

时间:2016-04-01 10:56:14

标签: hadoop hive hue

我正在尝试手动创建一个配置单元表,但是我想将“order”的列类型更改为带有结构(orderline)的数组。

我目前的表格如下:

enter image description here

我希望与订单具有相同的类型:

enter image description here

如何更改列的类型?

2 个答案:

答案 0 :(得分:0)

我想通了,可以通过hive查询编辑器编辑类型,使用简单的SQL语句,如:

ALTER TABLE person CHANGE orders order ARRAY<STRUCT<status:string,creation_date:string,orderlines:array<STRUCT<depature_date:string,return_date : string, travel_days : int, creation_date: string,
                   price : int, booking_class : string, airline_code : string,
                   psg_gender : string, psg_lastname : string, psg_firstname : string, psg_dob : string>>>>

结果: enter image description here

答案 1 :(得分:0)

我知道了,你可以做到的。
step1:

create table testing.lz_test_struct
(
  mark struct<math:string,english:string>
)
row format delimited
fields terminated by ','
collection items terminated by '-';

step2:

hive> desc testing.lz_test_struct;
OK
mark struct<math:string,english:string,address:string,name:string> 

step3:

hive> alter table testing.lz_test_struct change  mark mark struct<math:string,english:string,address:string,name:string,city:string>;
ok
Time taken: 0.467 seconds

第4步:

hive> desc testing.lz_test_struct;
OK
mark                    struct<math:string,english:string,address:string,name:string,city:string>
Time taken: 0.143 seconds, Fetched: 1 row(s)