alibaba/DataX · error · IllegalArgumentException

切分份数不能小于1. 此处:expectSliceNumber=[%s].

Error message

切分份数不能小于1. 此处:expectSliceNumber=[%s].

What it means

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.

Source

Thrown at common/src/main/java/com/alibaba/datax/common/util/RangeSplitUtil.java:45

        }

        return result;
    }


    public static long[] doLongSplit(long left, long right, int expectSliceNumber) {
        BigInteger[] result = doBigIntegerSplit(BigInteger.valueOf(left),
                BigInteger.valueOf(right), expectSliceNumber);
        long[] returnResult = new long[result.length];
        for (int i = 0, len = result.length; i < len; i++) {
            returnResult[i] = result[i].longValue();
        }
        return returnResult;
    }

    public static BigInteger[] doBigIntegerSplit(BigInteger left, BigInteger right, int expectSliceNumber) {
        if (expectSliceNumber < 1) {
            throw new IllegalArgumentException(String.format(
                    "切分份数不能小于1. 此处:expectSliceNumber=[%s].", expectSliceNumber));
        }

        if (null == left || null == right) {
            throw new IllegalArgumentException(String.format(
                    "对 BigInteger 进行切分时,其左右区间不能为 null. 此处:left=[%s],right=[%s].", left, right));
        }

        if (left.compareTo(right) == 0) {
            return new BigInteger[]{left, right};
        } else {
            // 调整大小顺序,确保 left < right
            if (left.compareTo(right) > 0) {
                BigInteger temp = left;
                left = right;
                right = temp;
            }

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Set job.setting.speed.channel (or the analogous channel/parallelism setting) to at least 1.
  2. If you call the splitter directly, clamp: int n = Math.max(1, computedSlices).
  3. For very small tables, disable splitPk (remove the splitPk config) instead of forcing a 0-way split.

Example fix

// before
long[] points = RangeSplitUtil.doLongSplit(min, max, adviceSliceNumber);

// after
int slices = Math.max(1, adviceSliceNumber);
long[] points = RangeSplitUtil.doLongSplit(min, max, slices);
Defensive patterns

Strategy: validation

Validate before calling

int slices = Math.max(1, computedSliceNumber);
BigInteger[] points = RangeSplitUtil.doBigIntegerSplit(left, right, slices);

Try / catch

try {
    RangeSplitUtil.doBigIntegerSplit(left, right, n);
} catch (IllegalArgumentException e) {
    // fall back to single-task split
    return new BigInteger[]{left, right};
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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