Skip to content

Feature request: n_distinct() implementation w/ multiple arguments. #110

@lschneiderbauer

Description

@lschneiderbauer

Hi,

I understand that n_distinct() with multiple arguments is not supported for a generic dbplyr backend since SQL does not support that out of the box.

Is it possible to implement it in the case of duckdb using structs?

For example:

dbplyr::tbl_lazy(data.frame(x = 1, y = 1), duckdb::simulate_duckdb()) |>
summarize(l = n_distinct(x, y))

could be translated to

<SQL>
SELECT COUNT(DISTINCT {'x' : `x`, 'y' : `y`}) AS `l`
FROM `df`

which executes on duckdb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions