-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: avoid NULL if no fks after disentangle #1012
Conversation
actually |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Could this be considered a bug in vctrs?
Should we fix |
Good point about the vctrs requirements that are not actually met. I'll try to make a reprex for a potential issue there, let's see |
Scratch that, I'm now pretty sure it's the correct vctrs behavior. |
hm, ok, I'd have this here, but it is true that vctrs couldn't necessarily avoid that: suppressPackageStartupMessages({
library(vctrs)
library(tibble)
library(dplyr)
})
a <- tibble(col_a = 1:3)
b <- tibble(col_a = 2:4, col_b = as_list_of(as.list(1:3)))
join_res <- left_join(a, b, by = "col_a")
join_res
#> # A tibble: 3 × 2
#> col_a col_b
#> <int> <list<int>>
#> 1 1
#> 2 2 [1]
#> 3 3 [1]
join_res$col_b
#> <list_of<integer>[3]>
#> [[1]]
#> NULL
#>
#> [[2]]
#> [1] 1
#>
#> [[3]]
#> [1] 2 Created on 2022-06-02 by the reprex package (v2.0.1.9000) Ok, I'll leave it at that |
|
Do you think vctrs could give a warning/message that a join might result in NULL entries in columns which are otherwise strictly controlled regarding the class? (guess that would require a change in dplyr rather than in vctrs) |
Thanks! |
Regarding library(vctrs)
as_list_of(list(1L, NULL))
#> <list_of<integer>[2]>
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> NULL
as_list_of(list(1L, NA))
#> <list_of<integer>[2]>
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] NA
as_list_of(list(1L, "2"))
#> Error in `list_of()`:
#> ! Can't combine `..1` <integer> and `..2` <character>. Created on 2022-06-03 by the reprex package (v2.0.1) |
NULL appears in
def$fks
, need to avoid, otherwise something like this fails (and in general no valid dm is produced):