apache/seatunnel · error · SQLException
No result returned after running query [%s]
Error message
No result returned after running query [%s]
What it means
MySqlUtils.queryMinMax executes `SELECT MIN(col), MAX(col) FROM table` and throws this SQLException if the ResultSet has no rows. Normally MIN/MAX over a table always returns one row, so the comment says 'this should never happen'; it is an internal-invariant guard distinguishing an empty/invalid result from a real query error.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/utils/MySqlUtils.java:66
/** Utils to prepare MySQL SQL statement. */
@Slf4j
public class MySqlUtils {
private MySqlUtils() {}
public static Object[] queryMinMax(JdbcConnection jdbc, TableId tableId, String columnName)
throws SQLException {
final String minMaxQuery =
String.format(
"SELECT MIN(%s), MAX(%s) FROM %s",
quote(columnName), quote(columnName), quote(tableId));
return jdbc.queryAndMap(
minMaxQuery,
rs -> {
if (!rs.next()) {
// this should never happen
throw new SQLException(
String.format(
"No result returned after running query [%s]",
minMaxQuery));
}
return rowToArray(rs, 2);
});
}
public static long queryApproximateRowCnt(JdbcConnection jdbc, TableId tableId)
throws SQLException {
// The statement used to get approximate row count which is less
// accurate than COUNT(*), but is more efficient for large table.
final String useDatabaseStatement = String.format("USE %s;", quote(tableId.catalog()));
final String rowCountQuery = String.format("SHOW TABLE STATUS LIKE '%s';", tableId.table());
// Otherwise will case this error: Cannot execute without committing because auto-commit is
// enabled
jdbc.execute(useDatabaseStatement);
return jdbc.queryAndMap(View on GitHub (pinned to cf67b549a7)
Solutions
- Re-run the job; transient anomalies usually resolve on retry
- Verify the table still exists and is non-degenerate when planning starts (SELECT COUNT(*) works)
- Check for intermediate proxies/load balancers that can swallow result sets
- If reproducible, capture the minMaxQuery SQL from the message and run it manually in MySQL to diagnose
Example fix
// before
Object[] minMax = MySqlUtils.queryMinMax(jdbc, tableId, columnName);
// after
if (MySqlUtils.isTableMissing(jdbc, tableId)) { skipTable(tableId); }
Object[] minMax = MySqlUtils.queryMinMax(jdbc, tableId, columnName); Defensive patterns
Strategy: retry
Validate before calling
// ensure table exists and is queryable before split planning
try (ResultSet rs = st.executeQuery("SELECT MIN(c), MAX(c) FROM `t`")) {
if (!rs.next()) throw new IllegalStateException("empty min/max result");
} Try / catch
try {
Object[] minMax = MySqlUtils.queryMinMax(jdbc, tableId, col);
} catch (SQLException e) {
// retry with backoff; abort table if DROP TABLE detected
} Prevention
- Don't drop/alter tables during snapshot planning
- Retry transient JDBC failures with backoff
- Avoid proxies that can drop result sets
- Run the failing query manually when it recurs
When it happens
Trigger: Calling queryMinMax on a table whose split column yields no row from the aggregate query — practically only when the table disappeared mid-chunk-planning, the query returned zero rows due to a server anomaly, or the JDBC driver misbehaved.
Common situations: Table dropped/truncated between split enumeration and MIN/MAX planning; MySQL proxy returning empty result sets; corrupt metadata after a failed DDL.
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
- Error reading MySQL variables:
- Unexpected error while connecting to MySQL and looking at GT
- Unexpected error while connecting to MySQL and looking at pr
- Unexpected error while connecting to MySQL and looking for b
- Unexpected error while connecting to MySQL and looking at BI
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/c92f4686aa9b2e7d.
Report an issue: GitHub.