-
Notifications
You must be signed in to change notification settings - Fork 81
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
Added support to slice a table using percentages #4135
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested test: Make sure that slices of a table when merged recreate exactly the original table.
Specifically, create a test where you create slices 0.0-0.25, 0.25-0.5, 0.5-0.75, 0.75-1.0 then verify all rows from the main table are in exactly one slice (no duplicates or missing rows).
engine/table/src/test/java/io/deephaven/engine/table/impl/QueryTableSliceTest.java
Show resolved
Hide resolved
1627902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Labels indicate documentation is required. Issues for documentation have been opened: How-to: https://github.com/deephaven/deephaven.io/issues/2910 |
Feature request, closes #3203
Change description: Added a new slicePct() method that takes percentages, similar to how slice() works with row indexes.
Documentation update: We need to add both java and python documentations, similar to the slice() method.
For Java, the syntax is table.slicePct(double startPercentInclusive, double endPercentExclusive)
For Python, the syntax is table.slice_pct(start_pct:float, end_pct:float)
The function returns a subset of table in the range [startPercentInclusive * sizeOfTable , endPercentExclusive * sizeOfTable). For example, for a table of size 10, slicePct(0.1, 0.7) will return a subset from the second row to the seventh row. Similarly, slicePct(0, 1) would return the entire table (because row positions run from 0 to size-1).
The percentage arguments must be in [0,1], otherwise the function returns an error.
Also, the method is not supported for blink tables and will give an error.