Skip to content
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

[cbindlist/mergelist] Add ERR to the mult enum in bmerge.c #6432

Open
wants to merge 2 commits into
base: cbind-merge-list-prep
Choose a base branch
from

Conversation

MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Aug 29, 2024

Towards #4370. Support for this value of mult is required by mergepair() later; not actually exposed to use here, so ignoring codecov report. To be tested later.

Copy link
Member Author

MichaelChirico commented Aug 29, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

github-actions bot commented Aug 29, 2024

Comparison Plot

Generated via commit 7342791

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 3 minutes and 26 seconds
Installing different package versions 7 minutes and 2 seconds
Running and plotting the test cases 2 minutes and 5 seconds

@MichaelChirico
Copy link
Member Author

@jangorecki is there any user-facing change in this PR? Should it get its own NEWS item/tests directly of [ behavior?

@jangorecki
Copy link
Member

Yes new.supported value for mult sounds like user facing change

@MichaelChirico
Copy link
Member Author

OK thanks. Please add NEWS, I think it should get direct tests in tests.Rraw besides what's done implicitly in mergelist.Rraw, too.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 98.61%. Comparing base (01233bf) to head (7342791).

Files with missing lines Patch % Lines
src/bmerge.c 50.00% 2 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##           cbind-merge-list-prep    #6432      +/-   ##
=========================================================
- Coverage                  98.62%   98.61%   -0.02%     
=========================================================
  Files                         79       79              
  Lines                      14472    14474       +2     
=========================================================
  Hits                       14273    14273              
- Misses                       199      201       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichaelChirico
Copy link
Member Author

MichaelChirico commented Oct 1, 2024

@jangorecki I'm confused, how is this actually supposed to work?

DT1=data.table(a=1, b=2)
DT2=data.table(a=1, c=3:4)
DT1[DT2, on=.(a >= a), mult='error']
# Error in bmerge(i, x, leftcols, rightcols, roll, rollends, nomatch, mult,  : 
#   Internal error in nestedid: invalid value for 'mult'. Please report to the data.table issues tracker.

That's from:

nqgrp = .Call(Cnestedid, x, xcols[non_equi:length(xcols)], xo, xg, resetlen, mult)

So it looks like we don't actually have support for mult="error" inside [.data.table in this PR chain?

I used on=.(a>=a) to induce a non-equi join based on how bmerge.c is actually changed here for mult=ERR:

data.table/src/bmerge.c

Lines 405 to 440 in 7419796

// non-equi join
for (int j=ilow+1; j<iupp; j++) {
const int k = o ? o[j]-1 : j;
if (retFirst[k] != nomatch) {
if (mult == ALL) {
// for this irow, we've matches on more than one group
allGrp1[0] = FALSE;
retFirst[ctr+ilen] = xlow+2;
retLength[ctr+ilen] = len;
retIndex[ctr+ilen] = k+1;
++ctr;
if (ctr+ilen >= anslen) {
anslen = 1.1*anslen;
retFirst = R_Realloc(retFirst, anslen, int); // if fails, it fails inside R_Realloc with R error
retLength = R_Realloc(retLength, anslen, int);
retIndex = R_Realloc(retIndex, anslen, int);
}
} else if (mult == FIRST) {
retFirst[k] = (XIND(retFirst[k]-1) > XIND(xlow+1)) ? xlow+2 : retFirst[k];
retLength[k] = 1;
} else {
retFirst[k] = (XIND(retFirst[k]-1) < XIND(xupp-1)) ? xupp : retFirst[k];
retLength[k] = 1;
}
} else {
// none of the groups so far have filled in for this index. So use it!
if (mult == ALL) {
retFirst[k] = xlow+2;
retLength[k] = len;
retIndex[k] = k+1;
// no need to increment ctr of course
} else {
retFirst[k] = (mult == FIRST) ? xlow+2 : xupp;
retLength[k] = 1;
}
}

Do we actually need to expose mult="error" through [? It looks like mergelist() only needs bmerge() to support it, not [.

@jangorecki
Copy link
Member

Firstly I would check what is the output of the original branch so rule out issues related to conflicts resolution. But afair this PR was not meant to change [ yet, only provide new functions.

@MichaelChirico
Copy link
Member Author

Yea, I get the same error at the end of the chain (#4370). So I think we should not make the change to data.table.R here.

add cbind by reference, timing

R prototype of mergelist

wording

use lower overhead funs

stick to int32 for now, correct R_alloc

bmerge C refactor for codecov and one loop for speed

address revealed codecov gaps

refactor vecseq for codecov

seqexp helper, some alloccol export on C

bmerge codecov, types handled in R bmerge already

better comment seqexp

bmerge mult=error #655

multiple new C utils

swap if branches

explain new C utils

comments mostly

reduce conflicts to PR #4386

comment C code

address multiple matches during update-on-join #3747

Revert "address multiple matches during update-on-join #3747"

This reverts commit b64c0c3.

merge.dt has temporarily mult arg, for testing

minor changes to cbindlist c

dev mergelist, for single pair now

add quiet option to cc()

mergelist tests

add check for names to perhaps.dt

rm mult from merge.dt method

rework, clean, polish multer, fix righ and full joins

make full join symmetric

mergepair inner function to loop on

extra check for symmetric

mergelist manual

ensure no df-dt passed where list expected

comments and manual

handle 0 cols tables

more tests

more tests and debugging

move more logic closer to bmerge, simplify mergepair

more tests

revert not used changes

reduce not needed checks, cleanup

copy arg behavior, manual, no tests yet

cbindlist manual, export both

cleanup processing bmerge to dtmatch

test function match order for easier preview

vecseq gets short-circuit

batch test allow browser

big cleanup

remmove unneeded stuff, reduce diff

more cleanup, minor manual fixes

add proper test scripts

Merge branch 'master' into cbind-merge-list

comment out not used code for coverage

more tests, some nocopy opts

rename sql test script, should fix codecov

simplify dtmatch inner branch

more precise copy, now copy only T or F

unused arg not yet in api, wording

comments and refer issues

codecov

hasindex coverage

codecov gap

tests for join using key, cols argument

fix missing import forderv

more tests, improve missing on handling

more tests for order of inner and full join for long keys

new allow.cartesian option, #4383, #914

reduce diff, improve codecov

reduce diff, comments

need more DT, not lists, mergelist 3+ tbls

proper escape heavy check

unit tests

more tests, address overalloc failure

mergelist and cbindlist retain index

manual, examples

fix manual

minor clarify in manual

retain keys, right outer join for snowflake schema joins

duplicates in cbindlist

recycling in cbindlist

escape 0 input in copyCols

empty input handling

closing cbindlist

vectorized _on_ and _join.many_ arg

rename dtmatch to dtmerge

vectorized args: how, mult
push down input validation
add support for cross join, semi join, anti join

full join, reduce overhead for mult=error

mult default value dynamic

fix manual

add "see details" to Rd

mention shared on in arg description

amend feedback from Michael

semi and anti joins will not reorder x columns

Merge branch 'master' into cbind-merge-list

spelling, thx to @jan-glx

check all new funs used and add comments

bugfix, sort=T needed for now

Merge branch 'master' into cbind-merge-list

Update NEWS.md

Merge branch 'master' into cbind-merge-list

Merge branch 'master' into cbind-merge-list

NEWS placement

numbering

ascArg->order

Merge remote-tracking branch 'origin/cbind-merge-list' into cbind-merge-list

attempt to restore from master

Update to stopf() error style

Need isFrame for now

More quality checks: any(!x)->!all(x); use vapply_1{b,c,i}

really restore from master

try to PROTECT() before duplicate()

update error message in test

appease the rchk gods

extraneous space

missing ';'

use catf

simplify perhapsDataTableR

move sqlite.Rraw.manual into other.Rraw

simplify for loop

Merge remote-tracking branch 'origin/cbind-merge-list' into cbind-merge-list
@MichaelChirico MichaelChirico changed the title [cbindlist/mergelist] Support mult="error" [cbindlist/mergelist] Add ERR to the mult enum in bmerge.c Oct 1, 2024
@MichaelChirico
Copy link
Member Author

OK, this PR is G2G.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
graphite-ready PRs that are managed by Graphite, possibly marked as draft, but ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants