prestodb/presto · error · UnsupportedOperationException

append

Error message

append

What it means

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.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java:463

        return new FSDataOutputStream(
                new PrestoS3OutputStream(s3,
                        getBucketName(uri),
                        key,
                        tempFile,
                        sseEnabled,
                        sseType,
                        sseKmsKeyId,
                        multiPartUploadMinFileSize,
                        multiPartUploadMinPartSize,
                        s3AclType,
                        s3StorageClass),
                statistics);
    }

    @Override
    public FSDataOutputStream append(Path f, int bufferSize, Progressable progress)
    {
        throw new UnsupportedOperationException("append");
    }

    @Override
    public boolean rename(Path src, Path dst)
            throws IOException
    {
        boolean srcDirectory;
        try {
            srcDirectory = directory(src);
        }
        catch (FileNotFoundException e) {
            return false;
        }

        try {
            if (!directory(dst)) {
                // cannot copy a file to an existing file
                return false;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Rewrite the writer to produce new objects (e.g. rolling files) instead of appending.
  2. Write to local disk and upload complete objects via create().
  3. Use a store that supports append semantics (HDFS) or S3-compatible appender tooling.
  4. If using a framework, switch its sink to a non-append mode (e.g. per-checkpoint files).

Example fix

// before
FSDataOutputStream out = fs.append(path, bufferSize, progress);
// after
FSDataOutputStream out = fs.create(path, true); // write full content, then close; or use rolling files
Defensive patterns

Strategy: type-guard

Validate before calling

if (requiresAppend) {
    throw new UnsupportedOperationException("S3 filesystem does not support append; use HDFS or rolling files");
}

Type guard

boolean supportsAppend(FileSystem fs) {
    return !(fs instanceof PrestoS3FileSystem);
}

Try / catch

try {
    out = fs.append(path, bufferSize, progress);
} catch (UnsupportedOperationException e) {
    // fall back to create + full rewrite, or route to HDFS
    out = fs.create(path, true);
}

Prevention

When it happens

Trigger: 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.

Common situations: Streaming frameworks configured to append to S3 files; users migrating code from HDFS to s3n/s3 paths expecting append; log-tail style writers.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/ca9bf67c4db6af8d. Report an issue: GitHub.