prestodb/presto · error · PrestoException

HIVE_METASTORE_ERROR

HIVE_METASTORE_ERROR

Error message

currentStatistics is null

What it means

An internal invariant check during partition add/alter: the existing partition's statistics object (currentStatistics) is unexpectedly null when computing the new partition state, indicating a coding/consistency defect rather than user error; it is raised via checkNotNull-style validation.

Source

Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java:961

        MetastoreContext metastoreContext = new MetastoreContext(
                session.getIdentity(),
                session.getQueryId(),
                session.getClientInfo(),
                session.getClientTags(),
                session.getSource(),
                getMetastoreHeaders(session),
                isUserDefinedTypeEncodingEnabled(session),
                columnConverterProvider,
                session.getWarningCollector(),
                session.getRuntimeStats());

        if (oldPartitionAction == null) {
            Partition partition = delegate.getPartition(metastoreContext, databaseName, tableName, partitionValues)
                    .orElseThrow(() -> new PartitionNotFoundException(schemaTableName, partitionValues));
            String partitionName = getPartitionName(metastoreContext, databaseName, tableName, partitionValues);
            PartitionStatistics currentStatistics = delegate.getPartitionStatistics(metastoreContext, databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName);
            if (currentStatistics == null) {
                throw new PrestoException(HIVE_METASTORE_ERROR, "currentStatistics is null");
            }
            HdfsContext context = new HdfsContext(session, databaseName, tableName, tablePath, false);
            partitionActionsOfTable.put(
                    partitionValues,
                    new Action<>(
                            ActionType.INSERT_EXISTING,
                            new PartitionAndMore(
                                    partition,
                                    currentLocation,
                                    Optional.of(fileNames),
                                    merge(currentStatistics, statisticsUpdate),
                                    statisticsUpdate),
                            context));
            return;
        }

        switch (oldPartitionAction.getType()) {
            case DROP:

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Report as a bug with the query plan and operation sequence that triggered it
  2. Work around by recreating the affected partition so its metadata (including statistics) is regenerated
  3. Check the metastore partition metadata for null/missing statistics fields
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java:961 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/1ad4e875340c1fd1. Report an issue: GitHub.