apache/iceberg · error · UncheckedSQLException
Database data truncation error
Error message
Database data truncation error
What it means
Thrown by JdbcViewOperations.doCommit when a java.sql.DataTruncation occurs — a value being written (typically the metadata location string or catalog row columns) exceeded the column size in the database. Wrapped in UncheckedSQLException. The commit did not succeed.
Solutions
- Widen the offending catalog table columns (e.g. increase VARCHAR length for metadata location) and retry
- Shorten the warehouse path or identifiers so metadata locations fit existing column limits
- Recreate the catalog tables using the current recommended Iceberg JDBC schema
- Inspect the DataTruncation cause to identify which column/parameter was truncated
Example fix
// before CREATE TABLE iceberg_views (... metadata_location VARCHAR(255) ...); // after ALTER TABLE iceberg_views ALTER COLUMN metadata_location TYPE VARCHAR(2048);
Defensive patterns
Strategy: validation
Validate before calling
// Ensure metadata location fits catalog column limits
String loc = metadataFileLocation();
Preconditions.checkArgument(loc.length() <= 2048,
"Metadata location too long for catalog columns: %s", loc.length()); Try / catch
try {
view.updateSchema(apply);
} catch (UncheckedSQLException e) {
if (e.getCause() instanceof DataTruncation) {
// widen columns or shorten paths, then retry
} else throw e;
} Prevention
- Create catalog tables with generous column sizes for locations
- Keep warehouse paths and identifiers reasonably short
- Use the current Iceberg JDBC schema scripts when initializing
When it happens
Trigger: Committing a view whose metadata file location or other row values exceed the length of iceberg_views columns; often after deeply nested warehouse paths or very long identifiers.
Common situations: JDBC catalog initialized with a schema that has short VARCHAR columns (or older schema versions), extremely long S3/GCS paths or namespace/table names pushing locations past column limits.
Related errors
- Cannot check and eventually update SQL schema
- Cannot initialize JDBC catalog
- Cannot initialize JDBC catalog: Connection failed
- Cannot initialize JDBC catalog: Query timed out
- Cannot initialize JDBC table maintenance lock
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/94bdaeb9d78da214.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java:119
JdbcUtil.loadView(JdbcUtil.SchemaVersion.V1, connections, catalogName, viewIdentifier);
if (base != null) {
validateMetadataLocation(view, base);
String oldMetadataLocation = base.metadataFileLocation();
// Start atomic update
LOG.debug("Committing existing view: {}", viewName());
updateView(newMetadataLocation, oldMetadataLocation);
} else {
// view does not exist, create it
LOG.debug("Committing new view: {}", viewName());
createView(newMetadataLocation);
}
} catch (SQLTimeoutException e) {
throw new UncheckedSQLException(e, "Database Connection timeout");
} catch (SQLTransientConnectionException | SQLNonTransientConnectionException e) {
throw new UncheckedSQLException(e, "Database Connection failed");
} catch (DataTruncation e) {
throw new UncheckedSQLException(e, "Database data truncation error");
} catch (SQLWarning e) {
throw new UncheckedSQLException(e, "Database warning");
} catch (SQLException e) {
if (JdbcUtil.isConstraintViolation(e)) {
if (currentMetadataLocation() == null) {
throw new AlreadyExistsException(e, "View already exists: %s", viewIdentifier);
} else {
throw new UncheckedSQLException(e, "View already exists: %s", viewIdentifier);
}
}
throw new UncheckedSQLException(e, "Unknown failure");
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new UncheckedInterruptedException(e, "Interrupted during commit");
}
}
View on GitHub (pinned to 86d9c8fc54)