prestodb/presto · error · PrestoException

HIVE_UNSUPPORTED_FORMAT

HIVE_UNSUPPORTED_FORMAT

Error message

Failed to load compression codec: 

What it means

getFileExtension loads the compression codec's extension via reflection/codec creation; a RuntimeException there (codec class missing or not instantiable) is wrapped in this error — the configured Hive compression codec cannot be loaded.

Source

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

        return OptionalInt.empty();
    }

    public static String getFileExtension(StorageFormat storageFormat, HiveCompressionCodec compressionCodec)
    {
        // text format files must have the correct extension when compressed
        if (compressionCodec == NONE || !HiveIgnoreKeyTextOutputFormat.class.getName().equals(storageFormat.getOutputFormat())) {
            return "";
        }

        if (!compressionCodec.getCodec().isPresent()) {
            return new DefaultCodec().getDefaultExtension();
        }

        try {
            return compressionCodec.getCodec().get().getConstructor().newInstance().getDefaultExtension();
        }
        catch (ReflectiveOperationException e) {
            throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, "Failed to load compression codec: " + compressionCodec.getCodec().get(), e);
        }
    }

    private static Properties createHiveSchema(List<DataColumn> dataColumns)
    {
        Properties schema = new Properties();
        schema.setProperty(META_TABLE_COLUMNS, dataColumns.stream()
                .map(DataColumn::getName)
                .collect(joining(",")));
        schema.setProperty(META_TABLE_COLUMN_TYPES, dataColumns.stream()
                .map(DataColumn::getHiveType)
                .map(HiveType::getHiveTypeName)
                .map(HiveTypeName::toString)
                .collect(joining(":")));
        return schema;
    }

    private static void checkPartitionSchemeSameAsTableScheme(

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure the compression codec class is on the classpath
  2. Switch to a supported compression codec setting
  3. Check the nested exception for classloading details
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveWriterFactory.java:692 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/501bf56a908fc65f. Report an issue: GitHub.