Skip to content

Can't mutate over a chain of three or more new columns over sql backends #3095

@javierluraschi

Description

@javierluraschi

Mutating over a chain of two new columns works as expected:

memdb_frame(a = 1) %>% mutate(a2 = a, a3 = a2)
# Source:   lazy query [?? x 3]
# Database: sqlite 3.19.3 [:memory:]
      a    a2    a3
  <dbl> <dbl> <dbl>
1     1     1     1

However, three or more does not work for sql backends:

memdb_frame(a = 1) %>% mutate(a2 = a, a3 = a2, a4 = a3)
Error in rsqlite_send_query(conn@ptr, statement) : no such column: a3

This one is particularly important for sparklyr since this was supported in sparklyr 0.5 with a custom override and a user already contacted me pointing out their code is broken after upgrading to sparklyr 0.6 and dplyr 0.7, the workaround is to split as in:

memdb_frame(a = 1) %>% mutate(a2 = a, a3 = a2) %>% mutate (a4 = a3)

Related to #2483

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions