apache/seatunnel · error · IllegalArgumentException

Unsupported timestamp value type:

Error message

Unsupported timestamp value type: 

What it means

BaseTypeWriter.convertToEpochMicro converts a timestamp value to epoch microseconds for Arrow Timestamp vectors. If the value is neither LocalTime-compatible timestamp, java.sql.Timestamp, java.util.Date, nor Number, it throws IllegalArgumentException naming the actual Java class. It means the value written to a Lance timestamp column has an unexpected runtime type.

Source

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

        return buffer;
    }

    protected boolean toBoolean(Object value) {
        return value instanceof Boolean ? (Boolean) value : Boolean.parseBoolean(value.toString());
    }

    protected long convertToEpochMicro(Object value) {
        if (value instanceof LocalDateTime) {
            return ((LocalDateTime) value).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()
                    * 1000;
        } else if (value instanceof java.sql.Timestamp) {
            return ((java.sql.Timestamp) value).getTime() * 1000;
        } else if (value instanceof java.util.Date) {
            return ((java.util.Date) value).getTime() * 1000;
        } else if (value instanceof Number) {
            return ((Number) value).longValue();
        } else {
            throw new IllegalArgumentException(
                    "Unsupported timestamp value type: " + value.getClass());
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Convert the value to java.time.LocalDateTime or java.sql.Timestamp before the Lance sink (e.g. in a transform or in the source's row converter).
  2. If the value is a String, parse it with the correct pattern into LocalDateTime first.
  3. Check the source connector's field type mapping so TIMESTAMP columns really deliver temporal types, not strings.

Example fix

// before
row.setField(i, "2024-01-01 10:00:00"); // String into timestamp column
// after
row.setField(i, java.sql.Timestamp.valueOf("2024-01-01 10:00:00"));
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(value instanceof LocalDateTime || value instanceof java.sql.Timestamp || value instanceof java.util.Date || value instanceof Number)) throw new IllegalArgumentException("timestamp column got " + value.getClass());

Type guard

static boolean isTimestampLike(Object v) { return v instanceof LocalDateTime || v instanceof java.sql.Timestamp || v instanceof java.util.Date || v instanceof Number; }

Try / catch

try { writer.write(row); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Unsupported timestamp value type")) { /* fix/convert row and re-run */ } throw e; }

Prevention

When it happens

Trigger: A SeaTunnelRow field typed as timestamp carries an object other than LocalDateTime/java.sql.Timestamp/java.util.Date/Number when the writer serializes it to the Arrow vector.

Common situations: Upstream source (e.g. CDC or JDBC) delivered a custom temporal type or String into a TIMESTAMP field; a transform produced a String/BigDecimal timestamp; wrong field ordering caused values to land in the wrong 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/edb3e4904973cbc0. Report an issue: GitHub.