apache/seatunnel · error · SQLException

No result returned after running query

Error message

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

What it means

Thrown by YashanDbDialect.approximateRowCntStatement when the approximate row-count query returns no rows. The chunk splitter requires a row count to size splits, so an empty result is surfaced as a SQLException.

Solutions

  1. Verify the table path/schema is correct and the table exists
  2. Grant the connector user privileges to read table statistics/catalog views
  3. Run the row-count query manually on YashanDB to reproduce
  4. Ensure the analyze step succeeded — check the earlier 'Skip analyze' WARN logs
Defensive patterns

Strategy: validation

Validate before calling

-- Run the same count query the dialect uses before splitting
SELECT COUNT(*) FROM yashan_user.your_table;

Try / catch

try {
    source.open();
} catch (SQLException e) {
    if (e.getMessage().startsWith("No result returned after running query")) {
        // check table existence and privileges
    }
}

Prevention

When it happens

Trigger: Splitting a YashanDB table when the statistics/count query matches no rows — table does not exist, user lacks catalog privileges, or analyze/statistics step failed and the count query sees nothing.

Common situations: Connecting with a low-privilege user that cannot see the table's statistics; wrong schema/table path; very newly created tables without visible stats.

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/28d4266b56420bca. 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:238

            String rowCountQuery =
                    String.format(
                            "select NUM_ROWS from all_tables where OWNER = '%s' AND TABLE_NAME = '%s' ",
                            tablePath.getSchemaName(), tablePath.getTableName());
            try (Statement stmt = connection.createStatement()) {
                String analyzeTable =
                        String.format(
                                "analyze table %s compute statistics for table",
                                tableIdentifier(tablePath));
                if (!table.getSkipAnalyze()) {
                    log.info("Split Chunk, approximateRowCntStatement: {}", analyzeTable);
                    stmt.execute(analyzeTable);
                } else {
                    log.warn("Skip analyze, approximateRowCntStatement: {}", analyzeTable);
                }
                log.info("Split Chunk, approximateRowCntStatement: {}", rowCountQuery);
                try (ResultSet rs = stmt.executeQuery(rowCountQuery)) {
                    if (!rs.next()) {
                        throw new SQLException(
                                String.format(
                                        "No result returned after running query [%s]",
                                        rowCountQuery));
                    }
                    return rs.getLong(1);
                }
            }
        }
        return SQLUtils.countForSubquery(connection, query);
    }

    @Override
    public Object queryNextChunkMax(
            Connection connection,
            JdbcSourceTable table,
            String columnName,
            int chunkSize,
            Object includedLowerBound)

View on GitHub (pinned to cf67b549a7)