prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
15.92k stars 5.33k forks source link

Query fail with error `failed: at index 1` #23613

Open malwaregarry opened 1 week ago

malwaregarry commented 1 week ago

Your Environment

Expected Behavior

Should return true or provide a more meaningful error message

Current Behavior

returns error Query 20240910_100645_00342_v3b4v failed: at index 1

Possible Solution

Steps to Reproduce

The select query returns an error:

select (CASE (CASE true WHEN (true) THEN (true) ELSE coalesce((false = ANY (VALUES true)), (true)) END ) WHEN false THEN true END );

The subquery returns true:

select CASE true WHEN (true) THEN (true) ELSE coalesce((false = ANY (VALUES true)), (true)) END ;

Changing false = ANY (VALUES true)), false also results in no errors:

select (CASE (CASE true WHEN (true) THEN (true) ELSE coalesce((false), (true)) END ) WHEN false THEN true END );

Screenshots (if appropriate)

Context

Test case generated from SQLancer

tdcmeehan commented 1 week ago

@malwaregarry Did you post the right failure query? I am unable to reproduce, and I think all 3 queries you posted are identical.

malwaregarry commented 1 week ago

@tdcmeehan sorry the 2nd and 3rd queries were incorrect, but the first one should cause an error.

This is the command I used to start presto docker run -p 8080:8080 -d -v ./memory.properties:/opt/presto-server/etc/catalog/memory.properties --name presto prestodb/presto:0.288

with the memory.property file having:

connector.name=memory
memory.max-data-per-node=128MB
tdcmeehan commented 1 week ago

23629 fixes this. Thanks for the report @malwaregarry!