apache/seatunnel · error · JdbcConnectorException

CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE

CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE

Error message

Unexpected value: ${typeClass}

What it means

In PostgresJdbcRowConverter.toInternal, when converting a JDBC array value to a SeaTunnel row, the Java class of the retrieved array object must exactly match the ArrayType's declared type class. Any mismatch (e.g. expected int[] but got Integer[] or Object[]) throws UNSUPPORTED_DATA_TYPE with the unexpected type class.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresJdbcRowConverter.java:183

                    fields[fieldIndex] = JdbcFieldTypeUtils.getBytes(rs, resultSetIndex);
                    break;
                case NULL:
                    fields[fieldIndex] = null;
                    break;
                case ARRAY:
                    Array jdbcArray = rs.getArray(resultSetIndex);
                    if (jdbcArray == null) {
                        fields[fieldIndex] = null;
                        break;
                    }

                    Object arrayObject = jdbcArray.getArray();
                    if (((ArrayType) seaTunnelDataType)
                            .getTypeClass()
                            .equals(arrayObject.getClass())) {
                        fields[fieldIndex] = arrayObject;
                    } else {
                        throw new JdbcConnectorException(
                                CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
                                "Unexpected value: " + seaTunnelDataType.getTypeClass());
                    }
                    break;
                case MAP:
                case ROW:
                default:
                    throw new JdbcConnectorException(
                            CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
                            "Unexpected value: " + seaTunnelDataType);
            }
        }
        return new SeaTunnelRow(fields);
    }

    @Override
    public PreparedStatement toExternal(
            TableSchema tableSchema,

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Align the SeaTunnel schema's array element type with the actual Postgres column type (e.g. array<int> for int4[])
  2. Add a conversion for the returned array class, or normalize the array (e.g. convert Integer[] to int[]) before this branch
  3. Avoid multidimensional Postgres arrays; flatten them or use supported types

Example fix

// before
// schema: array<string> but column is varchar[][]
// after
// change column to text[] or map to array<string>
Defensive patterns

Strategy: validation

Validate before calling

Object arr = jdbcArray.getArray();
if (!((ArrayType) dataType).getTypeClass().equals(arr.getClass())) {
    arr = normalizeArray(arr, ((ArrayType) dataType).getTypeClass());
}

Try / catch

try { row = converter.toInternal(rs); } catch (JdbcConnectorException e) { log.error("array column type mismatch: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Reading a Postgres ARRAY column where jdbcArray.getArray() returns a class different from ((ArrayType) seaTunnelDataType).getTypeClass() - typically a primitive-array vs boxed-array or multidimensional array mismatch.

Common situations: Postgres int4[]/int8[]/text[] columns whose driver returns boxed arrays; multidimensional arrays; schema declared with a different element type than the actual column.

Related errors


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