Skip to content

problem joining with character(0) #847

@tvr101

Description

@tvr101

I recently upgraded to 1.9.2 and encountered the following issue. Previously this returned an empty data.table as I had expected (and desired), but now returns an error:

x <- data.table(a=character(0), b=character(0), c=numeric(0))
setkey(x, a, b)

x[J("foo", character(0)), nomatch=0]
Error in if (mn%%n[i] != 0) warning("Item ", i, " is of size ", n[i],  : 
  missing value where TRUE/FALSE needed

x[J(character(0), "foo"),nomatch=0]
Error in if (mn%%n[i] != 0) warning("Item ", i, " is of size ", n[i],  : 
  missing value where TRUE/FALSE needed

if there is only one key then this seems to behave as before

x <- data.table(a=character(0), b=character(0), c=numeric(0))
setkey(x, a)
x[J(character(0)),nomatch=0]
Empty data.table (0 rows) of 3 cols: a,b,c

is this expected with the new release? in my actual usage character(0) is a value held by another variable and that variable is used to search inside the data.table - is it user's responsibility to now check and avoid searching with empty character vectors?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions