apache/seatunnel · error · SQLException

Unsupported YashanDB vector value type

Error message

Unsupported YashanDB vector value type: ${className}

What it means

When binding a SeaTunnel VECTOR-typed value to a PreparedStatement, YashanDbJdbcRowConverter only knows how to serialize float arrays, primitive arrays, and Object[] into YashanDB Vector values. A value of any other Java type cannot be converted, so an SQLException naming the value's class is thrown.

Solutions

  1. Convert the upstream value to a float[] (or Object[] of floats) before the sink, e.g. via a transform or by fixing the source mapping
  2. Verify the source column is genuinely a vector type and mapped to SeaTunnel ARRAY<FLOAT> / VECTOR, not string/bytes
  3. Cast explicitly: if the value is a List<Float>, stream-map to float[] before writing
  4. Update the connector to add serialization for the offending value class

Example fix

// before
float[] vec = (String) value; // fails
// after
float[] vec = ((List<Float>) value).stream().map(Float::floatValue)
        .collect(Collectors.toList()).stream()
        .mapToInt(Float::intValue)... // better: convert to float[] explicitly before writing
Defensive patterns

Strategy: type-guard

Validate before calling

Object v = row.getField(vectorFieldIndex);
if (!(v instanceof float[] || v instanceof Float[] || v instanceof Object[])) throw new IllegalArgumentException("vector field must be float array");

Type guard

static boolean isVectorValue(Object v) {
    return v instanceof float[] || v instanceof Float[] || v instanceof Object[];
}

Try / catch

try {
    converter.setToStatement(stmt, idx, dataType, value, sourceType);
} catch (SQLException e) {
    if (e.getMessage().startsWith("Unsupported YashanDB vector value type")) {
        value = toFloatArray(value); // normalize and retry
    } else throw e;
}

Prevention

When it happens

Trigger: setValueToStatementByDataType() is called for a VECTOR column whose SeaTunnelRow field is not a float[], Float[], primitive array, or Object[] — e.g. a String, byte[], List<Float>, or null-wrapped object produced upstream.

Common situations: Embedding vectors produced by an ML pipeline where the field arrives as List<Float> or JSON-decoded arrays rather than SeaTunnel array types; mis-declared sink schema where a text/bytea field is mapped as VECTOR.

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/e00ddffcda2ffdb2. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/yashandb/YashanDbJdbcRowConverter.java:185

                return;
            }
            Object[] array = (Object[]) value;
            setArray(statement, (ArrayType<?, ?>) seaTunnelDataType, statementIndex, array);
            return;
        }
        if (isFloatVectorType(sqlType)) {
            if (value == null) {
                statement.setNull(statementIndex, java.sql.Types.VARCHAR);
            } else if (value instanceof ByteBuffer) {
                statement.setObject(
                        statementIndex,
                        Vector.ofFloat32Values(toFloat32VectorValues(value, sqlType)));
            } else if (value instanceof Object[]) {
                statement.setObject(
                        statementIndex,
                        Vector.ofFloat32Values(toFloat32VectorValues(value, sqlType)));
            } else {
                throw new SQLException(
                        "Unsupported YashanDB vector value type: " + value.getClass().getName());
            }
            return;
        }
        super.setValueToStatementByDataType(
                value, statement, seaTunnelDataType, statementIndex, sourceType);
    }

    private static boolean isFloatVectorType(SqlType sqlType) {
        return SqlType.FLOAT_VECTOR.equals(sqlType)
                || SqlType.FLOAT16_VECTOR.equals(sqlType)
                || SqlType.BFLOAT16_VECTOR.equals(sqlType);
    }

    private static ByteBuffer convertToVectorBuffer(Object vectorValue) {
        if (vectorValue == null) {
            return null;
        }

View on GitHub (pinned to cf67b549a7)