Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
3.0.3
-
None
Description
The SQL below works with Mariadb driver 2.7.3. Using drivers 3.0.3 or 3.0.4, java.lang.ArrayIndexOutOfBoundsException occurs.
SELECT
`SNO`,
`PNO`,
CUME_DIST()
OVER(
PARTITION BY
`SNO`,
`PNO`
ORDER BY
CASE
WHEN `QTY` IS NULL THEN 1
ELSE 0
END,
`QTY` ASC
)
FROM
`TSUPPLY`
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 348
The issue seems to be with partition by because the SQL below(no partition by clause) does not fail
SELECT
`SNO`,
`PNO`,
CUME_DIST()
OVER(
ORDER BY
CASE
WHEN `QTY` IS NULL THEN 1
ELSE 0
END,
`QTY` ASC
)
FROM
`TSUPPLY`
Info for table TSUPPLY
CREATE TABLE IF NOT EXISTS `tsupply` (
`RNUM` int(11) NOT NULL,
`SNO` varchar(2) DEFAULT NULL,
`PNO` varchar(2) DEFAULT NULL,
`JNO` varchar(2) DEFAULT NULL,
`QTY` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tsupply` (`RNUM`, `SNO`, `PNO`, `JNO`, `QTY`) VALUES
(0, 'S1', 'P1', 'J1', 200),
(1, 'S1', 'P1', 'J4', 700),
(2, 'S2', 'P3', 'J1', 400),
(3, 'S2', 'P3', 'J2', 200),
(4, 'S2', 'P3', 'J3', 200),
(5, 'S2', 'P3', 'J4', 500),
(6, 'S2', 'P3', 'J5', 600),
(7, 'S2', 'P3', 'J6', 400),
(8, 'S2', 'P3', 'J7', 800),
(9, 'S2', 'P5', 'J2', 100),
(10, 'S3', 'P3', 'J1', 200),
(11, 'S3', 'P4', 'J2', 500),
(12, 'S4', 'P6', 'J3', 300),
(13, 'S4', 'P6', 'J7', 300),
(14, 'S5', 'P2', 'J2', 200),
(15, 'S5', 'P2', 'J4', 100),
(16, 'S5', 'P5', 'J5', 500),
(17, 'S5', 'P5', 'J7', 100),
(18, 'S5', 'P6', 'J2', 200),
(19, 'S5', 'P1', 'J4', 100),
(20, 'S5', 'P3', 'J4', 200),
(21, 'S5', 'P4', 'J4', 800),
(22, 'S5', 'P5', 'J4', 400),
(23, 'S5', 'P6', 'J4', 500);
Attachments
Issue Links
- duplicates
-
CONJ-956 ArrayIndexOutOfBoundsException when alias length > 250
- Closed