{"record":{"id":"f07700d6116704e0","repo":"alibaba/DataX","slug":"type-type-f07700","errorCode":null,"errorMessage":"type={type}","messagePattern":"type=\\{type\\}","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/odps/DataType.java","lineNumber":39,"sourceCode":"    public final static byte DOUBLE = 1;\n    public final static byte BOOLEAN = 2;\n    public final static byte STRING = 3;\n    public final static byte DATETIME = 4;\n\n    public static String toString(int type) {\n        switch (type) {\n            case INTEGER:\n                return \"bigint\";\n            case DOUBLE:\n                return \"double\";\n            case BOOLEAN:\n                return \"boolean\";\n            case STRING:\n                return \"string\";\n            case DATETIME:\n                return \"datetime\";\n            default:\n                throw new IllegalArgumentException(\"type=\" + type);\n        }\n    }\n\n    /**\n     * 字符串的数据类型转换为byte常量定义的数据类型.\n     * <p>\n     * 转换规则：\n     * <ul>\n     * <li>tinyint, int, bigint, long - {@link #INTEGER}\n     * <li>double, float - {@link #DOUBLE}\n     * <li>string - {@link #STRING}\n     * <li>boolean, bool - {@link #BOOLEAN}\n     * <li>datetime - {@link #DATETIME}\n     * </ul>\n     * </p>\n     *\n     * @param type 字符串的数据类型\n     * @return byte常量定义的数据类型","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/odps/DataType.java#L21-L57","documentation":"Thrown by DataType.toString(type) in the adswriter odps package when the byte constant passed in is not one of INTEGER, DOUBLE, BOOLEAN, STRING, DATETIME. It is the default branch of a switch converting internal type constants to ODPS type name strings, so any unmapped constant produces this error with the raw value interpolated.","triggerScenarios":"Calling DataType.toString with a byte constant that was never defined in this class — e.g. a constant obtained from another module/version, or an uninitialized (0/default) type field that does not map to any case.","commonSituations":"Version skew between modules defining type constants; a code path that passes a default-initialized DataType field before assignment; new type added to constants but not to toString.","solutions":["Inspect the interpolated type value to see which constant leaked in","Ensure the type byte comes from DataType.asType(...)/this class's own constants, not a foreign module","Initialize type fields before use and add the missing constant-to-string mapping if the type is legitimate","Rebuild adswriter with matching DataX common/odps dependency versions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure the byte comes from a valid constant before calling toString\nif (type != DataType.INTEGER && type != DataType.DOUBLE && type != DataType.BOOLEAN\n        && type != DataType.STRING && type != DataType.DATETIME) {\n    throw new IllegalStateException(\"Unsupported DataType byte: \" + type);\n}","typeGuard":"static boolean isValidDataType(byte t) {\n    return t == DataType.INTEGER || t == DataType.DOUBLE || t == DataType.BOOLEAN\n            || t == DataType.STRING || t == DataType.DATETIME;\n}","tryCatchPattern":"catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"type=\")) { /* log the byte value, check version skew */ }\n  throw e;\n}","preventionTips":["Initialize type fields from DataType.asType(...) rather than arithmetic on constants","Pin consistent DataX/odps artifact versions across modules"],"tags":["adswriter","odps","type-mapping","switch-default"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}