Skip to content

Commit 9cf9e57

Browse files
committed
fix: Allow double and float types to be rollupable (#2311)
- We had this restriction in the UI, but the engine can actually handle it - Tested with doubles, floats - Tested with the following tables: ```python from deephaven import empty_table doubles = empty_table(1_000_000).update_view(["Group = i*10.4", "N = (i % 347)*0.1", "M = (i % 29)*10.2", "Value=i*2.4", "Weight=i*4.2"]) floats = empty_table(1_000_000).update_view(["Group = i*10.4", "N = (float)(i % 347)*0.1", "M = (float)(i % 29)*10.2" , "Value=(float)i*2.4", "Weight=(float)i*4.2"]) ``` - Updated e2e tests and unit tests - Fixes #2295 - For DH-18030
1 parent 37a7940 commit 9cf9e57

15 files changed

Lines changed: 37 additions & 1 deletion
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { type dh as DhType } from '@deephaven/jsapi-types';
2+
import { TestUtils } from '@deephaven/test-utils';
3+
import RollupRows from './RollupRows';
4+
5+
it('should allow all column types to be groupable', () => {
6+
function testType(type: string, expected = true) {
7+
const column = TestUtils.createMockProxy<DhType.Column>({ type });
8+
expect(RollupRows.isGroupable(column)).toBe(expected);
9+
}
10+
11+
testType('string');
12+
testType('int');
13+
testType('long');
14+
testType('float');
15+
testType('double');
16+
testType('java.lang.String');
17+
testType('java.lang.Integer');
18+
testType('java.lang.Long');
19+
testType('java.math.BigDecimal', false);
20+
testType('java.math.BigInteger', false);
21+
});

packages/iris-grid/src/sidebar/RollupRows.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ class RollupRows extends Component<RollupRowsProps, RollupRowsState> {
110110
}
111111

112112
static isGroupable(column: dh.Column): boolean {
113-
return !TableUtils.isDecimalType(column.type);
113+
return (
114+
!TableUtils.isBigDecimalType(column.type) &&
115+
!TableUtils.isBigIntegerType(column.type)
116+
);
114117
}
115118

116119
constructor(props: RollupRowsProps) {

tests/table-operations.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,18 @@ test('rollup rows and aggregrate columns', async ({ page }) => {
462462
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
463463
});
464464

465+
await test.step('Rollup a double column', async () => {
466+
const doubleColumn = page.getByRole('button', {
467+
name: 'Double',
468+
exact: true,
469+
});
470+
expect(doubleColumn).toBeTruthy();
471+
await doubleColumn.dblclick();
472+
473+
await waitForLoadingDone(page);
474+
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
475+
});
476+
465477
await test.step('Aggregate columns', async () => {
466478
await page.getByText('Constituents').click();
467479
await page.getByText('Non-Aggregated Columns').click();
-24.1 KB
Loading
-44 KB
Loading
-13.8 KB
Loading
-2.79 KB
Loading
-2.43 KB
Loading
-800 Bytes
Loading
-441 Bytes
Loading

0 commit comments

Comments
 (0)