{"record":{"id":"e2fa135a290c8e43","repo":"apache/shardingsphere","slug":"sql-federation-does-not-support-sql-s","errorCode":null,"errorMessage":"SQL federation does not support SQL '%s'.","messagePattern":"SQL federation does not support SQL '(.+?)'\\.","errorType":"exception","errorClass":"SQLFederationUnsupportedSQLException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java","lineNumber":231,"sourceCode":"            SQLFederationRelConverter converter = new SQLFederationRelConverter(compilerContext, getSchemaPath(sqlStatementContext),\n                    sqlStatementContext.getSqlStatement().getDatabaseType(), processor.getConvention());\n            schemaPlus = converter.getSchemaPlus();\n            processor.prepare(prepareEngine, queryCallback, currentDatabaseName, currentSchemaName, federationContext, compilerContext, schemaPlus);\n            SQLFederationExecutionPlan executionPlan = compileQuery(converter, currentDatabaseName,\n                    currentSchemaName, federationContext, sqlStatementContext, queryContext.getSql(), processor.getConvention());\n            logExecutionPlan(executionPlan, federationContext.getMetaData().getProps());\n            resultSet = processor.executePlan(prepareEngine, queryCallback, executionPlan, converter, federationContext, schemaPlus);\n            return resultSet;\n            // CHECKSTYLE:OFF\n        } catch (final Exception ex) {\n            // CHECKSTYLE:ON\n            String errorMessage = splitErrorMessage(ex);\n            log.error(\"SQL Federation execute failed, sql {}, parameters {}, reason {}\", queryContext.getSql(), queryContext.getParameters(), errorMessage);\n            closeResources(federationContext);\n            if (NEED_THROW_EXCEPTION_TYPES.stream().anyMatch(each -> each.isAssignableFrom(ex.getClass()))) {\n                throw ex;\n            }\n            throw new SQLFederationUnsupportedSQLException(queryContext.getSql(), errorMessage);\n        }\n    }\n    \n    private String splitErrorMessage(final Exception ex) {\n        return null == ex.getMessage() ? \"\" : ex.getMessage().substring(0, Math.min(ex.getMessage().length(), MAX_ERROR_MESSAGE_LENGTH));\n    }\n    \n    private void closeResources(final SQLFederationContext federationContext) {\n        try {\n            processEngine.completeSQLExecution(federationContext.getProcessId());\n            close();\n            // CHECKSTYLE:OFF\n        } catch (final Exception ex) {\n            // CHECKSTYLE:ON\n            log.warn(\"Failed to close SQL federation engine resources: {}\", ex.getMessage());\n        }\n    }\n    ","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java#L213-L249","documentation":"SQLFederationEngine.execute0 wraps the whole federation pipeline (schema conversion, plan compilation, execution). Any exception not in NEED_THROW_EXCEPTION_TYPES is rethrown as SQLFederationUnsupportedSQLException with the SQL and a truncated reason, after resources are closed. It is the umbrella 'federation could not run this SQL' error — the real cause is in the proxied log line and the reason string.","triggerScenarios":"Executing a query with sql-federation enabled where any stage fails: unsupported expression/table conversion (errors 411-415), Calcite compilation errors, missing schema/column mapping, or execution-time failures not whitelisted for pass-through.","commonSituations":"Cross-shard queries with constructs the federation compiler does not support; views or joins that force federation; metadata/schema mismatches; version-dependent converter gaps.","solutions":["Read the 'reason' fragment in the exception message and cross-check with the proxy log line 'SQL Federation execute failed, sql ..., reason ...' for the full cause.","Rewrite the unsupported construct (see the underlying converter error) or add missing metadata.","Disable federation for this statement or rule (execution strategy NONE) to fall back to normal routed execution.","Upgrade ShardingSphere for broader federation coverage."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    rs = federationExecutor.execute(...);\n} catch (final SQLFederationUnsupportedSQLException ex) {\n    log.warn(\"Federation unsupported, falling back: {}\", ex.getMessage());\n    rs = executeWithFederationDisabled(sql, params);\n}","preventionTips":["Retain a non-federated fallback for every federated report query.","Parse the 'reason' field to map to the underlying converter gap.","Track which SQL shapes federate successfully in tests."],"tags":["sql-federation","wrapper","execution","calcite"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}