apache/shardingsphere · error · UnsupportedOperationException
Unsupported Simple Expression
Error message
Unsupported Simple Expression
What it means
Thrown by OracleDMLStatementVisitor.createProjectionForSimpleExpressionSegment when a 'simple' projection is neither SubqueryExpressionSegment nor LiteralExpressionSegment. The UnsupportedOperationException('Unsupported Simple Expression') is a narrow coverage gap: only subqueries and literals are handled as simple expressions in this branch.
Source
Thrown at parser/sql/engine/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/engine/oracle/visitor/statement/type/OracleDMLStatementVisitor.java:1169
}
private ASTNode createProjectionForSimpleExpressionSegment(final ASTNode projection, final AliasSegment alias, final SelectProjectionExprClauseContext ctx) {
if (projection instanceof SubqueryExpressionSegment) {
SubqueryExpressionSegment subqueryExpressionSegment = (SubqueryExpressionSegment) projection;
String text = ctx.start.getInputStream().getText(new Interval(subqueryExpressionSegment.getStartIndex(), subqueryExpressionSegment.getStopIndex()));
SubqueryProjectionSegment result = new SubqueryProjectionSegment(((SubqueryExpressionSegment) projection).getSubquery(), text);
result.setAlias(alias);
return result;
}
if (projection instanceof LiteralExpressionSegment) {
LiteralExpressionSegment column = (LiteralExpressionSegment) projection;
ExpressionProjectionSegment result = null == alias
? new ExpressionProjectionSegment(column.getStartIndex(), column.getStopIndex(), column.getText(), column)
: new ExpressionProjectionSegment(column.getStartIndex(), ctx.alias().stop.getStopIndex(), column.getText(), column);
result.setAlias(alias);
return result;
}
throw new UnsupportedOperationException("Unsupported Simple Expression");
}
private ASTNode createProjectionForExpressionSegment(final ASTNode projection, final AliasSegment alias) {
// FIXME :For DISTINCT()
if (projection instanceof ColumnSegment) {
return createColumnProjectionSegment((ColumnSegment) projection, alias);
}
if (projection instanceof BinaryOperationExpression) {
return createExpressionProjectionSegment((BinaryOperationExpression) projection, alias);
}
if (projection instanceof MultisetExpression) {
return createExpressionProjectionSegment((MultisetExpression) projection, alias);
}
if (projection instanceof DatetimeExpression) {
return createDatetimeProjectionSegment((DatetimeExpression) projection);
}
if (projection instanceof IntervalExpressionProjection) {
return createIntervalExpressionProjection((IntervalExpressionProjection) projection);View on GitHub (pinned to e952770a21)
Solutions
- Replace the expression with a literal or move it into a subquery projection form
- Check whether a newer ShardingSphere version adds the missing simple-expression branch
- Reproduce with a minimal SELECT and file an upstream issue including the statement
Defensive patterns
Strategy: try-catch
Try / catch
try { parserEngine.parse(sql); } catch (UnsupportedOperationException e) { throw new StatementUnsupportedException(sql, e); } Prevention
- Use literals or subqueries in projections; avoid unusual parameter-marker placements
- Verify prepared-statement projections parse before deploying
When it happens
Trigger: A projection routed here (via the SimpleExpressionSegment branch in 613) whose concrete node is not a subquery or literal — e.g. a parameter marker or variable expression classified as 'simple' by an instanceof on a marker interface but lacking a dedicated branch here.
Common situations: Prepared statements with ? markers in unusual projection positions; bind-variable-heavy Oracle SQL; upgrades that reclassify segments under the SimpleExpressionSegment hierarchy.
Related errors
- Unhandled case
- Unsupported Complex 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/55584afd57f15c7a.
Report an issue: GitHub.