Skip to content

Commit

Permalink
Embellished list column error and added news item (#3429)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdowle committed Feb 26, 2019
1 parent 36c57d8 commit c613ff9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@

10. `foverlaps` provides better error messages when one interval is POSIXct and other isn't. Also, it warns when POSIXct interval columns are not all of same timezone. Closes [#1143](https://github.com/Rdatatable/data.table/issues/1143). Thanks to @DavidArenburg for the report.

11. From v1.12.0, `unique(DT)` checks up-front the types of all the columns and will fail if any column is type `list`. Use `unique(DT, by=...)` to specify columns that are not type `list`. v1.11.8 and before would also correctly fail with the same error, but not when uniqueness had been established in prior columns (it would stop early and not look at the `list` column). Checking up-front was necessary for some internal optimizations and it's probably best to be explicit anyway. Thanks to James Lamb for reporting, [#3332](https://github.com/Rdatatable/data.table/issues/3332). The error message has been embellished :
```
Column 2 of by= (2) is type 'list', not yet supported. Please use the by= argument to specify columns with types that are supported.
```


### Changes in v1.12.0 (13 Jan 2019)

Expand Down
2 changes: 1 addition & 1 deletion inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -4359,7 +4359,7 @@ test(1251.9, DT[base::order(x, list(-y), decreasing=TRUE)],
# more "edge cases" to ensure we're consistent with base
test(1251.11, DT[order("a")], DT[1L])
test(1251.12, DT[order("b", "a")], DT[1L])
test(1251.13, DT[order(list("b", "a"))], error = "Column 1 of by= (1) is type 'list', not yet supported")
test(1251.13, DT[order(list("b", "a"))], error = "Column 1 of by= [(]1[)] is type 'list', not yet supported. Please use the by=.*that are supported")
test(1251.14, DT[order(list("b"), list("a"))], DT[1L])

##############################################################
Expand Down
3 changes: 2 additions & 1 deletion src/forder.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,8 @@ SEXP forder(SEXP DT, SEXP by, SEXP retGrpArg, SEXP sortGroupsArg, SEXP ascArg, S
range_str(STRING_PTR(x), nrow, &min, &max, &na_count);
break;
default:
Error("Column %d of by= (%d) is type '%s', not yet supported", col+1, INTEGER(by)[col], type2char(TYPEOF(x)));
Error("Column %d of by= (%d) is type '%s', not yet supported. Please use the by= argument to specify columns with types that are supported. See NEWS item in v1.12.2 for more information.",
col+1, INTEGER(by)[col], type2char(TYPEOF(x)));
}
TEND(3);
if (na_count==nrow || (min>0 && min==max && na_count==0 && infnan_count==0)) {
Expand Down

0 comments on commit c613ff9

Please sign in to comment.