Skip to content

Improved verbose messages in rolling functions frolladaptivefun and frollfun#7733

Open
Omartech312 wants to merge 4 commits intoRdatatable:masterfrom
kkarissa:master
Open

Improved verbose messages in rolling functions frolladaptivefun and frollfun#7733
Omartech312 wants to merge 4 commits intoRdatatable:masterfrom
kkarissa:master

Conversation

@Omartech312
Copy link
Copy Markdown

Closes #7021.

Previously, the frolladaptivefun and rfollfun algo verbose messages were not super user friendly, displaying messages like:

frolladaptivefun: algo 0 not implemented, fall back to 1

The wanted adjustment was for it to instead produce:

frolladaptivefun: algo fast not implemented, fall back to exact

There was also:
frollfun: processing fun 0 algo 0 took...

and the desired result was instead:
frollfun: processing fun mean algo fast took...

We adjusted for the desired functionality by creating an array of strings called rfunNames, using the rfun enum as an index to select the proper display type for the running function and then displaying fast or exact dependent on the value of value (0 for fast, 1 for exact).

Here is an example of the current output (from running tests) with the changed files in this PR:
frolladaptivefun: processing fun MIN algo exact took 0.000s
frolladaptivefun: algo fast not implemented, fall back to exact

We have additionally adjusted the NEWS.md file and the corresponding tests in inst/tests/froll.Rraw.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.04%. Comparing base (da0d15e) to head (f033f91).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7733   +/-   ##
=======================================
  Coverage   99.04%   99.04%           
=======================================
  Files          87       87           
  Lines       17058    17072   +14     
=======================================
+ Hits        16895    16909   +14     
  Misses        163      163           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@jangorecki jangorecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach is good, just some comments to make it cleaner.

Comment thread inst/tests/froll.Rraw
"frollfun: processing fun MEAN algo fast took.*",
"frollfunR: processing.*took.*"
), warning="has.nf=FALSE used but non-finite values are present in input, use default has.nf=NA to avoid this warning")
), warning="has.nf=FALSE used but non-finite values are present in input, use default has.nf=NA to avoid this warning") #7021
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line changed?

Comment thread inst/tests/froll.Rraw
"frollfun: processing fun MEAN algo fast took.*",
"frollfunR: processing.*took.*"
))
)) #7021
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can safely skip issue markers in already existing tests

Comment thread src/froll.c
if (verbose)
char rfunStr[7];

const char *rfunNames[] = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it make sense to define it once at compile time rather than inside frollrun function at runtime.

Comment thread src/frolladaptive.c
char rfunStr[7];

// enum ordered based from the file src/data.table.h
const char *rfunNames[] = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, if we will move it to data.table.h then we need to only declare it once

Comment thread src/froll.c
if (verbose)
snprintf(end(ans->message[0]), 500, _("%s: processing fun %d algo %u took %.3fs\n"), __func__, rfun, algo, omp_get_wtime()-tic);
if (verbose) {
if(algo == 0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go with ternary if operator, will be much smaller change

Comment thread src/frolladaptive.c
//frolladaptivemaxFast(x, nx, ans, k, fill, narm, hasnf, verbose); // frolladaptivemaxFast does not exists as of now
snprintf(end(ans->message[0]), 500, _("%s: algo %u not implemented, fall back to %u\n"), __func__, algo, (unsigned int) 1);
snprintf(end(ans->message[0]), 500, _("%s: algo fast not implemented, fall back to exact\n"), __func__);
algo = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line needed/used? It wasn't there before, if it is not needed/used, then we could still have it, but then better commented out with a comment that it is not used.

Comment thread src/frolladaptive.c
//frolladaptiveminFast(x, nx, ans, k, fill, narm, hasnf, verbose); // frolladaptiveminFast does not exists as of now
snprintf(end(ans->message[0]), 500, _("%s: algo %u not implemented, fall back to %u\n"), __func__, algo, (unsigned int) 1);
snprintf(end(ans->message[0]), 500, _("%s: algo fast not implemented, fall back to exact\n"), __func__);
algo = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Comment thread src/frolladaptive.c
if (verbose)
snprintf(end(ans->message[0]), 500, _("%s: processing fun %d algo %u took %.3fs\n"), __func__, rfun, algo, omp_get_wtime()-tic);
if (verbose) {
if(algo == 0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternary if

Comment thread src/frolladaptive.c
}
free(xx);
}
} No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be reverted

Comment thread NEWS.md

5. `tables()` can now optionally report `data.table` objects stored one level deep inside list objects when `depth=1L`, [#2606](https://github.com/Rdatatable/data.table/issues/2606). Thanks @MichaelChirico for the report and @manmita for the PR

<<<<<<< HEAD
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move new entry below existing ones and clean code markers (<<<, ===, >>>) after git conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve verbose messages in rolling functions

4 participants