Skip to content

Commit 327bcb6

Browse files
georgecwanmofojed
andauthored
fix: Change display of rollup key columns from null to empty string (#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 <georgecwan@users.noreply.github.com> Co-authored-by: Mike Bender <mikebender@deephaven.io>
1 parent 4eda17c commit 327bcb6

22 files changed

Lines changed: 18 additions & 0 deletions

packages/iris-grid/src/IrisGridTreeTableModel.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate<
3333
const value = this.valueForCell(x, y);
3434
return this.displayString(value, column.constituentType, column.name);
3535
}
36+
// Show empty string instead of null in rollup grouping columns (issue #1483)
37+
if (
38+
row.hasChildren &&
39+
row.depth <= x + 1 &&
40+
this.valueForCell(x, y) === null &&
41+
this.getCachedGroupedColumnSet(this.groupedColumns).has(x)
42+
) {
43+
return '';
44+
}
3645
}
3746

3847
return super.textForCell(x, y);
@@ -182,6 +191,15 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate<
182191
)
183192
);
184193

194+
getCachedGroupedColumnSet = memoize(
195+
(groupedColumns: readonly Column[]) =>
196+
new Set(
197+
groupedColumns.map(c1 =>
198+
this.columns.findIndex(c2 => c1.name === c2.name)
199+
)
200+
)
201+
);
202+
185203
updateFrozenColumns(columns: ColumnName[]): void {
186204
if (columns.length > 0) {
187205
throw new Error('Cannot freeze columns on a tree table');
230 Bytes
Loading
-299 Bytes
Loading
-29 Bytes
Loading
-24 Bytes
Loading
112 Bytes
Loading
-26 Bytes
Loading
-389 Bytes
Loading
-529 Bytes
Loading
-359 Bytes
Loading

0 commit comments

Comments
 (0)