apache/seatunnel · error · SQLException
No result returned after running query [${query}]
Error message
No result returned after running query [${query}] What it means
Db2Utils.queryNextChunkMax reads the maximum split-column value of the next chunk (rows >= includedLowerBound LIMIT chunkSize). It throws this SQLException if the ResultSet is empty — an internal invariant, since the caller should only query chunks that contain at least one remaining row.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/utils/Db2Utils.java:231
String query =
String.format(
"SELECT MAX(%s) FROM ("
+ "SELECT %s FROM %s WHERE %s >= ? ORDER BY %s ASC "
+ "FETCH FIRST %s ROWS ONLY"
+ ") AS T",
quotedColumn,
quotedColumn,
quote(tableId),
quotedColumn,
quotedColumn,
chunkSize);
return jdbc.prepareQueryAndMap(
query,
ps -> ps.setObject(1, includedLowerBound),
rs -> {
if (!rs.next()) {
// this should never happen
throw new SQLException(
String.format(
"No result returned after running query [%s]", query));
}
return rs.getObject(1);
});
}
public static SeaTunnelRowType getSplitType(Table table) {
List<Column> primaryKeys = table.primaryKeyColumns();
if (primaryKeys.isEmpty()) {
throw new SeaTunnelException(
String.format(
"Incremental snapshot for tables requires primary key,"
+ " but table %s doesn't have primary key.",
table.id()));
}
// use first field in primary key as the split keyView on GitHub (pinned to cf67b549a7)
Solutions
- Restart the snapshot job so chunk state is rebuilt from current data
- Avoid bulk deletes/truncates while a snapshot is in progress
- Report a bug if reproducible without concurrent writes
- Enable lower retry/backoff for transient conflicts
Defensive patterns
Strategy: retry
Try / catch
try { Object max = Db2Utils.queryNextChunkMax(jdbc, query, includedLowerBound); } catch (SQLException e) { if (e.getMessage().contains("No result returned")) { /* rebuild split state / restart snapshot */ } throw e; } Prevention
- Schedule truncations/bulk deletes outside snapshot windows
- Re-run snapshot job to rebuild chunk state after data mutation
- Report a reproducible case as a bug if no concurrent writes
When it happens
Trigger: queryNextChunkMax called with an includedLowerBound that matches no rows — typically rows deleted concurrently after the previous chunk was read, or the table being truncated mid-snapshot.
Common situations: Concurrent DELETE/truncate on the table during incremental snapshot; split planning raced with data mutation; incorrect retry after partial chunk read.
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
- No result returned after running query [${minQuery}]
- No result returned after running query [${rowCountQuery}]
- Exactly once is enabled, but not found primary key or unique
- Failed to split chunks for table " + tableId
- Generate Splits for table %s error
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/466ccc1bd486db4d.
Report an issue: GitHub.