Skip to content

Incorrect results: leaf expression pushdown duplicates volatile expressions (random() evaluated twice) #24678

Description

@fornwall

Describe the bug

enable_leaf_expression_pushdown inlines a column's defining expression into each extracted get_field that references it, but performs no volatility check.

To Reproduce

Run this:

datafusion-cli -c "SELECT s, s['a'] AS field FROM (SELECT named_struct('a', random()) AS s FROM generate_series(1,3));"

Expected behavior

field equals s.a on every row.

Additional context

Setting enable_leaf_expression_pushdown = false avoids the bug (makes field equals s.a on every row).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions