{"record":{"id":"840c920f0a9aad3f","repo":"apache/seatunnel","slug":"no-result-returned-after-running-query-rowcount-840c92","errorCode":null,"errorMessage":"No result returned after running query [${rowCountQuery}]","messagePattern":"No result returned after running query \\[(.+?)\\]","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oceanbase/OceanBaseMysqlDialect.java","lineNumber":228,"sourceCode":"                                        .getFullName()\n                                        .equals(table.getTablePath().getFullName()));\n\n        if (useTableStats) {\n            // The statement used to get approximate row count which is less\n            // accurate than COUNT(*), but is more efficient for large table.\n            TablePath tablePath = table.getTablePath();\n            String useDatabaseStatement =\n                    String.format(\"USE %s;\", quoteDatabaseIdentifier(tablePath.getDatabaseName()));\n            String rowCountQuery =\n                    String.format(\"SHOW TABLE STATUS LIKE '%s';\", tablePath.getTableName());\n\n            try (Statement stmt = connection.createStatement()) {\n                log.info(\"Split Chunk, approximateRowCntStatement: {}\", useDatabaseStatement);\n                stmt.execute(useDatabaseStatement);\n                log.info(\"Split Chunk, approximateRowCntStatement: {}\", rowCountQuery);\n                try (ResultSet rs = stmt.executeQuery(rowCountQuery)) {\n                    if (!rs.next() || rs.getMetaData().getColumnCount() < 5) {\n                        throw new SQLException(\n                                String.format(\n                                        \"No result returned after running query [%s]\",\n                                        rowCountQuery));\n                    }\n                    return rs.getLong(5);\n                }\n            }\n        }\n\n        return SQLUtils.countForSubquery(connection, table.getQuery());\n    }\n\n    @Override\n    public boolean supportDefaultValue(BasicTypeDefine typeBasicTypeDefine) {\n        OceanBaseMysqlType nativeType = (OceanBaseMysqlType) typeBasicTypeDefine.getNativeType();\n        return !(NOT_SUPPORTED_DEFAULT_VALUES.contains(nativeType));\n    }\n","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oceanbase/OceanBaseMysqlDialect.java#L210-L246","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the OceanBase tenant runs MySQL compatibility mode and the version supports the expected count query shape.","Ensure the connection user can read the target table's statistics.","Run the logged rowCountQuery manually against the database to see why it returns no/short result.","Upgrade SeaTunnel connector or OceanBase server so query/result shapes match."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-check: run the approximate row-count query manually\ntry (ResultSet rs = stmt.executeQuery(rowCountQuery)) {\n    if (!rs.next() || rs.getMetaData().getColumnCount() < 5)\n        throw new IllegalStateException(\"OceanBase does not return expected row-count result shape\");\n}","typeGuard":null,"tryCatchPattern":"catch (SQLException e) { if (e.getMessage().contains(\"No result returned\")) { /* fall back to exact COUNT(*) split sizing */ } }","preventionTips":["Confirm OceanBase MySQL compatibility mode and version before chunked reads","Verify privileges for reading table statistics","Run the logged rowCountQuery manually to validate server support"],"tags":["jdbc","oceanbase","sql","chunk-splitting"],"backgroundTag":"empty-result-set","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}