textfile转换成rcfile,parquet,hfile

本文介绍了如何使用Hive和Impala将textfile转换为不同格式:通过Hive将textfile转为rcfile和hfile,通过Impala将textfile转为parquet文件。详细步骤包括创建表、加载数据和数据导入。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、textfile转换成rcfile
    通过hive实现
    1.1在hive创建表
    create table tablename(s string,x string,y string,a double,b double);
    1.2然后load data本地textfile
    load data local inpath '本地路径的textfile' into table tablename;
    或是load data hdfs上的textfile到hive表中
    load data inpath 'hdfs路径的textfile‘ into table tablename;
    
    这样hive中tablename表对应的文件,就是textfile要转换成的rcfile文件

二、textfile转换成parquet
    通过impala实现
    2.1在impala创建表
    create table tablename(s string,x string,y string,a double,b double);
    2.2然后load data hdfs上的textfile到impala表中
    load data inpath 'hdfs路径的textfile’ into table tablename;

    这样impala中tablename表对应的文件,就是textfiel要转换成的parquet文件

三、textfile转换成hfile
    通过hive和hbase整合实现
    3.1在hive中创建hbase识别的表
    create table hbase_hive_table(s string,x string,y string,a double,b double)
    stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
    with serdeproperties ("hbase.columns.mapping" = ":key,info:y,info:z,info:a,info:b")
    tblproperties("hbase.table.name" = "hbase_hive_table");
    3.2在hive创建表
    create table tablename(s string,x string,y string,a double,b double);
    3.3然后load data本地textfile
    load data local inpath '本地路径的textfile' into table hbase_hive_table;
    或是load data hdfs上的textfile到hive表中
    load data inpath 'hdfs路径的textfile‘ into table hbase_hive_table;
    3.4在hive导入数据到hbase识别的表中
    insert into table hbase_hive_table select * from tablename;
    
    这样hbase中hbase_hive_table表对应的文件,就是textfile要转换成的hfile文件
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值