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

Trino无法从S3中的JSON文件创建表问题求助

解决Trino创建JSON外部表时"bucket is null/empty"错误

问题重现

执行以下SQL创建表时触发错误:

create table trino_test.json_test (id VARCHAR) with (external_location = 's3a://trino_test/jsons/', format='JSON');

错误信息:

Query 20230203_154914_00018_d3erw failed: java.lang.IllegalArgumentException: bucket is null/empty

已知S3路径trino_test/jsons/file.json存在文件,且同存储下的PARQUET表可正常使用。

可能的解决方法

  • 替换存储协议头:将s3a://改为s3://,Trino的S3连接器默认使用s3://协议,部分场景下无法正确解析s3a://格式的路径,修改后的SQL:

    create table trino_test.json_test (id VARCHAR) with (external_location = 's3://trino_test/jsons/', format='JSON');
    
  • 检查Hive连接器配置(若使用Hive连接器):如果是通过Hive连接器访问S3,需确保Hadoop相关配置正确:

    • 在hive.properties中添加或确认参数:
      hive.hadoop.conf.hadoop.fs.s3a.impl=org.apache.hadoop.fs.s3a.S3AFileSystem
      hive.hadoop.conf.fs.s3a.access.key=你的AWS访问密钥
      hive.hadoop.conf.fs.s3a.secret.key=你的AWS秘密密钥
      hive.s3.path-style-access=true
      

    配置后重启Trino集群,再尝试创建表。

  • 验证路径格式:确保external_location的路径末尾包含斜杠(/),且bucket名称trino_test拼写正确,无多余空格或特殊字符。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.02 14:55:30