You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Athena UNLOAD至S3遇GENERIC_INTERNAL_ERROR错误求助

Athena UNLOAD分区报错:GENERIC_INTERNAL_ERROR 解决

你遇到的问题出在分区键对应的表达式重复上:你的SELECT语句里,start_month和start_day都用了完全相同的常量值'11',Athena在处理UNLOAD分区时,会把每个分区键对应的生成逻辑作为内部标识,相同的表达式会被判定为重复键,从而抛出GENERIC_INTERNAL_ERROR: Multiple entries with same key的错误。

你的原查询语句

unload(
        select name,
            '11' as start_month,
            '11' as start_day
        from employees
        limit 3
    ) TO 's3://mybucket' with (
        format = 'ORC',
        partitioned_by = ARRAY [ 'start_month',
        'start_day' ]
    )

报错信息

GENERIC_INTERNAL_ERROR: Multiple entries with same key: expr=expr and expr=expr

解决方法

  • 修改其中一个列的生成表达式:让两个分区键的生成逻辑不一样,哪怕结果值相同。比如把其中一个常量转成字符串类型(或用其他等价但不同的表达式):
    unload(
            select name,
                '11' as start_month,
                cast(11 as varchar) as start_day
            from employees
            limit 3
        ) TO 's3://mybucket' with (
            format = 'ORC',
            partitioned_by = ARRAY [ 'start_month', 'start_day' ]
        )
    
  • 合并分区键:如果业务上这两个分区键的值始终相同,可以考虑用一个组合分区键(比如start_month_day)代替两个单独的列,从根源避免重复表达式问题。

内容的提问来源于stack exchange,提问作者gd000

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 15:01:00