prestodb/presto · error · PrestoException

HIVE_PARTITION_READ_ONLY

HIVE_PARTITION_READ_ONLY

Error message

Unpartitioned Hive tables are immutable

What it means

getWriterParametersForExistingUnpartitionedTable: an insert/append was attempted against an existing unpartitioned (non-transactional) Hive table with update mode NEW; unpartitioned tables cannot receive new files this way, so writes are rejected.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveWriterFactory.java:475

                        partitionName,
                        schemaName,
                        tableName,
                        writeInfo.getTargetPath()));
            }
        }
        return new WriterParameters(
                UpdateMode.NEW,
                createHiveSchema(dataColumns),
                writeInfo,
                fromHiveStorageFormat(storageFormat));
    }

    private WriterParameters getWriterParametersForExistingUnpartitionedTable(OptionalInt bucketNumber)
    {
        // Note: temporary table is always empty at this step
        if (!table.getTableType().equals(TEMPORARY_TABLE)) {
            if (immutablePartitions) {
                throw new PrestoException(HIVE_PARTITION_READ_ONLY, "Unpartitioned Hive tables are immutable");
            }
        }
        return new WriterParameters(
                UpdateMode.APPEND,
                getHiveSchema(table),
                locationService.getTableWriteInfo(locationHandle),
                fromHiveStorageFormat(storageFormat));
    }

    private WriterParameters getWriterParametersForExistingPartitionedTable(String partitionName, OptionalInt bucketNumber)
    {
        if (MetastoreUtil.isPrestoMaterializedView(table)) {
            return getWriterParametersForOverwritePartition(partitionName);
        }

        switch (insertExistingPartitionsBehavior) {
            case APPEND:
                return getWriterParametersForAppendPartition(partitionName, bucketNumber);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Convert the table to a managed table
  2. Recreate the data via CTAS into a managed table
  3. Remove rows/rewrite instead of appending
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveWriterFactory.java:475 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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