为什么Athena在插入Iceberg表时会报“指定的键不存在”?

问题描述 投票:0回答:1

我正在 Athena 中创建一个 Iceberg 表,如下所示:

CREATE TABLE IF NOT EXISTS table1 (`col1` string, `col2` string) 
LOCATION 's3://my-bucket/path/table1/'
TBLPROPERTIES ('table_type'='ICEBERG', 'format'='parquet')

然后尝试将值插入到该表中,如下所示:

INSERT INTO table1 VALUES ('hello', 'iceberg')

我遇到这样的错误:

GENERIC_INTERNAL_ERROR:
io.trino.hdfs.s3.TrinoS3FileSystem$UnrecoverableS3OperationException:
com.amazonaws.services.s3.model.AmazonS3Exception:
指定的键不 存在。 (服务:Amazon S3;状态代码:404;错误代码:NoSuchKey;请求...

我做错了什么?

amazon-web-services amazon-athena trino apache-iceberg
1个回答
0
投票

位置设置不正确,不应包含尾随

/

通过检查

aws s3 ls s3://my-bucket/path/table1/ --recursive
来验证这一点。如果您看到带有
//
的按键,例如
s3://my-bucket/path/table1//metadata/...
,则您遇到了此问题。
//
是一个有用的指示,表明您已经添加了额外的
/

只需创建表,位置中不带尾随

/

CREATE TABLE IF NOT EXISTS table1 (`col1` string, `col2` string) 
LOCATION 's3://my-bucket/path/table1'
TBLPROPERTIES ('table_type'='ICEBERG', 'format'='parquet')
© www.soinside.com 2019 - 2024. All rights reserved.