{"record":{"id":"bb74568f364f369c","repo":"apache/shardingsphere","slug":"get-input-stream-from-s-bb7456","errorCode":null,"errorMessage":"Get input stream from `%s`","messagePattern":"Get input stream from `(.+?)`","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSet.java","lineNumber":508,"sourceCode":"        return result;\n    }\n    \n    private Object getValue(final int columnIndex, final Class<?> type) throws SQLException {\n        ShardingSpherePreconditions.checkNotContains(INVALID_FEDERATION_TYPES, type, () -> new SQLFeatureNotSupportedException(String.format(\"Get value from `%s`\", type.getName())));\n        Object result = currentRows[columnIndex - 1];\n        wasNull = null == result;\n        return null == columnTypeConverter ? result : columnTypeConverter.convertColumnValue(result);\n    }\n    \n    private Object getCalendarValue(final int columnIndex) {\n        // TODO implement with calendar\n        Object result = currentRows[columnIndex - 1];\n        wasNull = null == result;\n        return result;\n    }\n    \n    private InputStream getInputStream(final String type) throws SQLException {\n        throw new SQLFeatureNotSupportedException(String.format(\"Get input stream from `%s`\", type));\n    }\n}\n","sourceCodeStart":490,"sourceCodeEnd":511,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSet.java#L490-L511","documentation":"SQLFederationResultSet.getInputStream(String) throws SQLFeatureNotSupportedException('Get input stream from `<type>`') whenever a binary/ascii stream getter (getAsciiStream, getUnicodeStream, getBinaryStream) is called. The federation ResultSet does not implement stream-based column access, only object-based getters routed through get(columnIndex).","triggerScenarios":"Calling rs.getAsciiStream(col), rs.getBinaryStream(col), or rs.getUnicodeStream(col) on the ResultSet of a federation query (e.g. streaming a BLOB/CLOB out of a federated join result). The `%s` in the message names the stream type that was requested.","commonSituations":"File-download servlets that stream BLOBs via getBinaryStream; MyBatis/BLOB handlers using stream getters; code that worked on non-federated sharding results or a native driver and broke once sql_federation kicked in for the query.","solutions":["Use object getters instead: getBytes(col)/getBlob(col) for binary, getString(col)/getClob(col) for text, then wrap the value in a stream if needed.","Rewrite the query so it is not routed through the federation engine when stream access is required.","Disable or narrow sql_federation rules so only queries that truly need federation use it.","In generic row-consumer code, detect SQLFeatureNotSupportedException from stream getters and retry with getBytes/getString."],"exampleFix":"// before\ntry (InputStream in = rs.getBinaryStream(\"data\")) { ... } // throws on federated rs\n\n// after\nbyte[] data = rs.getBytes(\"data\");\ntry (InputStream in = data == null ? null : new ByteArrayInputStream(data)) { ... }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try (InputStream in = rs.getBinaryStream(col)) { ... } catch (final SQLFeatureNotSupportedException ex) { byte[] data = rs.getBytes(col); /* proceed from byte[] */ }","preventionTips":["Prefer object getters (getBytes/getString/getBlob/getClob) over stream getters.","Identify federation-routed queries in your workload before relying on stream access.","Wrap stream getters in shared row-mapping code with a byte[] fallback."],"tags":["jdbc","resultset","sql-federation","streaming","blob","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}