-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
fix a problem where linked selections were resulting in repeated columns #6336
fix a problem where linked selections were resulting in repeated columns #6336
Conversation
Just curious if anyone has any thoughts on this PR, even a hint about whether this is a sensible thing to attempt or not. |
Thanks for fixing this! I'm not terribly familiar with this part of the code base so I can't comment on whether it's the right way or not, but I think other maintainers would appreciate it if you could add a UI test (something like https://github.com/holoviz/holoviews/blob/main/holoviews/tests/ui/bokeh/test_callback.py#L351-L378 basically copying your minimal example, and adding a few assert statements) and perhaps a short inline comment about what you're doing. Test failures seem unrelated. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6336 +/- ##
==========================================
+ Coverage 88.48% 88.50% +0.01%
==========================================
Files 323 323
Lines 68162 68598 +436
==========================================
+ Hits 60313 60712 +399
- Misses 7849 7886 +37 ☔ View full report in Codecov by Sentry. |
This definitely does not need a UI test, a simple unit test would suffice. UI tests are for functionality that lives on the frontend or for integration tests ensuring that all the pieces work together. |
I haven't been able to reproduce the actual issue here. |
Sorry, was able to reproduce and added a test. |
While working with
link_selections
I ran into a problem where trying to link two plots that came from the same dataset would result in an error because at some point during the creation of the selection expression the columns would get duplicated. Here's an MRE that illustrates this problem:This results in the following slightly truncated error:
I traced this problem down into the
_get_index_selection
function, where the dataset is cloned on line 35:Because cloning will take all the vdims if that parameter is left unspecified, if there is overlap between kdims and vdims, the selection on line 38 will throw an error because the columns are duplicated in the resulting dataframe:
This PR makes the slight change that vdims are explicitly set to be cloned only if they do not overlap with the kdims. Then the selection is made on both rows and columns to ensure that each column appears only once.
This fixes the problem I observed in the MRE and doesn't seem to break anything else. It's my first attempt to contribute to HoloViews so I would appreciate any pointers on how to properly test this or anything else it might affect.