-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix fcoalesce Date/IDate mixing and resolve test collisions (#7463) #7557
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
Open
aksh08022006
wants to merge
4
commits into
Rdatatable:master
Choose a base branch
from
aksh08022006:fix-fcoalesce-date-idate-7545
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
845dea3
Fix fcoalesce Date/IDate mixing and resolve test collisions (#7463)
aksh08022006 31e7544
Fix memory uninitialization and pointer mismatch in coalesce.c
aksh08022006 615bccd
Merge branch 'master' into fix-fcoalesce-date-idate-7545
aksh08022006 15578ad
Fix test suite failures and signature error
aksh08022006 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15628,8 +15628,8 @@ test(2060.202, fcoalesce(fkt), fkt) | |
| test(2060.203, fcoalesce(bool, 1L), error='Item 2 is type integer but the first item is type logical. Please coerce before coalescing') | ||
| test(2060.204, fcoalesce(bool, NA_integer_), error='Item 2 is type integer but the first item is type logical.') | ||
| test(2060.205, fcoalesce(fkt, 1L), error='Item 1 is a factor but item 2 is not a factor. When factors are involved, all items must be factor') | ||
| test(2060.206, fcoalesce(num, 3L), error='Item 2 is type integer but the first item is type double') | ||
| test(2060.207, fcoalesce(int, 3), error='Item 2 is type double but the first item is type integer') | ||
| test(2060.206, fcoalesce(num, 3L), num_val) | ||
| test(2060.207, fcoalesce(int, 3), num_val) | ||
| test(2060.208, fcoalesce(fkt, 'b'), error='Item 1 is a factor but item 2 is not a factor. When factors are involved, all items must be factor.') | ||
| test(2060.209, fcoalesce(str, factor('b')), error='Item 2 is a factor but item 1 is not a factor. When factors are involved, all items must be factor') | ||
| test(2060.212, fcoalesce(list(1), list(2)), error="The first argument is a list, data.table or data.frame. In this case there should be no other arguments provided.") | ||
|
|
@@ -15653,7 +15653,7 @@ if (test_bit64) { | |
| test(2060.302, as.character(fcoalesce(int64, as.integer64(NA), as.integer64(3))), as.character(int64_val)) | ||
| test(2060.303, as.character(fcoalesce(int64, as.integer64(rep(3, 4L)))), as.character(int64_val)) | ||
| test(2060.304, fcoalesce(int64, 1), error='Item 2 has a different class than item 1') | ||
| test(2060.305, fcoalesce(int64, 1L), error = 'Item 2 is type integer but the first item is type double') | ||
| test(2060.305, fcoalesce(int64, 1L), error = 'Item 2 has a different class than item 1.') | ||
| } | ||
| # 2060.401-405 tested nanotime moved to other.Rraw 23, #5516 | ||
| # setcoalesce | ||
|
|
@@ -20607,6 +20607,7 @@ test(2294.59, | |
| VDate = fifelse(VDate == as.Date("3000-01-01"), as.Date(NA), VDate), | ||
| VIDate = fifelse(VIDate == as.IDate("3000-01-01"), as.IDate(NA), VIDate), | ||
| VNumA, VNumB, Count, Y_Sum)]) | ||
|
|
||
| # 60. label is a scalar with class not matching any variable in 'by'. | ||
| test(2294.60, | ||
| groupingsets(DT1, .(Count = .N, Y_Sum = sum(Y)), | ||
|
|
@@ -21968,3 +21969,21 @@ test(2356.2, options=c(datatable.alloccol=1L), set(DT, j="c", value=3), data.tab | |
| # ensure := and set are consistent if they need to overallocate | ||
| DT = data.table(); DT2 = data.table() | ||
| test(2356.3, options=c(datatable.alloccol=1L), {for (i in seq(10L)) set(DT, j = sprintf("V%d",i), value = i); DT}, {for (i in seq(10)) DT2[, sprintf("V%d",i) := i]; DT2}) | ||
|
|
||
| # fcoalesce Date and IDate mixing, #7463 | ||
| test(2357.1, fcoalesce(as.Date("2026-01-01"), as.IDate("2026-01-02")), as.Date("2026-01-01")) | ||
| test(2357.2, { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please dont make tests super complicated. |
||
| res = fcoalesce(as.IDate("2026-01-02"), as.Date("2026-01-01")) | ||
| list(res, class(res)) | ||
| }, list(as.double(as.IDate("2026-01-02")), c("IDate", "Date"))) # promoted to double | ||
| test(2357.3, fcoalesce(1L, 2.0), 1.0) | ||
| test(2357.4, fcoalesce(2.0, 1L), 2.0) | ||
| test(2357.5, { | ||
| r = c(NA_real_, 2.0) | ||
| setcoalesce(r, 1L) | ||
| r | ||
| }, c(1.0, 2.0)) | ||
| test(2357.6, { | ||
| i = c(NA_integer_, 2L) | ||
| setcoalesce(i, 1.0) | ||
| }, error="In-place coalesce cannot promote integer to double") | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please no formatting changes.