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

Upgrade CSP to Perspective 3.0.3 #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

sinistersnare
Copy link
Collaborator

@sinistersnare sinistersnare commented Sep 17, 2024

Specific modifications done to CSP for this change:

  • csp/dataframe.py: The to_perspective function now must take a Client object to construct the Table.
  • csp/adapters/perspective.py: The use of PerspectiveManager was changed to use of the new Client/Server classes.
  • csp/impl/pandas_perspective.py: Perspective Table JSON update does not support direct date or datetime values now, as theses are not JSON serializable types. To work around this, the objects are directly translated to timestamp integers and sent to Perspective to be parsed into Perspective’s time types. to_df was rewritten to route through PyArrow, but due to differences in how PyArrow chooses dtypes, there is some hackery around ordering of categories. We also removed to_dict and to_numpy because they were removed in the Perspective 3.0 migration.
  • csp/tests/impl/test_pandas_perspective.py many tests were fixed to demonstrate changes that are needed to continue day-to-day use of CspPerspectiveTable. Some tests were not fixed due to an outstanding Perspective bug (Unit test describing index behavior bug finos/perspective#2756).

The use of PyArrow to underly Perspective’s DataFrame support leads to some semantic changes. PyArrow is much more eager to set columns to CategoricalDtype instead of StringDtype. It also has different behavior regarding category ordering, and perhaps others still not uncovered after fixing the tests.

@sinistersnare sinistersnare force-pushed the feature/psp3 branch 3 times, most recently from 1f48935 to 28f9841 Compare September 18, 2024 20:52
@sinistersnare sinistersnare marked this pull request as ready for review September 18, 2024 20:53
@sinistersnare sinistersnare force-pushed the feature/psp3 branch 2 times, most recently from a963e08 to a544d63 Compare September 19, 2024 15:29
@@ -160,28 +170,41 @@ def __init__(
self._limit = limit
self._localize = localize

# TODO: we do not want 1 server per table, make a Client param?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does "feel" wrong to me creating a new server per table, but I am curious how it would be a problem. Does a server have lots of overhead? Does a collection of tables in the same server share more resources than the same collection of tables on different servers? Are there any potential advantages to isolating a table per server?

@sinistersnare sinistersnare force-pushed the feature/psp3 branch 3 times, most recently from 7363855 to 1c58bfb Compare October 7, 2024 14:17
Signed-off-by: Davis Silverman <[email protected]>
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.

3 participants