{"record":{"id":"c65cf1685842f376","repo":"prestodb/presto","slug":"unsupported-function-kind-s","errorCode":null,"errorMessage":"Unsupported function kind: %s","messagePattern":"Unsupported function kind: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java","lineNumber":829,"sourceCode":"                                    SortItem.Ordering.ASCENDING,\n                                    SortItem.NullOrdering.UNDEFINED),\n                            ascending(\"return_type\"),\n                            ascending(\"argument_types\"),\n                            ascending(\"function_type\"))));\n        }\n\n        private static String getFunctionType(SqlFunction function)\n        {\n            FunctionKind kind = function.getSignature().getKind();\n            switch (kind) {\n                case AGGREGATE:\n                    return \"aggregate\";\n                case WINDOW:\n                    return \"window\";\n                case SCALAR:\n                    return \"scalar\";\n            }\n            throw new IllegalArgumentException(\"Unsupported function kind: \" + kind);\n        }\n\n        @Override\n\n        protected Node visitShowSession(ShowSession node, Void context)\n        {\n            ImmutableList.Builder<Expression> rows = ImmutableList.builder();\n            SortedMap<String, ConnectorId> catalogNames = listCatalogs(session, metadata, accessControl);\n            List<SessionPropertyValue> sessionProperties = metadata.getSessionPropertyManager().getAllSessionProperties(session, catalogNames);\n            for (SessionPropertyValue sessionProperty : sessionProperties) {\n                if (sessionProperty.isHidden()) {\n                    continue;\n                }\n\n                String value = sessionProperty.getValue();\n                String defaultValue = sessionProperty.getDefaultValue();\n                rows.add(row(\n                        new StringLiteral(sessionProperty.getFullyQualifiedName()),","sourceCodeStart":811,"sourceCodeEnd":847,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java#L811-L847","documentation":"An internal guard in the function-kind-to-string helper: the FunctionKind enum had a value with no mapped case (only AGGREGATE, WINDOW, SCALAR are handled), so an IllegalArgumentException is thrown. Users never trigger this directly; it indicates a new FunctionKind was added to the engine without updating this switch.","triggerScenarios":"Rendering a function kind label for a FunctionKind value outside AGGREGATE/WINDOW/SCALAR (e.g. new kinds added in the enum) during SHOW FUNCTIONS or similar output paths in this visitor.","commonSituations":"Presto version upgrade adding a FunctionKind while this rewrite (or a fork/backport) lags behind; custom builds with an extended enum.","solutions":["Upgrade presto-main-base / the rewrite class to a version whose switch covers all FunctionKind values","Patch the switch to handle the new kind (e.g. map it to a sensible label) instead of falling through","File/track the inconsistency with the FunctionKind enum definition"],"exampleFix":"// before\ncase SCALAR: return \"scalar\";\n}\n// after\ncase SCALAR: return \"scalar\";\ncase INLINE: return \"inline\";  // handle new kind\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":"static boolean isRenderableKind(FunctionKind kind) {\n  return kind == FunctionKind.AGGREGATE || kind == FunctionKind.WINDOW || kind == FunctionKind.SCALAR;\n}","tryCatchPattern":"try { return labelFor(kind); } catch (IllegalArgumentException e) { return kind.name().toLowerCase(Locale.ROOT); }","preventionTips":["Keep the kind-label switch in sync with the FunctionKind enum","Add enum exhaustiveness checks/CI tests when extending FunctionKind","Prefer a default branch mapping unknown kinds to their enum name"],"tags":["presto","internal","enum-exhaustiveness","function-kind"],"backgroundTag":"unhandled-enum-value","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"}