apache/seatunnel · error · SQLException
No result returned after running query
Error message
No result returned after running query [${sqlQuery}] What it means
Thrown by SqlServerDialect.queryNextChunkMax when the chunk-max query (SELECT MAX(col) ... WHERE col > ? ... or similar) returns no rows, which the code comments say should never happen. It guards the chunk-splitting invariant that every chunk boundary query yields one row.
Solutions
- Re-run the job so split enumeration sees a consistent table snapshot
- Choose a stable, NOT NULL, monotonic split key column
- Reduce chunk size or use a smaller table scan so bounds align with actual data
- Check for concurrent ETL jobs modifying the table during splitting
Defensive patterns
Strategy: validation
Validate before calling
SELECT COUNT(*) FROM MyTable WHERE MySplitKey > ? AND MySplitKey <= ?; -- must be > 0
Try / catch
try {
readSplits();
} catch (SQLException e) {
if (e.getMessage().contains("No result returned after running query")) {
// re-enumerate splits on a stable snapshot
}
} Prevention
- Choose a NOT NULL monotonic split key
- Avoid concurrent truncation/deletion during split computation
- Keep chunk bounds aligned with real data ranges
When it happens
Trigger: Calling queryNextChunkMax with an includedLowerBound that produces zero matching rows, typically when the split key column has NULLs, the table was truncated/changed between split enumeration and query execution, or the chunk SQL is malformed for the data.
Common situations: Concurrent deletes/truncation during split computation; split key column containing NULL values excluded by comparison; incorrect split key chosen (non-monotonic column).
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
- No result returned after running query
- No result returned after running query
- No result returned after running query
- No result returned after running query
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/929ef971fa029cd3.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerDialect.java:274
String.format(
"SELECT MAX(%s) FROM ("
+ "SELECT TOP (%s) %s FROM %s WHERE %s >= ? ORDER BY %s ASC "
+ ") AS T",
quotedColumn,
chunkSize,
quotedColumn,
tableIdentifier(table.getTablePath()),
quotedColumn,
quotedColumn);
}
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));
}
}
}
}
@Override
public TypeConverter<BasicTypeDefine> getTypeConverter() {
return SqlServerTypeConverter.INSTANCE;
}
@Override
public void applySchemaChange(
Connection connection, TablePath tablePath, AlterTableAddColumnEvent event)
throws SQLException {
List<String> ddlSQL = new ArrayList<>();
Column column = event.getColumn();
String sourceDialectName = event.getSourceDialectName();View on GitHub (pinned to cf67b549a7)