Skip to content

Compiler failed with complex CASE expression using SOME comparison #27609

@mrigger

Description

@mrigger

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 ((c0 + (-(-(CASE (-1755118259) WHEN c0 THEN c0 WHEN 0.524 THEN c0 ELSE 0.265 END)))) = SOME (VALUES 1658.0000, 5775.0000))
  WHEN true THEN (TIMESTAMP '1988-10-10 12:33:56' IN (TIMESTAMP '2008-08-17 04:57:25'))
  WHEN true THEN (NOT false)
  ELSE (('test') LIKE (''))
END
FROM t0;

Error

Query failed: Compiler failed

The issue appears to be in Presto's bytecode generation when compiling a CASE expression whose operand involves a SOME quantified comparison with mixed numeric types in the inner CASE.

Found by SQLancer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions