apache/seatunnel · error · SeaTunnelException
Failed to querySQLResult
Error message
Failed to querySQLResult
What it means
IrisCatalog.tableExists wraps any SQLException from executing the table-existence query into a generic SeaTunnelException("Failed to querySQLResult"). The actual SQL error (bad URL, syntax error, connection failure) is the chained cause, so this message alone is uninformative.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/iris/IrisCatalog.java:149
@Override
protected String getOptionTableName(TablePath tablePath) {
return tablePath.getSchemaAndTableName();
}
@Override
public boolean databaseExists(String databaseName) throws CatalogException {
throw new SeaTunnelException("Not supported for list databases for iris");
}
@Override
public boolean tableExists(TablePath tablePath) throws CatalogException {
try {
return querySQLResultExists(
this.getUrlFromDatabaseName(tablePath.getDatabaseName()),
getTableWithConditionSql(tablePath));
} catch (SQLException e) {
throw new SeaTunnelException("Failed to querySQLResult", e);
}
}
@Override
protected String getTableWithConditionSql(TablePath tablePath) {
return String.format(
getListTableSql(tablePath.getSchemaName()) + " and TABLE_NAME = '%s'",
tablePath.getTableName());
}
@Override
protected String getUrlFromDatabaseName(String databaseName) {
return defaultUrl;
}
@Override
public List<String> listTables(String schemaName)
throws CatalogException, DatabaseNotExistException {View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect the chained cause for the real SQLException
- Test connectivity to the IRIS instance with a standalone JDBC client using the same URL/credentials
- Verify the database name used in TablePath maps to a valid IRIS namespace/URL via getUrlFromDatabaseName
- Log/print the SQL produced by getTableWithConditionSql and run it manually in the IRIS terminal
- Add retry logic for transient network failures before re-running
Example fix
// before
boolean exists = catalog.tableExists(tablePath); // opaque SeaTunnelException
// after
try {
boolean exists = catalog.tableExists(tablePath);
} catch (SeaTunnelException e) {
LOG.error("tableExists failed: {}", e.getCause(), e);
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// verify connectivity first
try (Connection c = DriverManager.getConnection(jdbcUrl, user, pass)) {
if (!c.isValid(5)) throw new IllegalStateException("IRIS connection invalid");
} Try / catch
try {
boolean exists = catalog.tableExists(tablePath);
} catch (SeaTunnelException e) {
LOG.error("IRIS tableExists failed for {}: {}", tablePath, e.getCause(), e);
throw e;
} Prevention
- Always inspect getCause() — the message is generic by design
- Pre-validate IRIS connectivity before catalog operations
- Keep database names in TablePath consistent with IRIS namespace naming
- Test the generated existence SQL per IRIS version
When it happens
Trigger: Calling tableExists (directly or via getTable/createTable, which pre-check existence) when querySQLResultExists throws SQLException: connection to the IRIS database fails, the existence-check SQL is invalid for the target IRIS version, or the database URL derived from the database name is wrong.
Common situations: IRIS instance down or unreachable; wrong credentials in catalog config; IRIS SQL dialect differences making the generated condition SQL fail; database name mapping to an invalid JDBC URL.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- Failed listing database in catalog %s
- Failed executeSql error %s
- Failed dropping table %s
- Failed creating database %s in catalog %s
- Failed dropping database %s in catalog %s
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/1e87e6708b9d5bf7.
Report an issue: GitHub.