MyCATApache/Mycat-Server · error · IllegalArgumentException

columnValue: Please eliminate any quote and non number…

Error message

columnValue:{columnValue} Please eliminate any quote and non number within it.

What it means

PartitionByLong.calculate() parses the column value with Long.parseLong() to compute the partition via a long-range partition utility. On NumberFormatException it throws this IllegalArgumentException telling you to remove quotes and non-numeric characters. Only 64-bit-range integer strings are accepted.

Solutions

  1. Send the column value as a plain integer string within Long range (no quotes, commas, or spaces).
  2. Re-enable NumberParseUtil.eliminateQoute(columnValue) in calculate() if quoted data is expected.
  3. Clean the data at the application/ETL layer before insert; use a Long-parseable type for the column.

Example fix

// before (in PartitionByLong.calculate)
// columnValue = NumberParseUtil.eliminateQoute(columnValue);
long key = Long.parseLong(columnValue);
// after
columnValue = NumberParseUtil.eliminateQoute(columnValue);
long key = Long.parseLong(columnValue);
Defensive patterns

Strategy: validation

Validate before calling

boolean ok;
try { Long.parseLong(columnValue.trim()); ok = true; }
catch (NumberFormatException e) { ok = false; }

Try / catch

try {
    Integer node = partitionByLong.calculate(columnValue);
} catch (IllegalArgumentException e) {
    // value not Long-parseable: log and reject or sanitize (strip quotes) then retry
}

Prevention

When it happens

Trigger: Routing a row whose integer-partition column is non-numeric, quoted (e.g. "123"), exceeds Long range, is empty, or contains separators like commas or spaces; note the quote-elimination call is commented out in this version.

Common situations: Applications sending numbers as quoted strings; values with thousands separators ('1,000,000'); float strings ('3.14') or very long ids beyond Long.MAX_VALUE.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11). Data as JSON: /api/errors/f35d7a05840cf57b. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/io/mycat/route/function/PartitionByLong.java:65

	public void setPartitionLength(String partitionLength) {
		this.length = toIntArray(partitionLength);
	}

	@Override
	public void init() {
		partitionUtil = new PartitionUtil(count, length);

	}

	@Override
	public Integer calculate(String columnValue)  {
//		columnValue = NumberParseUtil.eliminateQoute(columnValue);
		try {
			long key = Long.parseLong(columnValue);
			key = (key >>> 32) ^ key;
			return partitionUtil.partition(key);
		} catch (NumberFormatException e){
			throw new IllegalArgumentException(new StringBuilder().append("columnValue:").append(columnValue).append(" Please eliminate any quote and non number within it.").toString(),e);
		}
	}
	
	@Override
	public Integer[] calculateRange(String beginValue, String endValue)  {
		return AbstractPartitionAlgorithm.calculateSequenceRange(this, beginValue, endValue);
	}

//	@Override
//	public int getPartitionCount() {
//		int nPartition = 0;
//		for(int i = 0; i < count.length; i++) {
//			nPartition += count[i];
//		}
//		return nPartition;
//	}
	
}

View on GitHub (pinned to 65f8d8beb7)