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

fix: Do not show Group column for tree-tables #1851

Merged
merged 4 commits into from
Mar 6, 2024

Conversation

mofojed
Copy link
Member

@mofojed mofojed commented Mar 5, 2024

from deephaven import read_csv, agg
from deephaven.constants import NULL_INT
from deephaven import empty_table

_source = empty_table(100).update_view(["ID = i", "Parent = i == 0 ? NULL_INT : (int)(i / 4)"])
_insurance = read_csv("https://media.githubusercontent.com/media/deephaven/examples/main/Insurance/csv/insurance.csv")

agg_list = [agg.avg(cols=["bmi", "expenses"])]
small_by_list = ["region"]
by_list = ["region", "age"]

no_group_tree = _source.tree(id_col="ID", parent_col="Parent")
no_group_agg = _insurance.rollup(aggs=agg_list, by=small_by_list, include_constituents=True)

group_rollup_no_agg = _insurance.rollup(aggs=[], by=by_list, include_constituents=True)
group_rollup_agg = _insurance.rollup(aggs=agg_list, by=by_list, include_constituents=True)

- If a table has no grouped columns or only one grouped column, no point in adding an extra Group column for that situation as it is just duplicate information
- Fixes deephaven#1831
- Added unit tests, and tested with the following snippet:
```python
from deephaven import read_csv, agg
from deephaven.constants import NULL_INT
from deephaven import empty_table

_source = empty_table(100).update_view(["ID = i", "Parent = i == 0 ? NULL_INT : (int)(i / 4)"])
_insurance = read_csv("https://media.githubusercontent.com/media/deephaven/examples/main/Insurance/csv/insurance.csv")

agg_list = [agg.avg(cols=["bmi", "expenses"])]
small_by_list = ["region"]
by_list = ["region", "age"]

no_group_tree = _source.tree(id_col="ID", parent_col="Parent")
no_group_agg = insurance.rollup(aggs=agg_list, by=small_by_list, include_constituents=True)

group_rollup_no_agg = insurance.rollup(aggs=[], by=by_list, include_constituents=True)
group_rollup_agg = insurance.rollup(aggs=agg_list, by=by_list, include_constituents=True)
```
@mofojed mofojed requested review from dsmmcken and mattrunyon March 5, 2024 15:43
@mofojed mofojed self-assigned this Mar 5, 2024
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 46.12%. Comparing base (aee4047) to head (6ef233a).

Files Patch % Lines
packages/iris-grid/src/IrisGridTreeTableModel.ts 22.22% 14 Missing ⚠️
packages/iris-grid/src/IrisGridTestUtils.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1851      +/-   ##
==========================================
+ Coverage   46.08%   46.12%   +0.04%     
==========================================
  Files         635      635              
  Lines       38013    38025      +12     
  Branches     9608     9612       +4     
==========================================
+ Hits        17517    17540      +23     
+ Misses      20443    20432      -11     
  Partials       53       53              
Flag Coverage Δ
unit 46.12% <25.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mattrunyon
mattrunyon previously approved these changes Mar 5, 2024
Copy link
Collaborator

@mattrunyon mattrunyon left a comment

Choose a reason for hiding this comment

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

Still want Don to check the behavior is as expected

dsmmcken
dsmmcken previously approved these changes Mar 6, 2024
Copy link
Contributor

@dsmmcken dsmmcken left a comment

Choose a reason for hiding this comment

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

Approved for functionality.

@mofojed mofojed dismissed stale reviews from dsmmcken and mattrunyon via 2c0e300 March 6, 2024 18:57
@mofojed mofojed requested a review from mattrunyon March 6, 2024 19:06
@mofojed mofojed enabled auto-merge (squash) March 6, 2024 19:31
@mofojed mofojed merged commit 1ce6aac into deephaven:main Mar 6, 2024
5 checks passed
@mofojed mofojed deleted the 1831-tree-table-no-group branch March 6, 2024 19:50
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants