apache/seatunnel · error · SQLException

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

Error message

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

What it means

OceanBaseMysqlDialect.approximateRowCntStatement runs the OceanBase MySQL-mode approximate row-count query (expecting at least 5 result columns) to estimate table size for chunk splitting. If the ResultSet is empty or its metadata shows fewer than 5 columns, it throws this SQLException since no row count can be read from column 5.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oceanbase/OceanBaseMysqlDialect.java:228

                                        .getFullName()
                                        .equals(table.getTablePath().getFullName()));

        if (useTableStats) {
            // The statement used to get approximate row count which is less
            // accurate than COUNT(*), but is more efficient for large table.
            TablePath tablePath = table.getTablePath();
            String useDatabaseStatement =
                    String.format("USE %s;", quoteDatabaseIdentifier(tablePath.getDatabaseName()));
            String rowCountQuery =
                    String.format("SHOW TABLE STATUS LIKE '%s';", tablePath.getTableName());

            try (Statement stmt = connection.createStatement()) {
                log.info("Split Chunk, approximateRowCntStatement: {}", useDatabaseStatement);
                stmt.execute(useDatabaseStatement);
                log.info("Split Chunk, approximateRowCntStatement: {}", rowCountQuery);
                try (ResultSet rs = stmt.executeQuery(rowCountQuery)) {
                    if (!rs.next() || rs.getMetaData().getColumnCount() < 5) {
                        throw new SQLException(
                                String.format(
                                        "No result returned after running query [%s]",
                                        rowCountQuery));
                    }
                    return rs.getLong(5);
                }
            }
        }

        return SQLUtils.countForSubquery(connection, table.getQuery());
    }

    @Override
    public boolean supportDefaultValue(BasicTypeDefine typeBasicTypeDefine) {
        OceanBaseMysqlType nativeType = (OceanBaseMysqlType) typeBasicTypeDefine.getNativeType();
        return !(NOT_SUPPORTED_DEFAULT_VALUES.contains(nativeType));
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Confirm the OceanBase tenant runs MySQL compatibility mode and the version supports the expected count query shape.
  2. Ensure the connection user can read the target table's statistics.
  3. Run the logged rowCountQuery manually against the database to see why it returns no/short result.
  4. Upgrade SeaTunnel connector or OceanBase server so query/result shapes match.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check: run the approximate row-count query manually
try (ResultSet rs = stmt.executeQuery(rowCountQuery)) {
    if (!rs.next() || rs.getMetaData().getColumnCount() < 5)
        throw new IllegalStateException("OceanBase does not return expected row-count result shape");
}

Try / catch

catch (SQLException e) { if (e.getMessage().contains("No result returned")) { /* fall back to exact COUNT(*) split sizing */ } }

Prevention

When it happens

Trigger: The rowCountQuery executed via stmt.executeQuery returns no row or fewer than 5 columns — e.g. the OceanBase version does not produce the expected EXPLAIN/information_schema result shape for the given table.

Common situations: Older or Oracle-mode OceanBase tenants reached with the MySQL dialect; insufficient privileges to read stats for the table; querying a view/external table where the estimate query returns nothing.

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