我们使用 AWS Glue 4.0 进行 ETL 处理作业。
每个 Glue 作业 (PySpark) 都会读取和写入 AWS Glue 表。这些表是使用 CloudFormation 模板定义的,并将数据作为 Parquet 文件存储在 S3 中。表被分区,通常分为两列。
我们的业务分析师使用 AWS Athena 查询这些表中的数据。
以下是
StorageDescriptor
字段的摘录:
InputFormat: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat
Location: <S3 location>
OutputFormat: org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat
SerdeInfo:
Parameters:
classification: Parquet
SerializationLibrary: org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe
我想将列数据类型从
string
更改为 array<string>
。
这在 CloudFormation 模板中非常简单——只需修改它并重新应用即可——但我担心现有的 Parquet 文件。
是否有一种轻松的方法将现有 Parquet 文件迁移到新架构?
您可以创建一个新的 Glue 作业来读取现有的 Parquet 文件,应用架构演变来更改列数据类型,并将数据写回到新架构中的 S3。
这似乎是一种(如果不是最)无痛的迁移方法之一。