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: Allow double and float types to be rollupable #2311

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/iris-grid/src/sidebar/RollupRows.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { type dh as DhType } from '@deephaven/jsapi-types';
import { TestUtils } from '@deephaven/test-utils';
import RollupRows from './RollupRows';

it('should allow all column types to be groupable', () => {
function testType(type: string, expected = true) {
const column = TestUtils.createMockProxy<DhType.Column>({ type });
expect(RollupRows.isGroupable(column)).toBe(expected);
}

testType('string');
testType('int');
testType('long');
testType('float');
testType('double');
testType('java.lang.String');
testType('java.lang.Integer');
testType('java.lang.Long');
testType('java.math.BigDecimal', false);
testType('java.math.BigInteger', false);
});
5 changes: 4 additions & 1 deletion packages/iris-grid/src/sidebar/RollupRows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ class RollupRows extends Component<RollupRowsProps, RollupRowsState> {
}

static isGroupable(column: dh.Column): boolean {
return !TableUtils.isDecimalType(column.type);
return (
!TableUtils.isBigDecimalType(column.type) &&
!TableUtils.isBigIntegerType(column.type)
);
}

constructor(props: RollupRowsProps) {
Expand Down
12 changes: 12 additions & 0 deletions tests/table-operations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,18 @@ test('rollup rows and aggregrate columns', async ({ page }) => {
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
});

await test.step('Rollup a double column', async () => {
const doubleColumn = page.getByRole('button', {
name: 'Double',
exact: true,
});
expect(doubleColumn).toBeTruthy();
await doubleColumn.dblclick();

await waitForLoadingDone(page);
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
});

await test.step('Aggregate columns', async () => {
await page.getByText('Constituents').click();
await page.getByText('Non-Aggregated Columns').click();
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