apache/seatunnel · error · SQLException
No result returned after running query
Error message
No result returned after running query [%s]
What it means
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.
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
Example fix
// before # heavy DELETE jobs running against source table during snapshot parallelism = 8, chunkSize = 10000, concurrent deletes in prod // after # schedule deletes outside snapshot window or use a stable append-only split column split.column = "id" # monotonic PK, never updated/deleted during read
Defensive patterns
Strategy: retry
Validate before calling
// before reading, verify bounds still valid
try (PreparedStatement ps = conn.prepareStatement("SELECT COUNT(*) FROM " + table + " WHERE " + col + " >= ?")) {
ps.setObject(1, lowerBound);
try (ResultSet rs = ps.executeQuery()) {
rs.next();
if (rs.getLong(1) == 0) LOG.warn("No rows at/above {} for {}:{}; chunk bounds may be stale", lowerBound, table, col);
}
} Try / catch
try {
Object max = dialect.queryNextChunkMax(conn, table, col, chunkSize, lowerBound);
} catch (SQLException e) {
if (e.getMessage() != null && e.getMessage().contains("No result returned")) {
LOG.warn("Chunk max query returned no rows (likely concurrent deletes); retrying/recomputing bounds");
return; // recompute or skip chunk
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/a840927ebf97097b.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialect.java:480
String.format(
"SELECT MAX(%s) FROM ("
+ "SELECT %s FROM %s WHERE %s >= ? ORDER BY %s ASC LIMIT %s"
+ ") AS T",
quotedColumn,
quotedColumn,
tableIdentifier(table.getTablePath()),
quotedColumn,
quotedColumn,
chunkSize);
}
try (PreparedStatement ps = connection.prepareStatement(sqlQuery)) {
ps.setObject(1, includedLowerBound);
try (ResultSet rs = ps.executeQuery()) {
if (rs.next()) {
return rs.getObject(1);
} else {
// this should never happen
throw new SQLException(
String.format("No result returned after running query [%s]", sqlQuery));
}
}
}
}
default JdbcConnectionProvider getJdbcConnectionProvider(
JdbcConnectionConfig jdbcConnectionConfig) {
return new SimpleJdbcConnectionProvider(jdbcConnectionConfig);
}
/**
* Cast column type e.g. CAST(column AS type)
*
* @param columnName
* @param columnType
* @return the text of converted column type.
*/View on GitHub (pinned to cf67b549a7)