prestodb/presto · error · PrestoException

ICEBERG_INVALID_MATERIALIZED_VIEW

ICEBERG_INVALID_MATERIALIZED_VIEW

Error message

Invalid materialized view format version: %s

What it means

Materialized-view loading parses the required PRESTO_MATERIALIZED_VIEW_FORMAT_VERSION property to an int; when the stored version string is missing/blank or not a number (or outside known versions), this error reports the invalid value, indicating a corrupted or hand-edited materialized-view metadata property.

Source

Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:2106

        if (!viewMetadata.isPresent() || !viewMetadata.get().isMaterializedView()) {
            return Optional.empty();
        }

        Map<String, String> viewProperties = viewMetadata.get().getProperties();
        String originalSql = viewProperties.get(PRESTO_MATERIALIZED_VIEW_ORIGINAL_SQL);

        if (originalSql == null) {
            return Optional.empty();
        }

        // Validate format version
        String formatVersion = getRequiredMaterializedViewProperty(viewProperties, PRESTO_MATERIALIZED_VIEW_FORMAT_VERSION);
        int version;
        try {
            version = Integer.parseInt(formatVersion);
        }
        catch (NumberFormatException e) {
            throw new PrestoException(ICEBERG_INVALID_MATERIALIZED_VIEW,
                    format("Invalid materialized view format version: %s", formatVersion));
        }

        if (version != CURRENT_MATERIALIZED_VIEW_FORMAT_VERSION) {
            throw new PrestoException(ICEBERG_INVALID_MATERIALIZED_VIEW,
                    format("Materialized view format version %d is not supported by this version of Presto (current version: %d). Please upgrade Presto.",
                            version, CURRENT_MATERIALIZED_VIEW_FORMAT_VERSION));
        }

        String baseTablesStr = getRequiredMaterializedViewProperty(viewProperties, PRESTO_MATERIALIZED_VIEW_BASE_TABLES);
        List<SchemaTableName> baseTables;
        if (baseTablesStr.isEmpty()) {
            baseTables = ImmutableList.of();
        }
        else {
            baseTables = deserializeSchemaTableNames(baseTablesStr);
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Drop and recreate the materialized view so the format-version property is written correctly
  2. Fix the property value in the view's metadata to a valid integer version
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:2106 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/fa94d78bcba9add4. Report an issue: GitHub.