Skip to content

SQL planner allows HAVING clause in non-aggregate queries #2460

@andygrove

Description

@andygrove

Describe the bug
DataFusion currently supports the HAVING clause in non-aggregate queries, as demonstrated in this test:

#[test]
fn select_with_having() {
    let sql = "SELECT id, age
               FROM person
               HAVING age > 100 AND age < 200";
    let expected = "Projection: #person.id, #person.age\
                    \n  Filter: #person.age > Int64(100) AND #person.age < Int64(200)\
                    \n    TableScan: person projection=None";
    quick_test(sql, expected);
}

To Reproduce
N/A

Expected behavior
Neither Postgres nor Spark support this use case. We should fail to plan non-aggregate queries that use a HAVING clause.

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions