Skip to content

Grouping and filtering using is.na yields error. #1128

@lschneiderbauer

Description

@lschneiderbauer

I am using the current development version of dbplyr.

Using filter with is.na yields in the following error:

library(dplyr, warn.conflicts = FALSE)
library(dbplyr, warn.conflicts = FALSE)

table <- tbl_lazy(tibble(col1 = c(1,2), col2 = c(1,2)), dbplyr::simulate_hana())

table %>%
  group_by(col2) %>%
  summarize(
    test = sum(col1, na.rm = TRUE),
    .groups = "drop"
  ) %>%
  filter(!is.na(test))
#> Error in eval_tidy(x, env = env): Objekt 'col1' nicht gefunden

Created on 2023-02-06 with reprex v2.0.2

In contrast, using some other filter is working:

library(dplyr, warn.conflicts = FALSE)
library(dbplyr, warn.conflicts = FALSE)

table <- tbl_lazy(tibble(col1 = c(1,2), col2 = c(1,2)), dbplyr::simulate_hana())

table %>%
  group_by(col2) %>%
  summarize(
    test = sum(col1, na.rm = TRUE),
    .groups = "drop"
  ) %>%
  filter(test == "something else")
#> <SQL>
#> SELECT `col2`, SUM(`col1`) AS `test`
#> FROM `df`
#> GROUP BY `col2`
#> HAVING (SUM(`col1`) = 'something else')

Created on 2023-02-06 with reprex v2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions