create table user1 (name string,age int ,sex string) stored as orc; insert into user1 select ‘u1‘,1,‘nan‘ from system.dual;select * from user1; dfs -rm /inceptorsql1/user/hive/warehouse/default.db/hive/user1/000000_0;
select * from user1;
insert into user1 select ‘u1‘,1,‘nan‘ from system.dual;
随后用dfs命令查看user1的表目录。可见有000000_0文件。删除后表中无数据。重新填充数据准备后续实验。
create table user1_0 (name string,age int ,sex string) stored as orc;
创建了user1_0和user1有相同的列定义,都存成orc格式。
load data inpath ‘/inceptorsql1/user/hive/warehouse/default.db/hive/user1/‘ into table user1_0; select * from user1_0;
将user1表目录中的文件copy到user1_0表。则user1_0表也有了数据。由此了解orc表和表目录下文件的关系。
时间: 2024-10-24 10:19:49