alibaba/DataX · error · IllegalArgumentException
unknown type: {type}
Error message
unknown type: {type} What it means
Thrown by DataType.asType(String) (odps package) when the lowercased, trimmed input string is not one of: string; bigint/int/tinyint/long; boolean/bool; double/float; datetime. It converts a user-facing ODPS type name into the internal byte constant; any unrecognized spelling is rejected with 'unknown type: <value>'.
Source
Thrown at adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/odps/DataType.java:73
*
* @param type 字符串的数据类型
* @return byte常量定义的数据类型
* @throws IllegalArgumentException
*/
public static byte convertToDataType(String type) throws IllegalArgumentException {
type = type.toLowerCase().trim();
if ("string".equals(type)) {
return STRING;
} else if ("bigint".equals(type) || "int".equals(type) || "tinyint".equals(type) || "long".equals(type)) {
return INTEGER;
} else if ("boolean".equals(type) || "bool".equals(type)) {
return BOOLEAN;
} else if ("double".equals(type) || "float".equals(type)) {
return DOUBLE;
} else if ("datetime".equals(type)) {
return DATETIME;
} else {
throw new IllegalArgumentException("unknown type: " + type);
}
}
}
View on GitHub (pinned to 80ec23d5c5)
Solutions
- Change the column type to one of the supported names: string, bigint, int, tinyint, long, boolean, bool, double, float, datetime
- Check for stray whitespace, casing is fine (input is normalized) but verify no non-ASCII look-alike characters
- If you need decimal/varchar semantics, map them to double/string at the configuration level
Example fix
// before
{"column": ["*"], "odpsColumnType": "varchar(50)"} // asType("varchar(50)") throws
// after
{"column": ["*"], "odpsColumnType": "string"} Defensive patterns
Strategy: validation
Validate before calling
static final Set<String> ALLOWED = new HashSet<>(Arrays.asList(
"string", "bigint", "int", "tinyint", "long", "boolean", "bool", "double", "float", "datetime"));
String normalized = configuredType.toLowerCase().trim();
if (!ALLOWED.contains(normalized)) {
throw new IllegalArgumentException("Unsupported ODPS type: " + configuredType);
} Type guard
boolean isSupportedOdpsType(String t) {
return t != null && ALLOWED.contains(t.toLowerCase().trim());
} Try / catch
catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("unknown type:")) { /* surface the config key holding the bad type */ }
throw e;
} Prevention
- Validate ODPS column types against the supported list when parsing job config
- Map varchar->string and decimal->double at config-build time
When it happens
Trigger: Calling DataType.asType with strings like 'INT32', 'varchar', 'DECIMAL(10,2)', ' datetime ' with hidden characters, or any type alias not in the accepted list.
Common situations: Hand-edited job configuration with an ODPS column type the mapper does not accept; copy-pasting Hive/MySQL types (varchar, decimal) into an ODPS context; invisible whitespace or full-width characters in the type string.
Related errors
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/06a85582b3257973.
Report an issue: GitHub.