apache/seatunnel · error · IllegalArgumentException

Unsupported date value type:

Error message

Unsupported date value type: 

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/DateTypeWriter.java:74

        } else if (value instanceof java.sql.Date) {
            return ((java.sql.Date) value).toLocalDate().toEpochDay();
        } else {
            return LocalDate.parse(value.toString()).toEpochDay();
        }
    }

    private long convertToEpochMilli(Object value) {
        if (value instanceof LocalDate) {
            return ((LocalDate) value)
                    .atStartOfDay(ZoneId.systemDefault())
                    .toInstant()
                    .toEpochMilli();
        } else if (value instanceof java.sql.Date) {
            return ((java.sql.Date) value).getTime();
        } else if (value instanceof java.util.Date) {
            return ((java.util.Date) value).getTime();
        } else {
            throw new IllegalArgumentException("Unsupported date value type: " + value.getClass());
        }
    }

    @Override
    public void writeToListWriter(
            UnionListWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
        ArrowType.Date dateType = (ArrowType.Date) arrowType;
        if (dateType.getUnit() == DateUnit.DAY) {
            writer.writeInt((int) convertToEpochDay(value));
        } else {
            writer.writeBigInt(convertToEpochMilli(value));
        }
    }

    @Override
    public void writeToMapKey(
            UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
        writeToListWriter(writer, arrowType, value, allocator);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Convert the value to java.time.LocalDate (or java.sql.Date) before writing — parse strings with LocalDate.parse(value, formatter).
  2. If it is an epoch number, convert explicitly: LocalDate.ofEpochDay(longValue).
  3. Fix the upstream source/transform type mapping so the field's SeaTunnel type is DATE and the runtime value matches.

Example fix

// before
row.setField(i, "2024-06-01"); // String
// after
row.setField(i, java.time.LocalDate.parse("2024-06-01"));
Defensive patterns

Strategy: type-guard

Validate before calling

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());

Type guard

static boolean isDateLike(Object v) { return v instanceof LocalDate || v instanceof LocalDateTime || v instanceof java.sql.Date || v instanceof java.util.Date; }

Try / catch

try { writer.write(row); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Unsupported date value type")) { /* convert value to LocalDate and retry pipeline */ } throw e; }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/c0ea027ea06106f0. Report an issue: GitHub.