[DF] Change the signature of RInterface::Describe (Fix #8893)#9551
[DF] Change the signature of RInterface::Describe (Fix #8893)#9551eguiraud merged 1 commit intoroot-project:masterfrom
Conversation
|
Starting build on |
712c06e to
2027f91
Compare
|
Starting build on |
There was a problem hiding this comment.
Thanks @ikabadzhov ! The design is what we want, some notes on the implementation below.
2027f91 to
d5b3416
Compare
|
Starting build on |
1 similar comment
|
Starting build on |
bb9bbb7 to
2083f3b
Compare
|
Starting build on |
|
Build failed on mac11/cxx17. Failing tests:
And 4 more |
|
Thanks @ikabadzhov for this very nice improvements! +1 for the usage of |
|
Thank you @vepadulano. As a current solution, we decided that Reason to think that current solution with separate methods is better is the design that Given your comment, I see it as a valid argument to have: |
|
Good point, yes I think we want @ikabadzhov can you take care of it? For the |
|
@eguiraud @vepadulano if we have overloaded |
|
Yes we do, e.g. there is no way to pick a short or long format using |
2083f3b to
1ae539b
Compare
|
Starting build on |
| endif() | ||
|
|
||
| # RDFDescription pythonization | ||
| if (rdfdescription) |
There was a problem hiding this comment.
Shouldn't this be under the if (dataframe) condition block above?
There was a problem hiding this comment.
yes indeed there is no rdfdescription cmake option so the test should go with the other rdf tests
| from . import pythonization | ||
|
|
||
| @pythonization("RDFDescription", ns="ROOT::RDF") | ||
| def pythonize_rdataframe(klass): |
There was a problem hiding this comment.
Congrats for your first pythonization!
I would call this pythonize_rdfdescription to be consistent in the naming.
There was a problem hiding this comment.
corrected in the latest commit (and also the other typo)
1ae539b to
1837e17
Compare
|
Starting build on |
| Test supported __repr__ | ||
| """ | ||
| df1 = ROOT.RDataFrame(1); | ||
| ref1 = ("Empty dataframe filling 1 row\n" |
There was a problem hiding this comment.
Assuming that there are tests in RDataFrame for AsString that check it does the right thing, this test could be simply self.assertEqual(df1.Describe().AsString(), repr(df1.Describe()));, i.e. no need to test again what is tested in the AsString tests.
There was a problem hiding this comment.
I am applying this change and creating a new commit now. Everything else I keep unchanged (so far).
| /// ~~~ | ||
| /// | ||
| std::string Describe() | ||
| RDFDescription Describe() |
There was a problem hiding this comment.
Why RDFDescription and not RDescription as in RDisplay? The namespace ROOT::RDF already qualifies it as an RDF thing no?
There was a problem hiding this comment.
Currently, the name of the class is RDFDescription, i.e. ROOT::RDF::RDFDescription. I can change it to ROOT::RDF::RDescription. Is that what you mean?
There was a problem hiding this comment.
Yes, I'm asking if there's a reason to name it RDFDescription and not RDescription.
There was a problem hiding this comment.
Yes, we might have other descriptions of things still under the ROOT::RDF namespace, and in Doxygen (or when searching the code in general) it's better to search for the RDFDescription class than for a generic RDescription class across all ROOT.
I would have done the same for RDisplay but it's too late.
There was a problem hiding this comment.
mmh on second thought I don't know, Enric is right that we have some seriously generic names in the ROOT::RDF namespace, like RDisplay and RInterface, so maybe that ship has sailed.
I guess the question is just whether we'll ever have another description of something else, like a RDF::RFilterDescription 🤔
There was a problem hiding this comment.
I guess the question is just whether we'll ever have another description of something else, like a RDF::RFilterDescription
In that case, for our peace of mind, we can argue that ROOT::RDF::RDescription means the description of the RDF (the RDF namespace qualifies it as such), if the description is of an RDF filter, it is fair that it's called ROOT::RDF::RFilterDescription
There was a problem hiding this comment.
Peace of mind would be an argument for leaving the more specific name 😄
Ivan, Enric, pick the one you like best, I have no preference.
There was a problem hiding this comment.
I think we should also think if later on, we will have other RDF "instances" which are used to "present" some specific part of RDF itself. As an example potentially RDFMetaData.
I believe answer should converge to yes, and hence I would go for RDFDescription. Moreover, I just saw that there is a RDFTypeNameGetter class, so keeping RDF seem consistent.
Remark, no matter which version we choose, very likely the other version is never going to be used (mainly for consistency and avoiding confusion - might be obvious but I want to make sure it is considered).
1837e17 to
b815ae5
Compare
|
Starting build on |
|
Build failed on ROOT-ubuntu16/nortcxxmod. Failing tests: |
|
Build failed on ROOT-performance-centos8-multicore/default. Warnings:
Failing tests: |
|
Build failed on ROOT-ubuntu2004/soversion. Failing tests: |
) A new class DFDescription is introduced. It has 2 member strings, corresponding to the brief and the full description. It allows more interactive output of these strings. RInterface::Describe now returns a DFDescription object. As brief description is the output from RInterface::DescribeDataset. As full description is the remaining code from RInterface::Describe. Moreover, RInterface::DescribeDataset is now a private method. RDFDescription has the following methods: * AsString(bool) -> returning brief/full description as a string * Print(bool) -> printing the content of AsString(bool) * overloaded<< -> returns ostream corresponding to AsString(shortFormat=false) * printValue -> returns string corresponding to AsString(shortFomat=false) * __repr__ pythonization -> assigning __repr__ to AsString(shortFormat=false) Tests and Tutorials were adapted correspondingly.
b815ae5 to
6dc7a26
Compare
|
Starting build on |
|
Build failed on ROOT-performance-centos8-multicore/default. Warnings:
Failing tests: |
|
Build failed on ROOT-debian10-i386/cxx14. Failing tests: |
|
Build failed on mac11/cxx17. Failing tests:
And 5 more |
|
Build failed on mac1015/python3. Failing tests: |
This Pull request:
[DF] Change the signature of RInterface::Describe
Changes or fixes:
A new structure
DFDescriptionis introduced.It has 2 member strings, corresponding to the brief and the full description.
It allows more interactive output of these strings.
RInterface::Describenow returns aDFDescription.As brief description is the output from
RInterface::DescribeDataset.As full description is the remaining code from
RInterface::Describe.Moreover,
RInterface::DescribeDatasetis now a private method.RDFDescription has the following methods:
AsString(bool)-> returning brief/full description as a stringPrint(bool)-> printing the content ofAsString(bool)<<-> returns ostream corresponding toAsString(shortFormat=false)__repr__pythonization -> assigning__repr__toAsString(shortFormat=false)Tests and Tutorials were adapted correspondingly.
Checklist:
This PR fixes #8893