-
Notifications
You must be signed in to change notification settings - Fork 13
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
a few concerns about metadata methods #52
Comments
I know this is abusing the interface, but very little since
|
We considered this. As you have commented it is currently doable by double lookup. Therefore we decided that this functionality can be added later in a non-breaking way if users report that this is needed. If we add it I would propose that this is handled by the We can add it now if we want. @nalimilan - what do you think?
This is the same reason as above. It can be added later in a non-breaking way if it is needed. We can define We can add it now if we want. @nalimilan - what do you think?
Tables.jl defines:
the metadata returned by
Maybe you are right. Defining the methods in DataAPI.jl indeed leads to method ambiguities if methods in a package implementing the interface are not implemented carefully enough (as you have noticed, I had the same problem in DataFrames.jl). Fortunately, following semver rules changing exception type is not considered breaking. Therefore, if we decide to remove the default implementations in the next release this will not be a breaking change. However, I would say that this is the most urgent decision to be made, because while this is non breaking still it is better to change the exception type sooner than later if we want to go this way. Again, @nalimilan - what do you think?
I am not clear what you propose here (these are methods for setting metadata as they have
In summary:
But let us wait a bit for others to comment. |
I'm fine with dropping fallback methods if they create ambiguities. (I think there's now a mechanism to print a custom message for certain Other additions seem fine, we can add it as soon as somebody needs them (not sure whether @ExpandingMan is in that position or not).
IIUC these would be equivalent to (I'm still kind of afraid that we are reinventing the |
The problem with |
@ExpandingMan - the idea was to limit the complexity of methods that packages are required to implement to make it easier to opt-in for their maintainers. The non-breaking proposals that you listed were considered, but we thought they can be added later. |
Alright, so it sounds like we are mostly in agreement concerning the points I made in my OP. I suppose there's nothing to be done in the general case about my 3rd point about the relationship between tables and columns not always being so starightforward. Indeed, it makes things pretty ugly in Parquet2.jl but I don't see what the alternative would be.
I completely agree with this approach and it is arguably the standard approach to creating interfaces in Julia, but there weren't any implemented fallback methods whatsoever so I was a bit puzzled about what the intentions were. Perhaps they simply were not added yet.
That seems a bit tricky due to the fact that keyword arguments must already have a default (at least in this case). So, if you were to e.g. choose I am more convinced than ever that the methods should be removed so that it gives |
That is why I have written in #53 that I have thought how to do it as I had exactly the same first reaction 😄. The solution would be to define a special type @nalimilan - do you think positional or keyword argument should be preferred for default value. |
I've started implementing
metadata
andcolmetadata
for Parquet2.jl. I have a few thoughts, sorry for not bringing this up when this was being discussed but there was a lot of conversation and I tuned out at some point.Base.get
. In many situations this means there is no way of fetching data without at least 2 lookups.Dict(k=>metadata(x, k) for k \in metadatakeys(x))
which seems a bit awkward, especially considering that in many cases the object is probably just sitting there in the first place and shouldn't have to be reconstructed.colmetadata
is more complicated than this API suggests. For example, in Parquet2 aDataset
is a table that has columns which are concatenations of sub-columns which belong ti sub-tables (which are also Tables.jl tables) calledRowGroup
. It's therefore not possible to definecolmetadata
onDataset
because it would be ambiguous which column metadata should be used (or whether it would be appropriate to merge them). This is surely not a typical case, but it seems worth pointing out that Tables.jl isn't enough to specify whatcolmetadata
should do.ArgumentError
fallbacks seems a bit dubious. These clearly should beMethodError
if there is no reasonable fallback. The most obvious consequence of this is that error handling routines might catch a wrong error here. Nothing else immediately comes to mind, though I do vaguely remember somebody writing a blog post at some point describing why this pattern leads to trouble... I'd also be a little worried about it making method ambiguity cases worse.I realize that opening this issue might seem like more of an annoyance than anything else since the ship has sailed and now we'd have to deal with breakage. However there might still be room to add a few methods such as, perhaps
Perhaps it's already fine for packages to include these but in that case perhaps it should be documented.
The text was updated successfully, but these errors were encountered: