apache/seatunnel · error · FileConnectorException
COMMON_UNSUPPORTED_DATA_TYPE
COMMON_UNSUPPORTED_DATA_TYPE
Error message
Time series type expected for field
What it means
ExcelGenerator.setCellValue's timestamp/time handling branch only accepts Temporal time types (LocalDateTime, Date, LocalTime, etc.); when a cell value for a time-formatted column is none of them it throws FileConnectorException with UNSUPPORTED_DATA_TYPE: 'Time series type expected for field'. Raised in setTimestampColumn when writing a column whose declared format is a time format but whose runtime value is not a time type.
Solutions
- Cast/convert the field to LocalDateTime/LocalTime in an upstream transform (e.g. SQL transform TO_TIMESTAMP / CAST).
- Fix the source so the column has a TIMESTAMP/TIME SeaTunnel type.
- Remove the datetime format override for that column so it is written as its native type.
Example fix
// before (SQL transform leaving epoch millis) SELECT id, ts FROM source // after SELECT id, CAST(ts AS TIMESTAMP) AS ts FROM source
Defensive patterns
Strategy: type-guard
Validate before calling
// before writing, check the runtime value
columns.forEach((name, type) -> {
Object v = row.getField(idx);
if (isTimeFormat(type) && !(v instanceof LocalDateTime || v instanceof LocalTime || v instanceof java.util.Date)) {
throw new IllegalArgumentException("field " + name + " must be a time type, got " + v.getClass());
}
}); Type guard
boolean isTemporal(Object v) {
return v instanceof LocalDateTime || v instanceof LocalTime || v instanceof LocalDate || v instanceof java.util.Date;
} Try / catch
try {
writer.write(row);
} catch (FileConnectorException e) {
if (e.getCode() == CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE) {
// convert the offending column upstream and retry the batch
}
throw e;
} Prevention
- Declare timestamp columns as TIMESTAMP in the source catalog so they arrive as temporal types.
- Use SQL transform CAST(... AS TIMESTAMP) for string/epoch fields before Excel sinks.
- Avoid manual datetime format overrides on non-temporal columns.
When it happens
Trigger: Writing an Excel sink column configured with a datetime format (via filename/field time format) where the row value is a String, Long, or other non-temporal type instead of LocalDateTime/LocalTime/Date.
Common situations: Upstream source emits epoch millis or strings for a timestamp field; transforms convert types so a declared time column arrives as VARCHAR/BIGINT; misconfigured field_format mapping.
Related errors
- ADD_BATCH_DATA_FAILED
- Cannot convert field
- Cannot convert to double:
- Cannot convert to float:
- Cannot convert to int:
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/1aec711d23c0cdf4.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/util/ExcelGenerator.java:279
}
}
private void setTimestampColumn(Object value, Cell cell) {
if (value instanceof Timestamp) {
cell.setCellValue((Timestamp) value);
cell.setCellStyle(dateTimeCellStyle);
} else if (value instanceof LocalDate) {
cell.setCellValue((LocalDate) value);
cell.setCellStyle(dateCellStyle);
} else if (value instanceof LocalDateTime) {
cell.setCellValue(Timestamp.valueOf((LocalDateTime) value));
cell.setCellStyle(dateTimeCellStyle);
} else if (value instanceof LocalTime) {
cell.setCellValue(
Timestamp.valueOf(((LocalTime) value).atDate(LocalDate.ofEpochDay(0))));
cell.setCellStyle(timeCellStyle);
} else {
throw new FileConnectorException(
CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
"Time series type expected for field");
}
}
private CellStyle createStyle(Workbook wb, String format) {
CreationHelper creationHelper = wb.getCreationHelper();
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat(format));
return cellStyle;
}
}
View on GitHub (pinned to cf67b549a7)