{"record":{"id":"5e698e28d38f4f68","repo":"apache/seatunnel","slug":"string-range-split-requires-fixed-length-ascii-bou","errorCode":null,"errorMessage":"String range split requires fixed-length ASCII boundaries","messagePattern":"String range split requires fixed-length ASCII boundaries","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/AsciiStringRangeSplitter.java","lineNumber":39,"sourceCode":"\nfinal class AsciiStringRangeSplitter {\n\n    private static final int FIRST_PRINTABLE_ASCII = 32;\n    private static final int LAST_PRINTABLE_ASCII = 126;\n    private static final int RADIX = LAST_PRINTABLE_ASCII - FIRST_PRINTABLE_ASCII + 1;\n\n    private AsciiStringRangeSplitter() {}\n\n    // This mapping is order-preserving only for fixed-length printable ASCII strings under a\n    // binary collation. Other shapes must be rejected and handled by hash or single splitting.\n    static String[] split(String left, String right, int expectSliceNumber) {\n        if (left == null || right == null) {\n            throw new IllegalArgumentException(\"String range boundary cannot be null\");\n        }\n        validateRangeBoundary(left, \"left\");\n        validateRangeBoundary(right, \"right\");\n        if (left.length() != right.length()) {\n            throw new IllegalArgumentException(\n                    \"String range split requires fixed-length ASCII boundaries\");\n        }\n        if (left.equals(right)) {\n            return new String[] {left, right};\n        }\n        if (left.compareTo(right) > 0) {\n            throw new IllegalArgumentException(\n                    String.format(\n                            \"String range left boundary [%s] must not be greater than right boundary [%s]\",\n                            left, right));\n        }\n\n        BigInteger[] splitValues =\n                splitBigInteger(\n                        stringToBigInteger(left), stringToBigInteger(right), expectSliceNumber);\n        String[] result = new String[splitValues.length];\n        result[0] = left;\n        result[splitValues.length - 1] = right;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/AsciiStringRangeSplitter.java#L21-L57","documentation":"AsciiStringRangeSplitter.split computes numeric splits over string range boundaries by treating them as fixed-length ASCII values. Both boundaries must have exactly the same length; otherwise positional numeric splitting is impossible, so it throws IllegalArgumentException with this message.","triggerScenarios":"Calling split(left, right) where left.length() != right.length(), e.g. split key range from 'A' to 'ABC', typically derived from query-based or string-column split boundaries.","commonSituations":"String split columns with variable-length data (names, codes) whose min/max differ in length; manually specifying string split ranges in source config.","solutions":["Use boundaries of equal length (e.g. pad the shorter one with low-value characters like 'A' or '0' consistent with your data).","Choose a different split key (numeric or fixed-length CHAR column).","Reduce the range so both ends share a fixed prefix length, or fall back to a single split for that table."],"exampleFix":"// before\nsplitter.split(\"A\", \"ABC\");\n// after\nsplitter.split(\"AAA\", \"ABC\");","handlingStrategy":"validation","validationCode":"if (left == null || right == null || left.length() != right.length()) {\n  throw new IllegalArgumentException(\"boundaries must be equal-length strings\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pad boundaries to equal length before splitting","Prefer numeric or fixed-length CHAR columns as split keys","Clamp ranges to a common fixed prefix length"],"tags":["jdbc","splitter","string-range","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}