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

[WIP] Use DataAPI.metadata instead of redefining it #707

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

asinghvi17
Copy link
Collaborator

@asinghvi17 asinghvi17 commented Apr 30, 2024

Fix #706 by explicitly importing DataAPI.metadata.

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.87%. Comparing base (37cd1eb) to head (05c464d).
Report is 3 commits behind head on main.

❗ Current head 05c464d differs from pull request most recent head a10403b. Consider uploading reports for the commit a10403b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #707      +/-   ##
==========================================
+ Coverage   83.86%   83.87%   +0.01%     
==========================================
  Files          46       46              
  Lines        4257     4267      +10     
==========================================
+ Hits         3570     3579       +9     
- Misses        687      688       +1     

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

@rafaqz
Copy link
Owner

rafaqz commented Apr 30, 2024

May need to check we don't have function metadata end or metadata(x) = nothing lying around

@rafaqz
Copy link
Owner

rafaqz commented May 17, 2024

We have function metadata end in interface.jl that needs removing.

And these methods are going to be a piracy problem:

  [2] metadata(::Tuple{})
     @ DimensionalData.Dimensions ~/.julia/dev/DimensionalData/src/Dimensions/dimension.jl:232
 [15] metadata(ds::Tuple, I)
     @ DimensionalData.Dimensions ~/.julia/dev/DimensionalData/src/Dimensions/dimension.jl:234
 [16] metadata(ds::Tuple, i1, I...)
     @ DimensionalData.Dimensions ~/.julia/dev/DimensionalData/src/Dimensions/dimension.jl:233
 [17] metadata(ds::Tuple)
     @ DimensionalData.Dimensions ~/.julia/dev/DimensionalData/src/Dimensions/dimension.jl:231
 [18] metadata(x)
     @ ~/.julia/dev/DimensionalData/src/Lookups/metadata.jl:107

I guess we can make all the Tuples into DimTuple so we own them, with the slight downside that it will error on empty Tuple{}.

The untyped case may be a problem too, we can try deleting it and see what breaks.

@asinghvi17
Copy link
Collaborator Author

Thanks - will take a look today!

@asinghvi17
Copy link
Collaborator Author

julia> DataAPI.metadata(tuple())
ERROR: ArgumentError: Objects of type Tuple{} do not support reading metadata
Stacktrace:
 [1] metadata(x::Tuple{}; style::Bool)
   @ DataAPI ~/.julia/packages/DataAPI/atdEM/src/DataAPI.jl:373
 [2] metadata(x::Tuple{})
   @ DataAPI ~/.julia/packages/DataAPI/atdEM/src/DataAPI.jl:371
 [3] top-level scope
   @ REPL[41]:1

so that method is at least open...

@asinghvi17
Copy link
Collaborator Author

Ah damn, I just realized that the way that DD handles metadata (DD.NoLookup) is not the same way as DataAPI handles metadata (Nothing). I guess this could potentially stay the same for now, and maybe just hook into DataAPI.metadata as well for DD native types...

@rafaqz
Copy link
Owner

rafaqz commented May 18, 2024

DD.NoMetadata but we could maybe change it. One nice thing about NoMetadata is Dict functions like haskey work on it (and we can as more as needed) so its a nice fallback that both wont cause errors anywhere and e.g. works on GPUs like nothing would.

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.

Use DataAPI.jl metadata function
2 participants