{"record":{"id":"1aec711d23c0cdf4","repo":"apache/seatunnel","slug":"common-unsupported-data-type-1aec71","errorCode":"COMMON_UNSUPPORTED_DATA_TYPE","errorMessage":"Time series type expected for field","messagePattern":"Time series type expected for field","errorType":"error_code","errorClass":"FileConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/util/ExcelGenerator.java","lineNumber":279,"sourceCode":"        }\n    }\n\n    private void setTimestampColumn(Object value, Cell cell) {\n        if (value instanceof Timestamp) {\n            cell.setCellValue((Timestamp) value);\n            cell.setCellStyle(dateTimeCellStyle);\n        } else if (value instanceof LocalDate) {\n            cell.setCellValue((LocalDate) value);\n            cell.setCellStyle(dateCellStyle);\n        } else if (value instanceof LocalDateTime) {\n            cell.setCellValue(Timestamp.valueOf((LocalDateTime) value));\n            cell.setCellStyle(dateTimeCellStyle);\n        } else if (value instanceof LocalTime) {\n            cell.setCellValue(\n                    Timestamp.valueOf(((LocalTime) value).atDate(LocalDate.ofEpochDay(0))));\n            cell.setCellStyle(timeCellStyle);\n        } else {\n            throw new FileConnectorException(\n                    CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,\n                    \"Time series type expected for field\");\n        }\n    }\n\n    private CellStyle createStyle(Workbook wb, String format) {\n        CreationHelper creationHelper = wb.getCreationHelper();\n        CellStyle cellStyle = wb.createCellStyle();\n        cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat(format));\n        return cellStyle;\n    }\n}\n","sourceCodeStart":261,"sourceCodeEnd":292,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/util/ExcelGenerator.java#L261-L292","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (SQL transform leaving epoch millis)\nSELECT id, ts FROM source\n// after\nSELECT id, CAST(ts AS TIMESTAMP) AS ts FROM source","handlingStrategy":"type-guard","validationCode":"// before writing, check the runtime value\ncolumns.forEach((name, type) -> {\n  Object v = row.getField(idx);\n  if (isTimeFormat(type) && !(v instanceof LocalDateTime || v instanceof LocalTime || v instanceof java.util.Date)) {\n    throw new IllegalArgumentException(\"field \" + name + \" must be a time type, got \" + v.getClass());\n  }\n});","typeGuard":"boolean isTemporal(Object v) {\n  return v instanceof LocalDateTime || v instanceof LocalTime || v instanceof LocalDate || v instanceof java.util.Date;\n}","tryCatchPattern":"try {\n  writer.write(row);\n} catch (FileConnectorException e) {\n  if (e.getCode() == CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE) {\n    // convert the offending column upstream and retry the batch\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["excel","type-mismatch","data-types"],"backgroundTag":"unsupported-dtype","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}