alibaba/DataX · error · IllegalArgumentException

type=

Error message

type={type}

What it means

Thrown from the default branch of the switch that maps a ColumnDataType enum constant to its boxed Java class name (e.g. DOUBLE -> java.lang.Double). If the switch is reached with a type that has no case (the NULL case is commented out in this code), the method rejects it with IllegalArgumentException('type=' + type). It signals an internal enum/switch mismatch rather than a user data error.

Solutions

  1. Log or inspect the offending type value in the exception message to identify which ColumnDataType constant leaked through.
  2. If it is NULL, re-enable the commented 'case NULL' (returning null or Void.class.getName()) and rebuild the plugin.
  3. If it is a new constant, add an explicit case returning the correct Java class name.
  4. Add a unit test that iterates ColumnDataType.values() through this method so any future constant fails fast in CI, not production.

Example fix

// before
// case NULL:
// return null;
default:
    throw new IllegalArgumentException("type=" + type);
// after
case NULL:
    return null;
default:
    throw new IllegalArgumentException("type=" + type);
Defensive patterns

Strategy: validation

Validate before calling

Set<ColumnDataType> handled = EnumSet.of(ColumnDataType.MULTI_VALUE, ColumnDataType.DOUBLE, ColumnDataType.FLOAT /*, all cases in the switch */);
if (!handled.contains(type)) throw new IllegalArgumentException("unmapped type " + type);

Type guard

boolean isMappedType(ColumnDataType t) {
    return t != null && t != ColumnDataType.NULL; // NULL case is commented out in the switch
}

Try / catch

try {
    String cls = classNameFor(type);
} catch (IllegalArgumentException e) {
    // internal enum/switch mismatch: log type and rethrow as plugin defect
    LOG.error("ColumnDataType not mapped to a Java class: {}", e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: Invoking the class-name lookup with a ColumnDataType value that is not one of the handled cases, e.g. a NULL type or a newly added enum constant that was never given a case in this switch; also any code path that fishes a type out of TYPES_BY_VALUE_TYPE and forwards it here.

Common situations: Upgrading adswriter to a version where a new ColumnDataType constant was added but this switch was not updated, or legacy code paths that produce the commented-out NULL type at runtime.

Related errors


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/20a50e0856735ac1. Report an issue: GitHub.

Appendix: source

Thrown at adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/ads/ColumnDataType.java:175

            case TIMESTAMP:
                // "java.sql.Timestamp";
                return Timestamp.class.getName();
            case STRING:
                // case STRING_IGNORECASE:
                // case STRING_FIXED:
            case MULTI_VALUE:
                // "java.lang.String";
                return String.class.getName();
            case DOUBLE:
                // "java.lang.Double";
                return Double.class.getName();
            case FLOAT:
                // "java.lang.Float";
                return Float.class.getName();
                // case NULL:
                // return null;
            default:
                throw new IllegalArgumentException("type=" + type);
        }
    }

    /**
     * Get the data type object for the given value type.
     * 
     * @param type the value type
     * @return the data type object
     */
    public static ColumnDataType getDataType(int type) {
        if (type < 0 || type >= TYPE_COUNT) {
            throw new IllegalArgumentException("type=" + type);
        }
        ColumnDataType dt = TYPES_BY_VALUE_TYPE.get(type);
        // if (dt == null) {
        // dt = TYPES_BY_VALUE_TYPE.get(NULL);
        // }
        return dt;

View on GitHub (pinned to 80ec23d5c5)