{"record":{"id":"afd999149cde02c1","repo":"alibaba/DataX","slug":"302","errorCode":"-302","errorMessage":"ADS LOAD DATA source path is null.","messagePattern":"ADS LOAD DATA source path is null\\.","errorType":"error_code","errorClass":"AdsException","httpStatus":null,"severity":"error","filePath":"adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java","lineNumber":220,"sourceCode":"\n    /**\n     * Submit LOAD DATA command.\n     * \n     * @param table The target ADS table\n     * @param partition The partition option in the form of \"(partition_name,...)\"\n     * @param sourcePath The source path\n     * @param overwrite\n     * @return\n     * @throws AdsException\n     */\n    public String loadData(String table, String partition, String sourcePath, boolean overwrite) throws AdsException {\n\n        if (table == null) {\n            throw new AdsException(AdsException.ADS_LOADDATA_TABLE_NULL, \"ADS LOAD DATA table is null.\", null);\n        }\n\n        if (sourcePath == null) {\n            throw new AdsException(AdsException.ADS_LOADDATA_SOURCEPATH_NULL, \"ADS LOAD DATA source path is null.\",\n                    null);\n        }\n\n        if (adsURL == null) {\n            throw new AdsException(AdsException.ADS_CONN_URL_NOT_SET, \"ADS JDBC connection URL was not set.\", null);\n        }\n\n        if (userName == null) {\n            throw new AdsException(AdsException.ADS_CONN_USERNAME_NOT_SET,\n                    \"ADS JDBC connection user name was not set.\", null);\n        }\n\n        if (password == null) {\n            throw new AdsException(AdsException.ADS_CONN_PASSWORD_NOT_SET, \"ADS JDBC connection password was not set.\",\n                    null);\n        }\n\n        if (schema == null) {","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java#L202-L238","documentation":"Second guard in loadData: a null sourcePath throws AdsException code -302 (ADS_LOADDATA_SOURCEPATH_NULL). sourcePath is the ODPS/OSS location LOAD DATA reads from; without it the statement 'LOAD DATA FROM <path>' cannot be built.","triggerScenarios":"loadData invoked with sourcePath=null - e.g. the temp ODPS/OSS output path was never computed because an earlier export step failed silently or returned null.","commonSituations":"The odps writer step that stages data failed or was skipped; a path-building helper returned null on an edge case (empty partition); config for the staging directory is missing.","solutions":["Check the preceding staging/export step actually produced data and returned a path.","Verify the config keys for the ODPS/OSS staging location (bucket, directory) are set.","Add a null check on the path variable right after the export step and fail with a clearer message there.","Pass the path including quotes only if it already has them; the method handles both, but it must not be null."],"exampleFix":"// before\nString path = odpsExport.getResultPath(); // null on failure\nhelper.loadData(table, partition, path, true);\n// after\nString path = odpsExport.getResultPath();\nif (path == null) throw new IllegalStateException(\"odps export produced no path\");\nhelper.loadData(table, partition, path, true);","handlingStrategy":"validation","validationCode":"if (sourcePath == null || sourcePath.trim().isEmpty()) {\n    throw new IllegalStateException(\"staging export produced no path; aborting LOAD DATA\");\n}","typeGuard":"boolean isUsableSourcePath(String p) { return p != null && !p.trim().isEmpty(); }","tryCatchPattern":"try {\n    return helper.loadData(table, partition, sourcePath, overwrite);\n} catch (AdsException e) {\n    if (e.getCode() == AdsException.ADS_LOADDATA_SOURCEPATH_NULL) {\n        throw new IllegalStateException(\"upstream staging step failed to produce a path\", e);\n    }\n    throw e;\n}","preventionTips":["Treat a null/empty staging path from the ODPS export step as a hard failure of that step, not a load-phase problem.","Log the staging path right after the export step so failures are diagnosable.","Add existence checks on the staging directory before submitting LOAD DATA."],"tags":["adswriter","load-data","validation","odps"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}