apache/seatunnel · error · FakeConnectorException

COMMON_UNSUPPORTED_DATA_TYPE

COMMON_UNSUPPORTED_DATA_TYPE

Error message

The data type of the fake data is not supported

What it means

FakeDataGenerator.customField wraps Jackson JSON processing in a try/catch and, when a JsonProcessingException occurs while building/patching the fake row's JSON node, rethrows it as a FakeConnectorException with CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE and the message 'The data type of the fake data is not supported'. It signals that the configured fake data could not be serialized into the row schema.

Source

Thrown at seatunnel-connectors-v2/connector-fake/src/main/java/org/apache/seatunnel/connectors/seatunnel/fake/source/FakeDataGenerator.java:202

            int arity = fieldTypes.length;

            for (int i = 0; i < arity; i++) {
                SeaTunnelDataType<?> fieldType = fieldTypes[i];
                JsonNode field = jsonNode.isArray() ? jsonNode.get(i) : jsonNode.get(fieldNames[i]);

                if (field == null) {
                    continue;
                }

                String newValue = getNewValueForField(fieldType.getSqlType(), field.asText());
                if (newValue != null) {
                    jsonNode = replaceFieldValue(jsonNode, i, fieldNames[i], newValue);
                }
            }

            rowData.setFieldsJson(jsonNode.toString());
        } catch (JsonProcessingException e) {
            throw new FakeConnectorException(
                    CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
                    "The data type of the fake data is not supported",
                    e);
        }
    }

    private String getNewValueForField(SqlType sqlType, String fieldValue) {
        switch (sqlType) {
            case TIME:
                return fieldValue.equals(CURRENT_TIME) ? LocalTime.now().toString() : null;
            case DATE:
                return fieldValue.equalsIgnoreCase(CURRENT_DATE)
                        ? LocalDate.now().toString()
                        : null;
            case TIMESTAMP:
                return fieldValue.equalsIgnoreCase(CURRENT_TIMESTAMP)
                        ? LocalDateTime.now().toString()
                        : null;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the SeaTunnel schema column type for the failing field and align the configured fake data type with it
  2. If using custom data (FakeDataType.CUSTOM), validate that each template value is valid JSON of the right type
  3. Inspect the wrapped JsonProcessingException cause in the logs for the exact field/value that failed serialization

Example fix

// before: schema column "age" is INT but fake data supplies a string
FakeData { data = [{ age = "twenty" }] }
// after: match the configured value to the column type
FakeData { data = [{ age = 20 }] }
Defensive patterns

Strategy: validation

Validate before calling

// validate custom fake data against schema before running
for (JsonNode row : customData) {
    if (!row.isObject()) throw new IllegalArgumentException("fake data rows must be JSON objects");
    for (String f : schemaFields) {
        if (row.has(f) && !typeMatches(schemaType(f), row.get(f))) {
            throw new IllegalArgumentException("field " + f + " type mismatch");
        }
    }
}

Type guard

boolean typeMatches(SeaTunnelDataType<?> t, JsonNode v) {
    switch (t.getSqlType()) {
        case INT: case BIGINT: return v.canConvertToLong();
        case DOUBLE: case FLOAT: return v.isNumber();
        case STRING: return v.isTextual();
        case BOOLEAN: return v.isBoolean();
        default: return true;
    }
}

Try / catch

try {
    rowData = fakeDataGenerator.generateCustomRows(...);
} catch (FakeConnectorException e) {
    if (CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE.equals(e.getSeaTunnelErrorCode())) {
        // inspect e.getCause() (JsonProcessingException), fix the field type, restart the job
    }
}

Prevention

When it happens

Trigger: generateCustomRows calls customField and the Jackson ObjectMapper fails while writing or mutating the JSON node for a configured field (e.g. a configured fake value cannot be represented in the target schema field); called for each row during FakeSource reads.

Common situations: Schema type and configured fake data mismatch (e.g. a string value for an int column in a custom JSON template), malformed template JSON in 'fake.data' for custom row generation, or unsupported SeaTunnel DataTypes lacking a mapping in the generator.

Related errors


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