0

我想将s3 select与 Java 一起使用,但出现此错误:

com.amazonaws.services.s3.model.AmazonS3Exception: Bad Request (Service: Amazon S3; Status Code: 400; Error Code: 400 Bad Request; Request ID: null; S3 Extended Request ID: null; Proxy: null)

这是我的代码:

SelectObjectContentResult selectData(String bucketName, String key) {

    var request = new SelectObjectContentRequest();
    request.setBucketName(bucketName);
    request.setKey(key);
    request.setExpressionType(ExpressionType.SQL);
    request.setExpression("select * from s3object");

    var inputSerialization = new InputSerialization();
    inputSerialization.setJson(new JSONInput().withType(LINES));
    inputSerialization.setCompressionType(CompressionType.NONE);
    request.setInputSerialization(inputSerialization);

    var outputSerialization = new OutputSerialization();
    outputSerialization.setJson(new JSONOutput());
    request.setOutputSerialization(outputSerialization);

    return amazonS3.selectObjectContent(request);
}

我使用图像adobe/s3mock:2.1.22使用 docker创建了 s3 容器,并将 JSON 文件放入我的存储桶中

请提供任何帮助;

4

0 回答 0