{"record":{"id":"a277a04fdd1df41d","repo":"apache/shardingsphere","slug":"unsupported-expression","errorCode":null,"errorMessage":"Unsupported Expression","messagePattern":"Unsupported Expression","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parser/sql/engine/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/engine/oracle/visitor/statement/type/OracleDMLStatementVisitor.java","lineNumber":1193,"sourceCode":"            return createColumnProjectionSegment((ColumnSegment) projection, alias);\n        }\n        if (projection instanceof BinaryOperationExpression) {\n            return createExpressionProjectionSegment((BinaryOperationExpression) projection, alias);\n        }\n        if (projection instanceof MultisetExpression) {\n            return createExpressionProjectionSegment((MultisetExpression) projection, alias);\n        }\n        if (projection instanceof DatetimeExpression) {\n            return createDatetimeProjectionSegment((DatetimeExpression) projection);\n        }\n        if (projection instanceof IntervalExpressionProjection) {\n            return createIntervalExpressionProjection((IntervalExpressionProjection) projection);\n        }\n        if (projection instanceof CaseWhenExpression || projection instanceof UnaryOperationExpression || projection instanceof VariableSegment\n                || projection instanceof BetweenExpression || projection instanceof InExpression || projection instanceof CollateExpression) {\n            return createExpressionProjectionSegment((ExpressionSegment) projection, alias);\n        }\n        throw new UnsupportedOperationException(\"Unsupported Expression\");\n    }\n    \n    private ColumnProjectionSegment createColumnProjectionSegment(final ColumnSegment projection, final AliasSegment alias) {\n        ColumnProjectionSegment result = new ColumnProjectionSegment(projection);\n        result.setAlias(alias);\n        return result;\n    }\n    \n    private ExpressionProjectionSegment createExpressionProjectionSegment(final BinaryOperationExpression projection, final AliasSegment alias) {\n        int startIndex = projection.getStartIndex();\n        int stopIndex = null == alias ? projection.getStopIndex() : alias.getStopIndex();\n        ExpressionProjectionSegment result = new ExpressionProjectionSegment(startIndex, stopIndex, projection.getText(), projection);\n        result.setAlias(alias);\n        return result;\n    }\n    \n    private ExpressionProjectionSegment createExpressionProjectionSegment(final MultisetExpression projection, final AliasSegment alias) {\n        int startIndex = projection.getStartIndex();","sourceCodeStart":1175,"sourceCodeEnd":1211,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/parser/sql/engine/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/engine/oracle/visitor/statement/type/OracleDMLStatementVisitor.java#L1175-L1211","documentation":"Thrown by OracleDMLStatementVisitor.createProjectionForExpressionSegment, the final fallback in Oracle projection mapping. It handles Column, BinaryOperation, Multiset, Datetime, IntervalExpressionProjection, and the CaseWhen/Unary/Variable/Between/In/Collate group; anything else reaching this method throws UnsupportedOperationException('Unsupported Expression'). This is the last-resort marker for projection node types the Oracle visitor cannot yet translate.","triggerScenarios":"Oracle SELECT projections containing expression shapes outside the handled list — e.g. certain analytic-function segments, newly added segment types, or expressions whose visited class fails every instanceof in the chain. It is triggered only after the alias, complex, and simple branches in 613/614/615 did not match.","commonSituations":"Advanced Oracle SQL (analytic functions, model clauses, exotic operators) routed through ShardingSphere; incremental grammar upgrades that add classes without visitor branches; ORM-generated expression trees.","solutions":["Rewrite the projection using handled constructs (columns, arithmetic, CASE WHEN, literals)","Bypass ShardingSphere parsing for that statement if routing allows (run it directly)","Upgrade ShardingSphere and retest — the handled list grows over versions","Contribute a branch for the missing ExpressionSegment subtype upstream"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { parserEngine.parse(sql); } catch (UnsupportedOperationException e) { logUnsupportedExpression(sql); return directRoute(sql); }","preventionTips":["Keep projections to columns, arithmetic, CASE WHEN, and literals for Oracle through ShardingSphere","Add unsupported-expression telemetry so coverage gaps are found before users"],"tags":["oracle","dml","projection","visitor","unsupported"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}