我试图通过Scala代码将Parquet文件从一个AWS S3桶复制到另一个AWS桶中。我在复写电话上遇到了异常。下面是堆栈跟踪:
software.amazon.awssdk.services.s3.model.S3Exception: Invalid copy source object key (Service: S3, Status Code: 400, Request ID: ZDSVGXX276C1F416)我将有效路径传递到s3桶,并将文件名传递给方法调用。那么,这个问题的原因是什么呢?
复制导致错误的文件的代码:
def copyObjects(fromBucket: String, objectKey: String, toBucket: String): CopyObjectResponse = {
val copyRequest = CopyObjectRequest
.builder()
.copySource(fromBucket)
.destinationBucket(toBucket)
.destinationKey(objectKey)
.build()
val copyResponse = awsS3Client.copyObject(copyRequest)
val contents = copyResponse.copyObjectResult.toString
logger.info(s"Copy response contents ${contents}")
logger.info(s"Found ${contents.length} elements in storage with path $fromBucket")
copyResponse
}该方法调用:
copyFiles("s3a://qa/snapshots/urls/date=20220822.parquet", "part-00192-4130220041757319704-c12af88d-c000.snappy.parquet", "s3a://qa/urls-final/")发布于 2022-10-11 15:55:09
尝试在键的开头添加一个/。
https://stackoverflow.com/questions/73513433
复制相似问题