{"record":{"id":"a840927ebf97097b","repo":"apache/seatunnel","slug":"no-result-returned-after-running-query-s-a84092","errorCode":null,"errorMessage":"No result returned after running query [%s]","messagePattern":"No result returned after running query \\[(.+?)\\]","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialect.java","lineNumber":480,"sourceCode":"                    String.format(\n                            \"SELECT MAX(%s) FROM (\"\n                                    + \"SELECT %s FROM %s WHERE %s >= ? ORDER BY %s ASC LIMIT %s\"\n                                    + \") AS T\",\n                            quotedColumn,\n                            quotedColumn,\n                            tableIdentifier(table.getTablePath()),\n                            quotedColumn,\n                            quotedColumn,\n                            chunkSize);\n        }\n        try (PreparedStatement ps = connection.prepareStatement(sqlQuery)) {\n            ps.setObject(1, includedLowerBound);\n            try (ResultSet rs = ps.executeQuery()) {\n                if (rs.next()) {\n                    return rs.getObject(1);\n                } else {\n                    // this should never happen\n                    throw new SQLException(\n                            String.format(\"No result returned after running query [%s]\", sqlQuery));\n                }\n            }\n        }\n    }\n\n    default JdbcConnectionProvider getJdbcConnectionProvider(\n            JdbcConnectionConfig jdbcConnectionConfig) {\n        return new SimpleJdbcConnectionProvider(jdbcConnectionConfig);\n    }\n\n    /**\n     * Cast column type e.g. CAST(column AS type)\n     *\n     * @param columnName\n     * @param columnType\n     * @return the text of converted column type.\n     */","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialect.java#L462-L498","documentation":"queryNextChunkMax runs a 'SELECT MAX(col) FROM table WHERE col >= ?' chunk-boundary query and throws SQLException('No result returned after running query [%s]') if the ResultSet is empty. The code comments this 'should never happen': a MAX aggregate over the chunk range is expected to return exactly one row, so an empty result indicates a logically impossible or corrupted state.","triggerScenarios":"During JDBC source split chunking, the query `SELECT MAX(<splitCol>) FROM (SELECT <splitCol> FROM <table> WHERE <splitCol> >= ? ORDER BY ... LIMIT <rows>)` returns no rows — e.g. the lower bound exceeds all data between snapshot reads, concurrent deletes removed the range, or the table/SQL was built against an empty/incompatible schema.","commonSituations":"Data being deleted concurrently while incremental snapshot chunking runs; split column values changed between enumeration and read; incorrect primary key/split column configuration; chunkSize/table bounds computed from stale statistics.","solutions":["Re-run the job; transient concurrent deletes are the usual cause","Use a stable, monotonic, non-mutated split column (primary key) and avoid heavy deletes during snapshot reads","Verify the table has rows and the configured split column/table names are correct","If reproducible with no concurrent writes, report it — it signals an internal inconsistency in chunk bound computation"],"exampleFix":"// before\n# heavy DELETE jobs running against source table during snapshot\nparallelism = 8, chunkSize = 10000, concurrent deletes in prod\n// after\n# schedule deletes outside snapshot window or use a stable append-only split column\nsplit.column = \"id\"  # monotonic PK, never updated/deleted during read","handlingStrategy":"retry","validationCode":"// before reading, verify bounds still valid\ntry (PreparedStatement ps = conn.prepareStatement(\"SELECT COUNT(*) FROM \" + table + \" WHERE \" + col + \" >= ?\")) {\n    ps.setObject(1, lowerBound);\n    try (ResultSet rs = ps.executeQuery()) {\n        rs.next();\n        if (rs.getLong(1) == 0) LOG.warn(\"No rows at/above {} for {}:{}; chunk bounds may be stale\", lowerBound, table, col);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object max = dialect.queryNextChunkMax(conn, table, col, chunkSize, lowerBound);\n} catch (SQLException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"No result returned\")) {\n        LOG.warn(\"Chunk max query returned no rows (likely concurrent deletes); retrying/recomputing bounds\");\n        return; // recompute or skip chunk\n    }\n    throw e;\n}","preventionTips":["Use a stable, monotonic primary key as the split column","Avoid bulk DELETEs on the source table during snapshot reads","Verify the split column and table names in source config","Retry failed chunks; this failure is usually transient under concurrent writes"],"tags":["jdbc","source","chunking","sql"],"backgroundTag":"empty-result-set","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}