apache/seatunnel · error · SQLException

No result returned after running query

Error message

No result returned after running query [${sqlQuery}]

What it means

Thrown by XuguDialect.queryNextChunkMax when the query for the next chunk's maximum split-key value returns an empty ResultSet. The splitter assumes every bounded query returns exactly one row; an empty result breaks chunk computation.

Solutions

  1. Use a NOT NULL, monotonic split key column
  2. Re-run the job to recompute splits on a stable table
  3. Check for concurrent writes/deletes during split enumeration
  4. Verify the split key column actually contains data for the queried range
Defensive patterns

Strategy: validation

Validate before calling

SELECT MAX(SplitKey) FROM XuTable WHERE SplitKey > ?; -- must return one row

Try / catch

try {
    readSplits();
} catch (SQLException e) {
    if (e.getMessage().startsWith("No result returned")) { /* re-split */ }
}

Prevention

When it happens

Trigger: Calling queryNextChunkMax during split enumeration when no rows satisfy the key-range predicate — split key contains NULLs, table data changed concurrently, or bounds no longer match the data.

Common situations: Concurrent truncation/deletion while splitting; non-NOT NULL split key; choosing an unsuitable split column (sparse values).

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/ba03c84eb0ef2e14. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/xugu/XuguDialect.java:216

            sqlQuery =
                    String.format(
                            "SELECT MAX(%s) FROM ("
                                    + "SELECT %s FROM %s WHERE %s >= ? ORDER BY %s ASC "
                                    + ") WHERE ROWNUM <= %s",
                            quotedColumn,
                            quotedColumn,
                            table.getTablePath().getSchemaAndTableName(),
                            quotedColumn,
                            quotedColumn,
                            chunkSize);
        }

        try (PreparedStatement ps = connection.prepareStatement(sqlQuery)) {
            ps.setObject(1, includedLowerBound);
            try (ResultSet rs = ps.executeQuery()) {
                if (!rs.next()) {
                    // this should never happen
                    throw new SQLException(
                            String.format("No result returned after running query [%s]", sqlQuery));
                }
                return rs.getObject(1);
            }
        }
    }

    @Override
    public ResultSetMetaData getResultSetMetaData(Connection conn, String query)
            throws SQLException {
        try (PreparedStatement ps = conn.prepareStatement(query);
                ResultSet resultSet = ps.executeQuery()) {
            return resultSet.getMetaData();
        }
    }
}

View on GitHub (pinned to cf67b549a7)