apache/seatunnel · error · SQLException

No result returned after running query [%s]

Error message

No result returned after running query [%s]

What it means

Thrown by OracleUtils.queryMinMax when the MIN/MAX query over a split column returns an empty ResultSet. The code treats this as an invariant violation ('this should never happen') because snapshotting only runs on tables expected to contain at least one row for the split key.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleUtils.java:76

@Slf4j
public class OracleUtils {

    private static final int DEFAULT_FETCH_SIZE = 1024;

    private OracleUtils() {}

    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), quoteSchemaAndTable(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 SourceRecordUtils.rowToArray(rs, 2);
                });
    }

    public static long queryApproximateRowCnt(
            OracleSourceConfig oracleSourceConfig, JdbcConnection jdbc, TableId tableId)
            throws SQLException {
        Boolean useSelectCount = oracleSourceConfig.getUseSelectCount();
        String rowCountQuery;
        if (useSelectCount) {
            rowCountQuery = String.format("select count(*) from %s", quoteSchemaAndTable(tableId));
        } else {
            rowCountQuery =
                    String.format(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Ensure the table has at least one row before starting incremental snapshot, or skip empty tables in tableList.
  2. Check for concurrent truncation/delete jobs interfering with snapshot startup.
  3. Verify the split key column name resolves to a real populated column.
  4. If empty tables are expected, upgrade connector version or handle empty tables before enabling incremental snapshot.

Example fix

// before
-- table ORDERS is empty, snapshot fails
DELETE FROM staging; -- concurrent truncate during startup
// after
INSERT seed rows or exclude the empty table from tableList until it has data
Defensive patterns

Strategy: validation

Validate before calling

-- ensure the split table has rows before snapshot
SELECT COUNT(*) FROM scott.orders;

Try / catch

try {
    Object[] minMax = OracleUtils.queryMinMax(jdbc, tableId, columnName);
} catch (SQLException e) {
    LOG.error("empty MIN/MAX result for {}.{}, table may be empty", tableId, columnName, e);
}

Prevention

When it happens

Trigger: The split-key MIN/MAX SELECT ran but returned zero rows — the table (or filtered subset) is empty, or the rows were deleted between chunk planning and this query.

Common situations: Incremental snapshot configured on an empty table; table truncated concurrently during snapshot startup; overly restrictive filter leaving no rows; wrong split key column causing no matching rows.

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