zhisheng17/flink-learning · error · RuntimeException
Unsupported command: {}
Error message
Unsupported command: {} What it means
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.
Source
Thrown at flink-learning-sql/flink-learning-sql-client/src/main/java/com/zhisheng/sql/planner/Planner.java:90
break;
case CREATE_TABLE:
case CREATE_CATALOG:
case USER_CATALOG:
case CREATE_VIEW:
callUpdate(cmdCall);
break;
case EXPLAIN_FOR:
explain(cmdCall);
break;
case INSERT_INTO:
case INSERT_OVERWRITE:
callInsert(cmdCall);
break;
case CREATE_FUNCTION:
callCreateFunction(cmdCall);
break;
default:
throw new RuntimeException("Unsupported command: " + cmdCall.command);
}
}
private void callInsert(SqlCommandParser.SqlCommandCall cmdCall) {
String dml = cmdCall.operands[0];
statementSet.addInsertSql(dml);
}
private void callSet(SqlCommandParser.SqlCommandCall cmdCall) {
LOG.info("set:" + cmdCall.operands[0] + "=" + cmdCall.operands[1]);
String key = cmdCall.operands[0];
String value = cmdCall.operands[1];
if (Constant.IDLE_STATERETENTIOO_TIME.equals(key)) {
String unit = value.replaceAll("\\d+", "");
String number = value.replaceAll("\\w+", "");
UnitEnum duration = UnitEnum.valueOf(unit);
switch (duration) {View on GitHub (pinned to d731cee761)
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
Example fix
// before
case CREATE_FUNCTION:
callCreateFunction(cmdCall);
break;
default:
throw new RuntimeException("Unsupported command: " + cmdCall.command);
// after
case CREATE_FUNCTION:
callCreateFunction(cmdCall);
break;
case SET:
callSet(cmdCall);
break;
default:
throw new RuntimeException("Unsupported command: " + cmdCall.command); Defensive patterns
Strategy: try-catch
Validate before calling
SqlCommand cmd = cmdCall.command;
if (!EnumSet.of(INSERT_INTO, CREATE_TABLE, CREATE_FUNCTION, EXPLAIN).contains(cmd)) {
throw new UnsupportedOperationException("Command not handled by planner: " + cmd);
} Try / catch
try {
planner.callCommand(cmdCall);
} catch (RuntimeException e) {
LOG.error("Planner rejected command {}: {}", cmdCall.command, e.getMessage());
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unsupported command '{}'
- SQL parse failed: {}
- invalid elasticsearch hosts format
- invalid elasticsearch hosts format
- Unsupported client type - cannot happen
AI-assisted analysis of zhisheng17/flink-learning@d731cee761 (2026-09-06).
Data as JSON: /api/errors/30795221352a764f.
Report an issue: GitHub.