apache/seatunnel · error · SQLException

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

Error message

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

What it means

OracleDialect.queryNextChunkMax executes a query with the chunk's lower bound to fetch the next max value used for split ranges. An empty ResultSet throws this SQLException with the comment 'this should never happen', meaning the split-range invariant (at least one row at/after the lower bound) was violated.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleDialect.java:324

            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)

Solutions

  1. Re-run the job — a transient concurrent modification usually resolves on retry.
  2. Avoid truncating/heavily deleting data while the job computes splits.
  3. Refresh Oracle table statistics (DBMS_STATS) so split bounds match real data.
  4. Check the logged sqlQuery and bound values against the table to find why no row satisfies the predicate.
Defensive patterns

Strategy: retry

Try / catch

catch (SQLException e) { if (e.getMessage().contains("No result returned")) { /* re-enumerate splits and retry once; else fail job with concurrent-modification context */ } }

Prevention

When it happens

Trigger: The prepared sqlQuery with bound includedLowerBound returns no rows — the data the split enumerator expected was deleted/changed (e.g. table truncated or rows removed) between split enumeration and chunk-max querying, or the lower bound is inconsistent with the data.

Common situations: Concurrent DELETE/TRUNCATE on the Oracle table during split computation; table statistics badly stale so the enumerator assumed rows that don't exist; partition pruning mismatch.

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