{"record":{"id":"4f5283fc8d377223","repo":"prestodb/presto","slug":"generic-internal-error-4f5283","errorCode":"GENERIC_INTERNAL_ERROR","errorMessage":"unsupported parameter class: ","messagePattern":"unsupported parameter class: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"critical","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/sketch/kll/KllSketchAggregationState.java","lineNumber":260,"sourceCode":"        {\n            return sketches.sizeOf() + INSTANCE_SIZE + accumulatedSizeInBytes;\n        }\n\n        @Override\n        public void ensureCapacity(long size)\n        {\n            sketches.ensureCapacity(size);\n        }\n    }\n\n    static long getEstimatedKllInMemorySize(@Nullable KllItemsSketch<?> sketch, Class<?> type)\n    {\n        if (sketch == null) {\n            return 0;\n        }\n        double[] parameters = SIZE_ESTIMATOR_PARAMETERS.get(type);\n        if (parameters == null) {\n            throw new PrestoException(GENERIC_INTERNAL_ERROR, \"unsupported parameter class: \" + type.getName());\n        }\n        double linear = parameters[1];\n        double constant = parameters[0];\n        return (long) ((linear * sketch.getSerializedSizeBytes()) + constant);\n    }\n\n    static SketchParameters<?> getSketchParameters(Type type)\n    {\n        if (!type.isOrderable() || !type.isComparable()) {\n            throw new PrestoException(INVALID_ARGUMENTS, type + \" does not support comparisons or ordering\");\n        }\n\n        if (type.equals(REAL)) {\n            return new SketchParameters<>(Double::compareTo, new ArrayOfDoublesSerDe(),\n                    (Object intValue) -> (double) Float.intBitsToFloat(((Long) intValue).intValue()));\n        }\n        else if (type.equals(DOUBLE)) {\n            return new SketchParameters<>(Double::compareTo, new ArrayOfDoublesSerDe());","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/sketch/kll/KllSketchAggregationState.java#L242-L278","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add an entry for the type in KllSketchAggregationState.SIZE_ESTIMATOR_PARAMETERS","Restrict the KLL aggregation functions to the supported types (REAL, BIGINT/INTEGER, VARCHAR)","File/inspect the type name in the message to identify which registration is missing"],"exampleFix":"// before\nSIZE_ESTIMATOR_PARAMETERS only has REAL/DOUBLE/BIGINT/VARCHAR entries\n// after\nSIZE_ESTIMATOR_PARAMETERS.put(INTEGER, new double[]{CONSTANT, LINEAR}); // register the missing type","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["When adding KLL support for a new type, always add a SIZE_ESTIMATOR_PARAMETERS entry","Keep type allowlists for sketch functions in schema checks","Review this table in PRs touching KLL aggregation types"],"tags":["presto","sketch","internal-error","memory-estimation"],"backgroundTag":"unsupported-parameter-type","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}