将正常列转换为配置单元中的分区列 [英] convert normal column as partition column in hive

查看:90
本文介绍了将正常列转换为配置单元中的分区列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个3列的表。现在我需要修改其中一列作为分区列。
有没有可能?如果不是,我们如何将分区添加到现有表中。我使用了下面的语法:
create table t1(eno int,ename string)以'\ t'结尾的行格式分隔字段;
将数据本地'/....path/'加载到表t1中;
alter table t1添加分区(p1 ='india');



..



任何人都知道如何将分区添加到现有表格 ......?



在此先感谢。

解决方案

我不认为这是直接可能的。 Hive必须完全重新排列并拆分HDFS中的文件,因为添加分区会强加一个新的目录结构。



我建议您只需创建一个新表,所需的模式和分区,并从第一个插入到第二个。


I have a table with 3 columns. now i need to modify one of the column as a partition column. Is there any possibility? If not, how can we add partition to existing table. I used the below syntax: create table t1 (eno int, ename string ) row format delimited fields terminated by '\t'; load data local '/....path/' into table t1; alter table t1 add partition (p1='india');

i am getting errors.........

Any one know how to add partition to existing table......?

Thanks in advance.

解决方案

I don't think this is directly possible. Hive would have to completely rearrange and split the files in HDFS because adding the partition would impose a new directory structure.

What I suggest you do is simply create a new table with the desired schema and partition, and insert everything from the first into the second.

这篇关于将正常列转换为配置单元中的分区列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆