apache/seatunnel · error · SQLException

No result returned after running query

Error message

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

What it means

Thrown by YashanDbDialect.queryNextChunkMax when the prepared statement for the next-chunk MAX query executes but returns no result set row, leaving the chunk boundary undeterminable for the ROWNUM-based pagination query.

Solutions

  1. Use a NOT NULL, monotonic split key
  2. Re-run so splits are computed against consistent data
  3. Avoid concurrent DML/DLL on the table during splitting
  4. Reduce chunk size so bounds track real data
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: Calling queryNextChunkMax when the key-range predicate matches zero rows: NULL split-key values, concurrent data changes, or an unsuitable split key column.

Common situations: Table truncated mid-split; sparse or non-monotonic split key chosen; NULLs in the split 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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/49f3c51d541a45df. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/yashandb/YashanDbDialect.java:291

            sqlQuery =
                    String.format(
                            "SELECT MAX(%s) FROM ("
                                    + "SELECT %s FROM %s WHERE %s >= ? ORDER BY %s ASC "
                                    + ") WHERE ROWNUM <= %s",
                            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()) {
                    // this should never happen
                    throw new SQLException(
                            String.format("No result returned after running query [%s]", sqlQuery));
                }
                return rs.getObject(1);
            }
        }
    }

    @Override
    public Object[] sampleDataFromColumn(
            Connection connection,
            JdbcSourceTable table,
            String columnName,
            int samplingRate,
            int fetchSize)
            throws Exception {
        String sampleQuery;
        if (StringUtils.isNotBlank(table.getQuery())) {
            sampleQuery =

View on GitHub (pinned to cf67b549a7)