prestodb/presto · critical · PrestoException

GENERIC_INTERNAL_ERROR

GENERIC_INTERNAL_ERROR

Error message

unsupported parameter class: 

What it means

KllSketchAggregationState.getEstimatedKllInMemorySize estimates a KLL sketch's memory footprint using a per-type table (SIZE_ESTIMATOR_PARAMETERS) of linear/constant coefficients. If the aggregation's type is not in that table, the library throws GENERIC_INTERNAL_ERROR, since estimation cannot proceed for an unsupported type.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/sketch/kll/KllSketchAggregationState.java:260

        {
            return sketches.sizeOf() + INSTANCE_SIZE + accumulatedSizeInBytes;
        }

        @Override
        public void ensureCapacity(long size)
        {
            sketches.ensureCapacity(size);
        }
    }

    static long getEstimatedKllInMemorySize(@Nullable KllItemsSketch<?> sketch, Class<?> type)
    {
        if (sketch == null) {
            return 0;
        }
        double[] parameters = SIZE_ESTIMATOR_PARAMETERS.get(type);
        if (parameters == null) {
            throw new PrestoException(GENERIC_INTERNAL_ERROR, "unsupported parameter class: " + type.getName());
        }
        double linear = parameters[1];
        double constant = parameters[0];
        return (long) ((linear * sketch.getSerializedSizeBytes()) + constant);
    }

    static SketchParameters<?> getSketchParameters(Type type)
    {
        if (!type.isOrderable() || !type.isComparable()) {
            throw new PrestoException(INVALID_ARGUMENTS, type + " does not support comparisons or ordering");
        }

        if (type.equals(REAL)) {
            return new SketchParameters<>(Double::compareTo, new ArrayOfDoublesSerDe(),
                    (Object intValue) -> (double) Float.intBitsToFloat(((Long) intValue).intValue()));
        }
        else if (type.equals(DOUBLE)) {
            return new SketchParameters<>(Double::compareTo, new ArrayOfDoublesSerDe());

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Add an entry for the type in KllSketchAggregationState.SIZE_ESTIMATOR_PARAMETERS
  2. Restrict the KLL aggregation functions to the supported types (REAL, BIGINT/INTEGER, VARCHAR)
  3. File/inspect the type name in the message to identify which registration is missing

Example fix

// before
SIZE_ESTIMATOR_PARAMETERS only has REAL/DOUBLE/BIGINT/VARCHAR entries
// after
SIZE_ESTIMATOR_PARAMETERS.put(INTEGER, new double[]{CONSTANT, LINEAR}); // register the missing type
Defensive patterns

Strategy: try-catch

Try / catch

try { result = kllAgg.query(); } catch (PrestoException e) { if (e.getErrorCode().getName().equals("GENERIC_INTERNAL_ERROR") && e.getMessage().startsWith("unsupported parameter class")) { registerSizeEstimator(type); retry(); } else throw e; }

Prevention

When it happens

Trigger: Calling a KLL sketch aggregation (size/memory estimation path) with a Type not present in SIZE_ESTIMATOR_PARAMETERS, reached via getEstimatedKllInMemorySize when sketch is non-null.

Common situations: Adding KLL sketch support for a new type without updating the size-estimator table; using the aggregation on an unexpected type due to schema change.

Related errors


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