{"record":{"id":"37cd5d55bfd1299a","repo":"prestodb/presto","slug":"getquerytype-method-is-not-supported","errorCode":null,"errorMessage":"getQueryType method is not supported!","messagePattern":"getQueryType method is not supported!","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"presto-common/src/main/java/com/facebook/presto/common/analyzer/PreparedQuery.java","lineNumber":45,"sourceCode":"    public PreparedQuery(Optional<String> formattedQuery, Optional<String> prepareSql)\n    {\n        this.formattedQuery = requireNonNull(formattedQuery, \"formattedQuery is null\");\n        this.prepareSql = requireNonNull(prepareSql, \"prepareSql is null\");\n    }\n\n    public Optional<String> getFormattedQuery()\n    {\n        return formattedQuery;\n    }\n\n    public Optional<String> getPrepareSql()\n    {\n        return prepareSql;\n    }\n\n    public Optional<QueryType> getQueryType()\n    {\n        throw new UnsupportedOperationException(\"getQueryType method is not supported!\");\n    }\n\n    public boolean isTransactionControlStatement()\n    {\n        throw new UnsupportedOperationException(\"isTransactionControlStatement method is not supported!\");\n    }\n\n    public boolean isRollbackStatement()\n    {\n        throw new UnsupportedOperationException(\"isRollbackStatement method is not supported!\");\n    }\n\n    public Class<?> getStatementClass()\n    {\n        throw new UnsupportedOperationException(\"getStatementClass method is not supported!\");\n    }\n\n    public boolean isExplainTypeValidate()","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common/src/main/java/com/facebook/presto/common/analyzer/PreparedQuery.java#L27-L63","documentation":"Base PreparedQuery carries only the formatted SQL text and does not hold analysis results; calling getQueryType on it is a programming error — a subclass holding the analyzed statement must be used instead.","triggerScenarios":"Thrown at presto-common/src/main/java/com/facebook/presto/common/analyzer/PreparedQuery.java:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call this method only on the analysis-carrying PreparedQuery subclass","Refactor the caller to obtain query type from the QueryExecution analysis"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}