apache/seatunnel · error · RuntimeException
Failed to build the split data read statement.
Error message
Failed to build the split data read statement.
What it means
Thrown by OracleUtils.readTableSplitDataStatement when building the JDBC PreparedStatement for reading a split's data fails with any Exception. The original exception is chained, so the cause holds the concrete problem (bad SQL, invalid parameters, connection issues).
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleUtils.java:343
if (isFirstSplit) {
for (int i = 0; i < primaryKeyNum; i++) {
statement.setObject(i + 1, splitEnd[i]);
statement.setObject(i + 1 + primaryKeyNum, splitEnd[i]);
}
} else if (isLastSplit) {
for (int i = 0; i < primaryKeyNum; i++) {
statement.setObject(i + 1, splitStart[i]);
}
} else {
for (int i = 0; i < primaryKeyNum; i++) {
statement.setObject(i + 1, splitStart[i]);
statement.setObject(i + 1 + primaryKeyNum, splitEnd[i]);
statement.setObject(i + 1 + 2 * primaryKeyNum, splitEnd[i]);
}
}
return statement;
} catch (Exception e) {
throw new RuntimeException("Failed to build the split data read statement.", e);
}
}
public static SeaTunnelRowType getSplitType(Table table) {
List<Column> primaryKeys = table.primaryKeyColumns();
if (primaryKeys.isEmpty()) {
throw new SeaTunnelException(
String.format(
"Incremental snapshot for tables requires primary key,"
+ " but table %s doesn't have primary key.",
table.id()));
}
// use first field in primary key as the split key
return getSplitType(primaryKeys.get(0));
}
/** Creates a new {@link OracleDatabaseSchema} to monitor the latest oracle database schemas. */View on GitHub (pinned to cf67b549a7)
Solutions
- Read the chained cause exception to get the exact Oracle/JDBC error.
- Check the split key types via getSplitType; switch to a simpler PK column if types are exotic.
- Verify the Oracle JDBC driver version matches your Oracle server.
- Check connection health (URL, wallet, firewall) if the cause is a connection error.
Example fix
// before split.key = "RAW_GUID_COL" // unsupported bind type in chunk SQL // after split.key = "ORDER_ID" // numeric primary key
Defensive patterns
Strategy: try-catch
Validate before calling
-- sanity-check the split column type before snapshot SELECT data_type FROM all_tab_columns WHERE owner='SCOTT' AND table_name='ORDERS' AND column_name='ORDER_ID';
Try / catch
try {
PreparedStatement st = OracleUtils.readTableSplitDataStatement(jdbc, ...);
} catch (RuntimeException e) {
LOG.error("split statement build failed: {}", e.getCause(), e);
throw e;
} Prevention
- Inspect the chained cause for the real JDBC/ORA error
- Use standard PK types (NUMBER, VARCHAR2, DATE/TIMESTAMP) as split keys
- Keep Oracle JDBC driver version aligned with the server
- Validate connection settings before large snapshots
When it happens
Trigger: Constructing the split read statement failed — malformed generated SQL for the chunk range, invalid bind parameter types in splitStart/splitEnd arrays, driver rejecting the statement, or a closed/broken connection during prepareStatement.
Common situations: Unsupported split-column types producing invalid SQL literals/binds; primary key columns with exotic Oracle types; JDBC URL/driver version mismatch; connection dropped while preparing the statement.
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 to read schema for table %s
- No result returned after running query [%s]
- Failed to discover captured tables for enumerator
- Failed to discover remaining tables to capture
- Exactly once is enabled, but not found primary key or unique
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/96de2968549cbd11.
Report an issue: GitHub.