我在 EMR 上进行了 trino 设置,其中配置了 hive 和iceberg,以使用 AWSglue 作为目录。有一个这样创建的hive表。
CREATE SCHEMA hive.schema1 WITH (location = 's3://bucket1/schema1')")
CREATE TABLE hive.schema1.table1
(
...
FieldDate DATE
)
WITH (
format = 'PARQUET',
partitioned_by = ARRAY['FieldDate']
)
然后使用下面的方法将数据从 Hive 表导入到 Iceberg 表中。
CREATE SCHEMA iceberg.schema2 WITH (location = 's3://bucket2/schema2')"
CREATE TABLE iceberg.schema2.table2
WITH (
format='PARQUET',
partitioning=ARRAY['day(FieldDate)'],
location='s3://bucket2/schema2/table2'
)
AS
SELECT
...
FieldDate
FROM hive.schema1.table1
是否可以使用 Hive 表创建 Iceberg 表,而无需在 s3 中移动/复制数据?
请查看 Spark Iceberg 程序文档,以通过就地迁移或影子迁移将 Hive 表迁移到 Iceberg。
您可以使用 Spark 或 trino 的
snapshot
、register
、migrate
或 add_files
程序
https://iceberg.apache.org/docs/latest/spark-procedures/#table-migration https://www.dremio.com/blog/migration-a-hive-table-to-an-iceberg-table-hands-on-tutorial/