【问题标题】:Conversion of Parquet file format to sequence file formatParquet 文件格式到序列文件格式的转换
【发布时间】:2017-03-27 16:48:45
【问题描述】:

我将我的 hive 表以 Parquet 格式存储在 HDFS 中的某个位置。我可以将此位置的镶木地板文件转换为序列文件格式并在其上构建配置单元表吗? 有什么程序可以进行这种转换吗?

【问题讨论】:

  • 为什么?............
  • @DuduMarkovitz 我公司的其他一些团队希望将数据作为序列文件格式。

标签: hive parquet sequencefile


【解决方案1】:

使用插入选择创建新的序列文件表并重新加载数据:

insert into sequence_table
select * from parquet_table;

【讨论】:

  • 让我试试。谢谢。
  • 如果我的序列表是按年、月、日分区的,那么如何将按年、月、日分区的 parquet 表中的所有记录插入序列表中?
  • 创建分区表,insert overwrite table sequence_table partition (year, month, day) select from parquet table,partitions key 应该在最后,在最后添加distribute by partition key 以减轻reducer的压力。如果目标表具有完全相同的结构,您可以选择 *.
【解决方案2】:
hive> create table src (i int) stored as parquet;
OK
Time taken: 0.427 seconds
hive> create table trg stored as sequencefile as select * from src;

为了@AndyReddy

create table src (i int) 
partitioned by (year int,month tinyint,day tinyint)
stored as parquet
;

create table trg (i int) 
partitioned by (year int,month tinyint,day tinyint)
stored as sequencefile
;

set hive.exec.dynamic.partition.mode=nonstrict
;

insert into trg partition(year,month,day)
select * from src
;

【讨论】:

  • 如果我的序列表按年、月、日分区,那么如何将按年、月、日分区的镶木地板表中的所有记录插入序列表中?插入就行了?
猜你喜欢
  • 2022-11-24
  • 1970-01-01
  • 2020-11-28
  • 1970-01-01
  • 2023-04-09
  • 1970-01-01
  • 2012-08-31
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多