apache/seatunnel · error · IllegalStateException
Unsupported operation type, the MIN value type %s is differe
Error message
Unsupported operation type, the MIN value type %s is different with MAX value type %s.
What it means
calculateDistributionFactor() computes a factor used to decide whether the table is evenly distributed for chunk splitting. If the MIN and MAX sampled values of the split column are of different Java classes (e.g. different driver-side representations of the value), the arithmetic is meaningless, so it throws IllegalStateException.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/enumerator/splitter/AbstractJdbcSourceChunkSplitter.java:364
} catch (ArithmeticException e) {
// Stop chunk split to avoid dead loop when number overflows.
break;
}
}
// add the ending split
splits.add(ChunkRange.of(chunkStart, null));
return splits;
}
// ------------------------------------------------------------------------------------------
/** Returns the distribution factor of the given table. */
@SuppressWarnings("MagicNumber")
protected double calculateDistributionFactor(
TableId tableId, Object min, Object max, long approximateRowCnt) {
if (!min.getClass().equals(max.getClass())) {
throw new IllegalStateException(
String.format(
"Unsupported operation type, the MIN value type %s is different with MAX value type %s.",
min.getClass().getSimpleName(), max.getClass().getSimpleName()));
}
if (approximateRowCnt == 0) {
return Double.MAX_VALUE;
}
BigDecimal difference = ObjectUtils.minus(max, min);
// factor = (max - min + 1) / rowCount
final BigDecimal subRowCnt = difference.add(BigDecimal.valueOf(1));
double distributionFactor =
subRowCnt.divide(new BigDecimal(approximateRowCnt), 4, ROUND_CEILING).doubleValue();
log.info(
"The distribution factor of table {} is {} according to the min split key {}, max split key {} and approximate row count {}",
tableId,
distributionFactor,
min,
max,View on GitHub (pinned to cf67b549a7)
Solutions
- Check the split column type; switch to a PK/unique column with a consistent, supported numeric/date/string type
- Inspect the actual column data for mixed/invalid values and normalize the column
- Avoid keyless or exotic typed columns; add a plain BIGINT/INT primary key for splitting
- If caused by a driver type-mapping bug, upgrade the JDBC driver or connector version
Example fix
// before: split column = status ENUM(...) // ALTER TABLE db.t ADD COLUMN id BIGINT AUTO_INCREMENT PRIMARY KEY; // after: connector picks `id` (consistent Long min/max) for chunk splitting
Defensive patterns
Strategy: validation
Validate before calling
// Ensure min/max of the split column have a consistent type:
SELECT MIN(id), MAX(id),
MIN(id) = MAX(id) OR typeof(MIN(id)) = typeof(MAX(id)) AS types_ok FROM db.t; Type guard
boolean sameType(Object min, Object max) { return min != null && max != null && min.getClass().equals(max.getClass()); } Try / catch
try { factor = calculateDistributionFactor(tableId, min, max, cnt); }
catch (IllegalStateException e) { LOG.warn("Mixed min/max types for {}", tableId); useFallbackChunkSize(); } Prevention
- Choose split keys with homogeneous, well-supported types (INT/BIGINT/DATE/VARCHAR)
- Avoid ENUM/BIT/unsigned exotic columns as split keys
- Clean mixed-type data in candidate split columns
When it happens
Trigger: distributionFactor() -> calculateDistributionFactor(tableId, min, max, approximateRowCnt) where min.getClass() != max.getClass(); typically caused by the DB returning heterogeneous types for MIN()/MAX() on odd column types (e.g. mixed charsets, enum/uint driver mappings).
Common situations: Split column of a type whose MIN/MAX come back as different classes (e.g. BIT, ENUM, unsigned variants in the MySQL driver); corrupted or mixed-type data in the column; dialect-specific driver type mapping quirks.
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
- Exactly once is enabled, but not found primary key or unique
- Failed to split chunks for table " + tableId
- Generate Splits for table %s error
- Unsupported operand type, the minuend type %s is different w
- Unable to convert to LocalDateTime from unexpected value ''
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/490d2b6063c22bb9.
Report an issue: GitHub.