{"record":{"id":"ca9bf67c4db6af8d","repo":"prestodb/presto","slug":"append","errorCode":null,"errorMessage":"append","messagePattern":"append","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java","lineNumber":463,"sourceCode":"        return new FSDataOutputStream(\n                new PrestoS3OutputStream(s3,\n                        getBucketName(uri),\n                        key,\n                        tempFile,\n                        sseEnabled,\n                        sseType,\n                        sseKmsKeyId,\n                        multiPartUploadMinFileSize,\n                        multiPartUploadMinPartSize,\n                        s3AclType,\n                        s3StorageClass),\n                statistics);\n    }\n\n    @Override\n    public FSDataOutputStream append(Path f, int bufferSize, Progressable progress)\n    {\n        throw new UnsupportedOperationException(\"append\");\n    }\n\n    @Override\n    public boolean rename(Path src, Path dst)\n            throws IOException\n    {\n        boolean srcDirectory;\n        try {\n            srcDirectory = directory(src);\n        }\n        catch (FileNotFoundException e) {\n            return false;\n        }\n\n        try {\n            if (!directory(dst)) {\n                // cannot copy a file to an existing file\n                return false;","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java#L445-L481","documentation":"PrestoS3FileSystem is write-once over S3; S3 objects cannot be appended to. append() unconditionally throws UnsupportedOperationException to signal the operation is not supported by this FileSystem implementation.","triggerScenarios":"Any call to FileSystem.append(path) or code paths (e.g. some frameworks' file sinks, Flink/Spark streaming writers) that assume appendable output on Hadoop-compatible filesystems.","commonSituations":"Streaming frameworks configured to append to S3 files; users migrating code from HDFS to s3n/s3 paths expecting append; log-tail style writers.","solutions":["Rewrite the writer to produce new objects (e.g. rolling files) instead of appending.","Write to local disk and upload complete objects via create().","Use a store that supports append semantics (HDFS) or S3-compatible appender tooling.","If using a framework, switch its sink to a non-append mode (e.g. per-checkpoint files)."],"exampleFix":"// before\nFSDataOutputStream out = fs.append(path, bufferSize, progress);\n// after\nFSDataOutputStream out = fs.create(path, true); // write full content, then close; or use rolling files","handlingStrategy":"type-guard","validationCode":"if (requiresAppend) {\n    throw new UnsupportedOperationException(\"S3 filesystem does not support append; use HDFS or rolling files\");\n}","typeGuard":"boolean supportsAppend(FileSystem fs) {\n    return !(fs instanceof PrestoS3FileSystem);\n}","tryCatchPattern":"try {\n    out = fs.append(path, bufferSize, progress);\n} catch (UnsupportedOperationException e) {\n    // fall back to create + full rewrite, or route to HDFS\n    out = fs.create(path, true);\n}","preventionTips":["Assume all S3-backed Hadoop filesystems are append-unsupported.","Design writers to emit complete, immutable objects.","Use rolling/compacted files for streaming writes.","Route append-heavy workloads to HDFS."],"tags":["s3","unsupported-operation","append","filesystem"],"backgroundTag":"unsupported-operation","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}