Skip to content

Filter with an error-throwing function getting incorrectly reordered #16104

@marcoslot

Description

@marcoslot

What happens?

Simple where abs(col_double) < 1 and acos(col_double) > 0 expressions can throw an error as of 1.2.0 because the filters might get reordered with acos being executed first while the abs expression is guarding against acos errors.

To Reproduce

copy (select random() * 2 col_double from generate_series(1,100)) to '/tmp/r.parquet';
select * from (select * from  '/tmp/r.parquet') where abs(col_double) < 1 and acos(col_double) > 0;

On 1.1.3:

┌──────────────────────┐
│      col_double      │
│        double        │
├──────────────────────┤
│  0.19490873625576743 │
│   0.9895238863469309 │  
...

On 1.2.0:

Invalid Input Error:
ACOS is undefined outside [-1,1]

OS:

Ubuntu 22.04

DuckDB Version:

1.2.0

DuckDB Client:

CLI

Hardware:

No response

Full Name:

Marco Slot

Affiliation:

Crunchy Data

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions