{"record":{"id":"d5d380fdbc0fb72d","repo":"apache/shardingsphere","slug":"unsupported-tablesegment-type-s","errorCode":null,"errorMessage":"unsupported TableSegment type: %s","messagePattern":"unsupported TableSegment type: (.+?)","errorType":"exception","errorClass":"UnsupportedSQLOperationException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/ExpressionConverter.java","lineNumber":170,"sourceCode":"        if (segment instanceof RowExpression) {\n            return Optional.of(RowExpressionConverter.convert((RowExpression) segment));\n        }\n        if (segment instanceof VariableSegment) {\n            return Optional.of(VariableSegmentConverter.convert((VariableSegment) segment));\n        }\n        if (segment instanceof UnaryOperationExpression) {\n            return Optional.of(UnaryOperationExpressionConverter.convert((UnaryOperationExpression) segment));\n        }\n        if (segment instanceof IntervalExpression) {\n            return Optional.of(IntervalExpressionConverter.convert((IntervalExpression) segment));\n        }\n        if (segment instanceof IntervalUnitExpression) {\n            return IntervalUnitExpressionConverter.convert((IntervalUnitExpression) segment);\n        }\n        if (segment instanceof QuantifySubqueryExpression) {\n            return Optional.of(QuantifySubqueryExpressionConverter.convert((QuantifySubqueryExpression) segment));\n        }\n        throw new UnsupportedSQLOperationException(\"unsupported TableSegment type: \" + segment.getClass());\n    }\n}\n","sourceCodeStart":152,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/ExpressionConverter.java#L152-L173","documentation":"The final catch-all of ExpressionConverter.convert: after testing every supported ExpressionSegment subtype (literal, column, binary, unary, interval, subquery expressions, ...), an unrecognized segment class yields UnsupportedSQLOperationException with the segment's class name. It marks expression AST types the federation compiler cannot yet translate.","triggerScenarios":"A federated query contains an expression segment type added or rarely used (e.g. a newer parser segment like CaseWhen or a dialect-specific expression) that reaches the converter without a matching branch; thrown during SqlNode conversion at compile time.","commonSituations":"Version skew: SQL parser produces newer segment types than the federation converter handles; unusual SQL constructs (special function expressions, XML/json expressions) in federated queries.","solutions":["Simplify the SQL: replace the expression construct that produces the unrecognized segment with basic constructs (columns, literals, standard operators).","Disable federation for the affected query or rule so it routes normally.","Align proxy modules to one ShardingSphere version so parser segments and federation converters match.","Report the segment class name shown in the message upstream."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    rs = executeFederated(sql);\n} catch (final SQLFederationUnsupportedSQLException ex) {\n    if (ex.getMessage().contains(\"unsupported TableSegment type\")) { rs = executeRouted(sql); } else { throw ex; }\n}","preventionTips":["Use same-version proxy modules so parser segments and converters stay in sync.","Avoid novel SQL constructs in cross-shard queries when federation is enabled.","Log the segment class name from the message to pinpoint unsupported syntax."],"tags":["sql-federation","calcite","expression","converter"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}