Skip to content

Commit

Permalink
fix: Change display of rollup key columns from null to empty string (#…
Browse files Browse the repository at this point in the history
…1563)

* Previously, key columns containing non-numeric types would display
`null` is the rolled up rows have different values for the same column
    * This behaviour is updated to show an empty cell instead of `null`
* Resolves #1483 

#### Testing Instructions:
1. Run:
  ```python
  from deephaven import empty_table, time_table
  
  size = 100
  scale = 1000
  
  random_values_with_null_NaN = empty_table(size).update([
      "MyString=(i%11==0? null : `a`+(int)(scale*(Math.random()*2-1)))"
  ])
```
2. Add the string and char columns and any other arbitrary columns as rollup columns in any order
3. The key column should only show `null` if it actually represents a null value in the column

---------

Co-authored-by: georgecwan <[email protected]>
Co-authored-by: Mike Bender <[email protected]>
  • Loading branch information
3 people authored Oct 13, 2023
1 parent 4eda17c commit 327bcb6
Show file tree
Hide file tree
Showing 22 changed files with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/iris-grid/src/IrisGridTreeTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate<
const value = this.valueForCell(x, y);
return this.displayString(value, column.constituentType, column.name);
}
// Show empty string instead of null in rollup grouping columns (issue #1483)
if (
row.hasChildren &&
row.depth <= x + 1 &&
this.valueForCell(x, y) === null &&
this.getCachedGroupedColumnSet(this.groupedColumns).has(x)
) {
return '';
}
}

return super.textForCell(x, y);
Expand Down Expand Up @@ -182,6 +191,15 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate<
)
);

getCachedGroupedColumnSet = memoize(
(groupedColumns: readonly Column[]) =>
new Set(
groupedColumns.map(c1 =>
this.columns.findIndex(c2 => c1.name === c2.name)
)
)
);

updateFrozenColumns(columns: ColumnName[]): void {
if (columns.length > 0) {
throw new Error('Cannot freeze columns on a tree table');
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 327bcb6

Please sign in to comment.