{"record":{"id":"2016ddbf0e397508","repo":"alibaba/DataX","slug":"1-expectslicenumber-s","errorCode":null,"errorMessage":"切分份数不能小于1. 此处:expectSliceNumber=[%s].","messagePattern":"切分份数不能小于1\\. 此处:expectSliceNumber=\\[(.+?)\\]\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/com/alibaba/datax/common/util/RangeSplitUtil.java","lineNumber":45,"sourceCode":"        }\n\n        return result;\n    }\n\n\n    public static long[] doLongSplit(long left, long right, int expectSliceNumber) {\n        BigInteger[] result = doBigIntegerSplit(BigInteger.valueOf(left),\n                BigInteger.valueOf(right), expectSliceNumber);\n        long[] returnResult = new long[result.length];\n        for (int i = 0, len = result.length; i < len; i++) {\n            returnResult[i] = result[i].longValue();\n        }\n        return returnResult;\n    }\n\n    public static BigInteger[] doBigIntegerSplit(BigInteger left, BigInteger right, int expectSliceNumber) {\n        if (expectSliceNumber < 1) {\n            throw new IllegalArgumentException(String.format(\n                    \"切分份数不能小于1. 此处:expectSliceNumber=[%s].\", expectSliceNumber));\n        }\n\n        if (null == left || null == right) {\n            throw new IllegalArgumentException(String.format(\n                    \"对 BigInteger 进行切分时，其左右区间不能为 null. 此处:left=[%s],right=[%s].\", left, right));\n        }\n\n        if (left.compareTo(right) == 0) {\n            return new BigInteger[]{left, right};\n        } else {\n            // 调整大小顺序，确保 left < right\n            if (left.compareTo(right) > 0) {\n                BigInteger temp = left;\n                left = right;\n                right = temp;\n            }\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/common/src/main/java/com/alibaba/datax/common/util/RangeSplitUtil.java#L27-L63","documentation":"RangeSplitUtil.doBigIntegerSplit (and its long wrapper doLongSplit) requires expectSliceNumber >= 1; a smaller value throws IllegalArgumentException. This utility chops a numeric range into N sub-ranges for splitPk parallelism, so a slice count of 0 or negative is meaningless.","triggerScenarios":"Passing expectSliceNumber < 1. In DataX this value is usually derived from channel count / table count / adviceNum; if the job is configured with 0 channels or a computation rounds down to 0, the split step throws this.","commonSituations":"Setting job.setting.speed.channel to 0, or a plugin computing slices as (records / batchSize) that evaluates to 0 for tiny tables while splitPk is still enabled.","solutions":["Set job.setting.speed.channel (or the analogous channel/parallelism setting) to at least 1.","If you call the splitter directly, clamp: int n = Math.max(1, computedSlices).","For very small tables, disable splitPk (remove the splitPk config) instead of forcing a 0-way split."],"exampleFix":"// before\nlong[] points = RangeSplitUtil.doLongSplit(min, max, adviceSliceNumber);\n\n// after\nint slices = Math.max(1, adviceSliceNumber);\nlong[] points = RangeSplitUtil.doLongSplit(min, max, slices);","handlingStrategy":"validation","validationCode":"int slices = Math.max(1, computedSliceNumber);\nBigInteger[] points = RangeSplitUtil.doBigIntegerSplit(left, right, slices);","typeGuard":null,"tryCatchPattern":"try {\n    RangeSplitUtil.doBigIntegerSplit(left, right, n);\n} catch (IllegalArgumentException e) {\n    // fall back to single-task split\n    return new BigInteger[]{left, right};\n}","preventionTips":["Never configure 0 channels when splitPk is enabled.","Clamp computed slice counts to >= 1 at the call site."],"tags":["datax","split","parallelism","validation"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}