apache/seatunnel · error · CatalogException

Failed executeSql error %s

Error message

Failed executeSql error %s

What it means

DorisCatalog.isExistsData runs a `select * from <table> limit 1` to probe table existence and wraps any SQLException in a CatalogException whose message embeds the SQL that failed. It signals that the JDBC connection could not execute the probe query against Doris (bad SQL, missing table/privileges, or connection issues).

Source

Thrown at seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/catalog/DorisCatalog.java:504

                    statement.execute(
                            DorisCatalogUtil.getTruncateTableQuery(tablePath, partitions));
                }
            }
        } catch (Exception e) {
            throw new CatalogException(
                    String.format("Failed TRUNCATE TABLE in catalog %s", tablePath.getFullName()),
                    e);
        }
    }

    public boolean isExistsData(TablePath tablePath) {
        String tableName = tablePath.getFullName();
        String sql = String.format("select * from %s limit 1;", tableName);
        try (PreparedStatement ps = conn.prepareStatement(sql);
                ResultSet resultSet = ps.executeQuery()) {
            return resultSet.next();
        } catch (SQLException e) {
            throw new CatalogException(String.format("Failed executeSql error %s", sql), e);
        }
    }

    @Override
    public void executeSql(TablePath tablePath, String sql) {
        try (PreparedStatement ps = conn.prepareStatement(sql)) {
            ps.execute();
        } catch (SQLException e) {
            throw new CatalogException(String.format("Failed executeSql error %s", sql), e);
        }
    }

    @Override
    public PreviewResult previewAction(
            ActionType actionType, TablePath tablePath, Optional<CatalogTable> catalogTable) {
        if (actionType == ActionType.CREATE_TABLE) {
            checkArgument(catalogTable.isPresent(), "CatalogTable cannot be null");
            return new SQLPreviewResult(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the table exists and its full name (`db.table`) is correct via `SHOW TABLES` in Doris
  2. Quote identifier parts correctly or ensure TablePath contains valid database and table names
  3. Check the catalog user has SELECT privilege on the table
  4. Test connectivity to the Doris FE query port and restart the job if the connection was stale

Example fix

// before
String sql = String.format("select * from %s limit 1;", tableName);
// after
String sql = String.format("select * from %s limit 1;", tablePath.getDatabaseName() + ".`" + tablePath.getTableName() + "`");
Defensive patterns

Strategy: try-catch

Validate before calling

// verify table existence via catalog API first
if (!catalog.databaseExists(tablePath.getDatabaseName()) || !catalog.tableExists(tablePath)) {
    throw new IllegalStateException("Table missing before isExistsData: " + tablePath.getFullName());
}

Type guard

// ensure TablePath parts are non-blank before querying
boolean validPath(TablePath p) {
    return p.getDatabaseName() != null && !p.getDatabaseName().isBlank()
        && p.getTableName() != null && !p.getTableName().isBlank();
}

Try / catch

try {
    boolean exists = catalog.isExistsData(tablePath, conn);
} catch (CatalogException e) {
    Throwable cause = e.getCause();
    if (cause instanceof SQLException && "42S02".equals(((SQLException) cause).getSQLState())) {
        // table does not exist
    } else {
        throw e; // connectivity/privilege problem
    }
}

Prevention

When it happens

Trigger: Calling catalog.isExistsData(tablePath, conn) when the table name is malformed or quoted improperly, the table/database does not exist or is inaccessible, or the JDBC connection is broken/stale, causing SQLException on prepareStatement/executeQuery.

Common situations: Probing a table whose name contains characters needing quoting; catalog operations against a dropped or renamed Doris table; network/timeout between SeaTunnel and Doris FE node; insufficient SELECT privileges for the configured user.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/e34453b2c26d66a3. Report an issue: GitHub.