{"record":{"id":"c0ea027ea06106f0","repo":"apache/seatunnel","slug":"unsupported-date-value-type","errorCode":null,"errorMessage":"Unsupported date value type: ","messagePattern":"Unsupported date value type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/DateTypeWriter.java","lineNumber":74,"sourceCode":"        } else if (value instanceof java.sql.Date) {\n            return ((java.sql.Date) value).toLocalDate().toEpochDay();\n        } else {\n            return LocalDate.parse(value.toString()).toEpochDay();\n        }\n    }\n\n    private long convertToEpochMilli(Object value) {\n        if (value instanceof LocalDate) {\n            return ((LocalDate) value)\n                    .atStartOfDay(ZoneId.systemDefault())\n                    .toInstant()\n                    .toEpochMilli();\n        } else if (value instanceof java.sql.Date) {\n            return ((java.sql.Date) value).getTime();\n        } else if (value instanceof java.util.Date) {\n            return ((java.util.Date) value).getTime();\n        } else {\n            throw new IllegalArgumentException(\"Unsupported date value type: \" + value.getClass());\n        }\n    }\n\n    @Override\n    public void writeToListWriter(\n            UnionListWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {\n        ArrowType.Date dateType = (ArrowType.Date) arrowType;\n        if (dateType.getUnit() == DateUnit.DAY) {\n            writer.writeInt((int) convertToEpochDay(value));\n        } else {\n            writer.writeBigInt(convertToEpochMilli(value));\n        }\n    }\n\n    @Override\n    public void writeToMapKey(\n            UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {\n        writeToListWriter(writer, arrowType, value, allocator);","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/DateTypeWriter.java#L56-L92","documentation":"DateTypeWriter.convertToEpochMilli converts a date value to epoch milliseconds for DateMilliVector (and list writers). If the value is not LocalDate/LocalDateTime/Instant-like, java.sql.Date, or java.util.Date, it throws IllegalArgumentException naming the class. It means a DATE column received a value of an unexpected runtime type.","triggerScenarios":"A SeaTunnelRow field mapped to a Lance DATE column carries e.g. a String, Long epoch, or custom type when writeToVector/writeToListWriter needs DateMilli conversion (convertToEpochMilli path).","commonSituations":"CSV/JSON source parsed dates as strings; upstream sent epoch seconds as Long without declaring a date type; a transform cast the field to STRING; column order mismatch put a non-date value in the date column.","solutions":["Convert the value to java.time.LocalDate (or java.sql.Date) before writing — parse strings with LocalDate.parse(value, formatter).","If it is an epoch number, convert explicitly: LocalDate.ofEpochDay(longValue).","Fix the upstream source/transform type mapping so the field's SeaTunnel type is DATE and the runtime value matches."],"exampleFix":"// before\nrow.setField(i, \"2024-06-01\"); // String\n// after\nrow.setField(i, java.time.LocalDate.parse(\"2024-06-01\"));","handlingStrategy":"type-guard","validationCode":"if (!(value instanceof LocalDate || value instanceof LocalDateTime || value instanceof java.sql.Date || value instanceof java.util.Date)) throw new IllegalArgumentException(\"date column got \" + value.getClass());","typeGuard":"static boolean isDateLike(Object v) { return v instanceof LocalDate || v instanceof LocalDateTime || v instanceof java.sql.Date || v instanceof java.util.Date; }","tryCatchPattern":"try { writer.write(row); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unsupported date value type\")) { /* convert value to LocalDate and retry pipeline */ } throw e; }","preventionTips":["Parse date strings to LocalDate at the source (CSV/JSON formats).","Declare DATE fields as SeaTunnel DATE type so connectors emit proper objects.","Convert epoch numbers explicitly with LocalDate.ofEpochDay.","Validate row values against the declared SeaTunnelRowType before sinking."],"tags":["lance","arrow","date","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}