Fix segfault and errors on 2-sided sorted views when data window is invalid #1153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Retrieving data from a
View
can be controlled via thestart_row
/end_row
andstart_col
/end_col
arguments toto_json
, which are parsed in a similar fashion to Python'srange
- inclusive ofstart
and stopping atend - 1
.Invalid data windows - where
start > end
orstart == end
- are handled by returning empty data. However, in the special case of two-sided sorted views, it did not correctly handle invalid data windows while constructing a column indices vector, and would segfault or throw a ValueError.This does not raise an issue with the viewer/plugins - the data window requested by
perspective-viewer
will be valid, even if the viewport is extremely small. However, this interferes with a Websocket testing suite I'm currently building, which randomly generates data windows with the expectation that they are handled correctly by Perspective.Because there are many situations where a data window can be technically invalid, such as requesting a
to_json
on a view with 0 rows, or a view with 0 columns (such as the one created when generating autocomplete results for string filtering), I think it's better to have consistent behavior rather than throwing an error.Changes