Reproducer
Tested on Presto 0.297 (Docker image prestodb/presto:latest, digest sha256:7da6d257a4c879f61b5010feca9d73ff70b069935505edb2ecff435cbe486bf9).
CREATE TABLE t0(c0 DOUBLE);
INSERT INTO t0 VALUES (1.0), (2.0), (3.0);
SELECT CASE 1.0
WHEN if(MIN(true), -1, -1.0) THEN 1.0
WHEN coalesce(-c0, 1.0) THEN 1.0
END
FROM t0 GROUP BY c0;
Error
Query failed: java.lang.VerifyError: Bad type on operand stack
Exception Details:
Reason:
Type long_2nd (current frame, stack[1]) is not assignable to double_2nd
The issue appears to be in bytecode generation for CASE expressions where if() returns mixed integer/double types — the generated bytecode pushes a long where a double is expected on the operand stack.
Found by SQLancer.
Reproducer
Tested on Presto 0.297 (Docker image
prestodb/presto:latest, digestsha256:7da6d257a4c879f61b5010feca9d73ff70b069935505edb2ecff435cbe486bf9).Error
The issue appears to be in bytecode generation for
CASEexpressions whereif()returns mixed integer/double types — the generated bytecode pushes alongwhere adoubleis expected on the operand stack.Found by SQLancer.