Skip to content

Conversation

@ben-schwen
Copy link
Member

@ben-schwen ben-schwen commented Jan 19, 2024

Closes #2422

But do not know how we should properly test this?

@dvg-p4
Copy link
Contributor

dvg-p4 commented Feb 19, 2024

#5655 might help with testing :-)

@MichaelChirico
Copy link
Member

I actually think this fix is pretty reasonable, WDYT @jangorecki?

@MichaelChirico MichaelChirico marked this pull request as ready for review July 16, 2025 04:22
@MichaelChirico MichaelChirico self-requested a review as a code owner July 16, 2025 04:22
@MichaelChirico
Copy link
Member

@ben-schwen I'll let you merge since this was marked as Draft but it's good to go IMO

@github-actions
Copy link

github-actions bot commented Jul 16, 2025

  • HEAD=dim_cedta stopped early for DT[by,verbose=TRUE] improved in #6296
  • HEAD=dim_cedta slower P<0.001 for memrecycle regression fixed in #5463
  • HEAD=dim_cedta slower P<0.001 for setDT improved in #5427
    Comparison Plot

Generated via commit 1899eab

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

Task Duration
R setup and installing dependencies 2 minutes and 53 seconds
Installing different package versions 41 seconds
Running and plotting the test cases 2 minutes and 34 seconds

@ben-schwen ben-schwen requested a review from a team as a code owner July 16, 2025 14:38
@codecov
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.77%. Comparing base (8f5ffa8) to head (1899eab).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5918   +/-   ##
=======================================
  Coverage   98.77%   98.77%           
=======================================
  Files          81       81           
  Lines       15203    15203           
=======================================
  Hits        15017    15017           
  Misses        186      186           

☔ 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.

if (col.names == "none")
colnames(toprint) = rep.int("", ncol(toprint))
if (nrow(toprint)>20L && col.names == "auto")
if (NROW(toprint)>20L && col.names == "auto")
Copy link
Member

Choose a reason for hiding this comment

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

Hm, could you explain these? Needing it is a bit of a code smell...

@ben-schwen
Copy link
Member Author

So, basically when deactivating cedta for dim we are facing the problem that nrow dispatches to dim(x)[1L]. Now if !cedta we have a problem for objects which are data.table but no data.frame and have no dim method because then it can happen that nrow returns NULL which bites us for example at print.data.table.

p.s. I have no idea why vscode keeps adding the french datatable-joins vignette (thats also the reason for the force-push) but I suppose it has something to do with line endings.

dim.data.table = function(x)
{
if (!cedta()) return(NextMethod()) # nocov
if (!cedta(verbose=FALSE)) return(NextMethod()) # nocov
Copy link
Member

@jangorecki jangorecki Jul 17, 2025

Choose a reason for hiding this comment

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

What's the exact reason to forcing verbose to F here? Why in this particular method we want to see less?

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason is that we call dim in every print statement which are often not cedta

Copy link
Member

@MichaelChirico MichaelChirico Jul 17, 2025

Choose a reason for hiding this comment

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

Isn't that resolved by switching to nrow(x)[1L] in print.data.table?

We could instead call .Call(Cdim, x)[1L] right?


I do see other dim() usage in print.data.table:

if (any(dim(x)==0L)) {

So maybe we want dim_x = .Call(Cdim, x) & proceed from there?

@jangorecki
Copy link
Member

Yes, please revert changes to vignettes/fr/datatable-joins.Rmd
Later on when doing git add just list files to add so only specified files will get into commit.

@MichaelChirico
Copy link
Member

MichaelChirico commented Jul 17, 2025

p.s. I have no idea why vscode keeps adding the french datatable-joins vignette (thats also the reason for the force-push) but I suppose it has something to do with line endings.

I was getting the same thing leading to #7184, I guess if you revert and merge master it will stop.

My understanding is we have some setting to auto-convert CRLF to LF, which shows up as a "ghost" editing the CRLF file & impossible to get around.

Edit: I'm pretty sure it's our .gitattributes:

* text eol=lf

I'm not sure why that wasn't applied within GitHub.

@MichaelChirico
Copy link
Member

we have a problem for objects which are data.table but no data.frame and have no dim method

Hm, on the one hand such objects are kind of broken already, but I suppose they're found here and there. Maybe

if (!cedta() && !is.null(df_dim <- NextMethod())) return(df_dim)
.Call(Cdim, x)

@aitap
Copy link
Member

aitap commented Jul 17, 2025 via email

@ChristianWia
Copy link
Contributor

Yes, please revert changes to vignettes/fr/datatable-joins.Rmd Later on when doing git add just list files to add so only specified files will get into commit.

please dont revert the work, several days have been spent to complete the task. Let us try on another product. Thanks.

@MichaelChirico
Copy link
Member

@ChristianWia thank you for your concern :) To be clear, the aim is only to revert the changes in this PR, which are spurious. The file in master would remain as-is.

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.

dim() on 0-column data.table produced in non-data.table-aware package is wrong

6 participants