{"record":{"id":"30795221352a764f","repo":"zhisheng17/flink-learning","slug":"unsupported-command-307952","errorCode":null,"errorMessage":"Unsupported command: {}","messagePattern":"Unsupported command: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-learning-sql/flink-learning-sql-client/src/main/java/com/zhisheng/sql/planner/Planner.java","lineNumber":90,"sourceCode":"                break;\n            case CREATE_TABLE:\n            case CREATE_CATALOG:\n            case USER_CATALOG:\n            case CREATE_VIEW:\n                callUpdate(cmdCall);\n                break;\n            case EXPLAIN_FOR:\n                explain(cmdCall);\n                break;\n            case INSERT_INTO:\n            case INSERT_OVERWRITE:\n                callInsert(cmdCall);\n                break;\n            case CREATE_FUNCTION:\n                callCreateFunction(cmdCall);\n                break;\n            default:\n                throw new RuntimeException(\"Unsupported command: \" + cmdCall.command);\n        }\n    }\n\n    private void callInsert(SqlCommandParser.SqlCommandCall cmdCall) {\n        String dml = cmdCall.operands[0];\n        statementSet.addInsertSql(dml);\n    }\n\n    private void callSet(SqlCommandParser.SqlCommandCall cmdCall) {\n        LOG.info(\"set:\" + cmdCall.operands[0] + \"=\" + cmdCall.operands[1]);\n        String key = cmdCall.operands[0];\n        String value = cmdCall.operands[1];\n\n        if (Constant.IDLE_STATERETENTIOO_TIME.equals(key)) {\n            String unit = value.replaceAll(\"\\\\d+\", \"\");\n            String number = value.replaceAll(\"\\\\w+\", \"\");\n            UnitEnum duration = UnitEnum.valueOf(unit);\n            switch (duration) {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/zhisheng17/flink-learning/blob/d731cee7618021be56d132cc925102ffff8d75e6/flink-learning-sql/flink-learning-sql-client/src/main/java/com/zhisheng/sql/planner/Planner.java#L72-L108","documentation":"Planner.callCommand throws a generic RuntimeException when a SqlCommandCall parsed from the script carries a command enum value the planner's switch does not handle. Every parsed statement must map to a planner branch (callInsert, callUpdate, explain, callCreateFunction); unhandled values hit the default case. It indicates a gap between the parser's command registry and the planner's dispatch.","triggerScenarios":"A statement parses into a SqlCommand (e.g. SET, SELECT, BEGIN/COMMIT style commands) that the Planner's switch statement in callCommand has no case for, so execution falls through to the default throw.","commonSituations":"SQL scripts using client-utility statements (SET, RESET, HELP, QUIT, SELECT) that the parser recognizes but this simplified planner does not dispatch; adding a new SqlCommand enum value without adding a corresponding case in callCommand.","solutions":["Remove or replace the unsupported statement in your SQL script with one the planner handles (INSERT, CREATE TABLE, CREATE FUNCTION, etc.)","Add a case for the missing SqlCommand in Planner.callCommand that routes it to the appropriate handler","Compare the SqlCommand enum's values against the switch cases in callCommand to find the unhandled command"],"exampleFix":"// before\ncase CREATE_FUNCTION:\n    callCreateFunction(cmdCall);\n    break;\ndefault:\n    throw new RuntimeException(\"Unsupported command: \" + cmdCall.command);\n// after\ncase CREATE_FUNCTION:\n    callCreateFunction(cmdCall);\n    break;\ncase SET:\n    callSet(cmdCall);\n    break;\ndefault:\n    throw new RuntimeException(\"Unsupported command: \" + cmdCall.command);","handlingStrategy":"try-catch","validationCode":"SqlCommand cmd = cmdCall.command;\nif (!EnumSet.of(INSERT_INTO, CREATE_TABLE, CREATE_FUNCTION, EXPLAIN).contains(cmd)) {\n    throw new UnsupportedOperationException(\"Command not handled by planner: \" + cmd);\n}","typeGuard":null,"tryCatchPattern":"try {\n    planner.callCommand(cmdCall);\n} catch (RuntimeException e) {\n    LOG.error(\"Planner rejected command {}: {}\", cmdCall.command, e.getMessage());\n    throw e;\n}","preventionTips":["Keep the SqlCommand enum and Planner switch in sync — add a case whenever a command is added","Write a test that dispatches every enum value through callCommand","Filter client-utility commands (SET/QUIT/HELP) out before calling the planner"],"tags":["sql","planner","flink","dispatch"],"backgroundTag":"unsupported-operation","analyzedSha":"d731cee7618021be56d132cc925102ffff8d75e6","analyzedAt":"2026-09-06T05:35:08.496Z","contentChangedAt":"2026-09-06T05:35:08.496Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}