Skip to content

Filter fails on groupby column #1320

@shcheklein

Description

@shcheklein

A query like this fails (at least on CH):

(
    dc
        .read_dataset("validator.errors")
        .distinct("file.path")
        .group_by(
            cnt=func.count(),
            files=func.collect("file.path"),
            partition_by=("session_id", "position")
        )
        # .persist() <---- workaround
        .filter(C("cnt") > 1)
        .save("validator.duplicate-positions")
)

with a error message:

clickhouse_driver.errors.ServerException: Code: 184.
DB::Exception: Aggregate function count(*) AS cnt is found in WHERE in query. Stack trace:

0. ./ci/tmp/build/./src/Common/Exception.cpp:117: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000dcad708
1. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x00000000092ed35c
2. DB::Exception::Exception<String, String&>(int, FormatStringHelperImpl<std::type_identity<String>::type, std::type_identity<String&>::type>, String&&, String&) @ 0x000000000a03221c

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions