apache/seatunnel · error · MongodbConnectorException
UNSUPPORTED_DATA_TYPE
UNSUPPORTED_DATA_TYPE
Error message
Not support to parse type: ${type} What it means
BsonToRowDataConverters.createInternalConverter builds a BsonValue->Object converter per SeaTunnel column type. When the target column's SqlType falls through the switch (no case matches, e.g. NULL_TYPE, TIME, or any type added to SeaTunnel but not handled here), it throws MongodbConnectorException(UNSUPPORTED_DATA_TYPE, "Not support to parse type: " + type). It is thrown at converter-construction time (job startup/schema resolution), not per document.
Source
Thrown at seatunnel-connectors-v2/connector-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/serde/BsonToRowDataConverters.java:220
@Override
public Object apply(BsonValue bsonValue) {
DecimalType decimalType = (DecimalType) type;
BigDecimal decimalValue = convertToBigDecimal(bsonValue);
return fromBigDecimal(
decimalValue, decimalType.getPrecision(), decimalType.getScale());
}
};
case ARRAY:
return createArrayConverter((ArrayType<?, ?>) type);
case MAP:
MapType<?, ?> mapType = (MapType<?, ?>) type;
return createMapConverter(
mapType.toString(), mapType.getKeyType(), mapType.getValueType());
case ROW:
return createRowConverter((SeaTunnelRowType) type);
default:
throw new MongodbConnectorException(
UNSUPPORTED_DATA_TYPE, "Not support to parse type: " + type);
}
}
private static LocalDateTime convertToLocalDateTime(BsonValue bsonValue) {
Instant instant;
if (bsonValue.isTimestamp()) {
instant = Instant.ofEpochMilli(bsonValue.asTimestamp().getValue());
} else if (bsonValue.isDateTime()) {
instant = Instant.ofEpochMilli(bsonValue.asDateTime().getValue());
} else {
throw new MongodbConnectorException(
ILLEGAL_ARGUMENT,
"Unable to convert to LocalDateTime from unexpected value '"
+ bsonValue
+ "' of type "
+ bsonValue.getBsonType());
}View on GitHub (pinned to cf67b549a7)
Solutions
- Change the column type in your schema/config to a supported SqlType (STRING, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DECIMAL, BYTES, DATE, TIMESTAMP, ARRAY, MAP, ROW).
- Pre-convert the field in the query or upstream pipeline so it lands as a supported type.
- If you own the code, add a case to the switch in createInternalConverter implementing a converter for the missing SqlType.
- Check your SeaTunnel version; upgrade to one where the MongoDB connector supports the type you need.
Example fix
// before
columns {
created_at = TIME
}
// after
columns {
created_at = TIMESTAMP
} Defensive patterns
Strategy: validation
Validate before calling
// Before submitting the job, check every declared column type is supported by the MongoDB serde
java.util.Set<SqlType> supported = new java.util.HashSet<>(java.util.Arrays.asList(
SqlType.STRING, SqlType.BOOLEAN, SqlType.TINYINT, SqlType.SMALLINT, SqlType.INT,
SqlType.BIGINT, SqlType.FLOAT, SqlType.DOUBLE, SqlType.DECIMAL, SqlType.BYTES,
SqlType.DATE, SqlType.TIMESTAMP, SqlType.ARRAY, SqlType.MAP, SqlType.ROW));
for (SeaTunnelDataType<?> t : rowType.getFieldTypes()) {
if (!supported.contains(t.getSqlType())) {
throw new IllegalArgumentException("Unsupported column type for MongoDB source: " + t);
}
} Try / catch
try {
runJob(config);
} catch (MongodbConnectorException e) {
if ("UNSUPPORTED_DATA_TYPE".equals(String.valueOf(e.getSeaTunnelErrorCode()))) {
// adjust schema column types and resubmit
} else { throw e; }
} Prevention
- Only declare column types from the MongoDB connector's documented supported list
- Avoid TIME and other exotic SqlTypes in schemas read from MongoDB
- After SeaTunnel upgrades, re-check that all schema types are still handled by the connector
When it happens
Trigger: Defining a MongoDB source table schema whose column type has a SqlType not in the switch (e.g. TIME, NULL_TYPE, or a newly introduced SeaTunnel SqlType), so createNullSafeInternalConverter -> createInternalConverter hits the default branch.
Common situations: Users declaring a schema with an exotic column type (time, unsupported variants) in a SeaTunnel config against MongoDB; upgrading SeaTunnel where a new SqlType exists in the catalog but the MongoDB serde was not extended.
Related errors
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/6d5e62e8d2ff3700.
Report an issue: GitHub.