apache/shardingsphere · error · UnsupportedOperationException
Unhandled case
Error message
Unhandled case
What it means
Thrown by OracleDMLStatementVisitor when a select projection with an alias cannot be classified. After the alias-available, ComplexExpressionSegment, SimpleExpressionSegment, and generic ExpressionSegment branches fail, the method throws UnsupportedOperationException('Unhandled case'). Like 612-616 this is a visitor coverage gap in Oracle projection mapping, not invalid SQL syntax.
Source
Thrown at parser/sql/engine/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/engine/oracle/visitor/statement/type/OracleDMLStatementVisitor.java:1130
}
private ASTNode createProjection(final SelectProjectionExprClauseContext ctx) {
AliasSegment alias = null == ctx.alias() ? null : (AliasSegment) visit(ctx.alias());
ASTNode projection = visit(ctx.expr());
if (projection instanceof AliasAvailable) {
((AliasAvailable) projection).setAlias(alias);
return projection;
}
if (projection instanceof ComplexExpressionSegment) {
return createProjectionForComplexExpressionSegment(projection, alias);
}
if (projection instanceof SimpleExpressionSegment) {
return createProjectionForSimpleExpressionSegment(projection, alias, ctx);
}
if (projection instanceof ExpressionSegment) {
return createProjectionForExpressionSegment(projection, alias);
}
throw new UnsupportedOperationException("Unhandled case");
}
private ASTNode createProjectionForComplexExpressionSegment(final ASTNode projection, final AliasSegment alias) {
if (projection instanceof FunctionSegment) {
FunctionSegment segment = (FunctionSegment) projection;
ExpressionProjectionSegment result = new ExpressionProjectionSegment(segment.getStartIndex(), segment.getStopIndex(), segment.getText(), segment);
result.setAlias(alias);
return result;
}
if (projection instanceof CommonExpressionSegment) {
CommonExpressionSegment segment = (CommonExpressionSegment) projection;
ExpressionProjectionSegment result = new ExpressionProjectionSegment(segment.getStartIndex(), segment.getStopIndex(), segment.getText(), segment);
result.setAlias(alias);
return result;
}
if (projection instanceof XmlQueryAndExistsFunctionSegment || projection instanceof XmlPiFunctionSegment || projection instanceof XmlSerializeFunctionSegment
|| projection instanceof XmlElementFunctionSegment) {
return createExpressionProjectionSegment((ExpressionSegment) projection, alias);View on GitHub (pinned to e952770a21)
Solutions
- Rewrite the projection into a simpler expression or plain column
- Test with a newer ShardingSphere release where additional segment types are handled
- Isolate the failing projection by reducing the select list item by item
- File an issue with the exact expression so the branch is added upstream
Defensive patterns
Strategy: try-catch
Try / catch
try { parserEngine.parse(sql); } catch (UnsupportedOperationException e) { logAndSimplifyProjection(sql, e); } Prevention
- Reduce select lists to columns, literals, and standard arithmetic when routing through ShardingSphere
- Track upstream visitor coverage in release notes before adopting exotic Oracle expressions
When it happens
Trigger: An Oracle SELECT projection whose visited node type is not AliasAvailable and implements none of the three expression interfaces — for example a segment type introduced by a grammar change or a rarely used expression form (certain XML/collection/row expressions fall through if their earlier-specific branches do not match).
Common situations: Complex analytic queries with unusual projections on Oracle; mixing new SQL features after an upgrade; custom parser extensions registering segment types without extending this visitor.
Related errors
- Unsupported Complex Expression
- Unsupported Simple Expression
- Unsupported Expression
- Unsupported Returning Expression
- Projections not in simple select, table subquery, join subqu
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/fdaf2467780f2a79.
Report an issue: GitHub.