【发布时间】:2020-01-31 19:53:16
【问题描述】:
我正在使用 Dask 将分区 parquet 文件保存在 S3 存储桶上:
dd.to_parquet(
dd.from_pandas(df, npartitions=1),
path='s3a://test/parquet',
engine='fastparquet',
partition_on='country',
object_encoding='utf8',
compression="gzip",
write_index=False,
)
Parquet 文件创建成功;这是目录结构: directory structure
我成功地用这个镶木地板创建了一个 Impala 表:
create external table tmp.countries_france
like parquet 's3a://test/parquet/_metadata'
partitioned by (country string)
stored as parquet location 's3a://test/parquet/'
以及向该表添加分区:
alter table tmp.countries_france add partition (sheet='belgium')
但是,当我执行select * from tmp.countries_france 时,出现以下错误:
文件 's3a://test/parquet/sheet=france/part.0.parquet' 已损坏:元数据指示行数为零,但至少有一个非空行组。
我猜这个问题来自 Dask,因为当我创建一个未分区的镶木地板时,它可以正常工作。我试过设置write_index=True,但没有成功。
【问题讨论】: