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

feat: Add support for multi-partition parquet:kv tables #1580

Merged
merged 7 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class MockIrisGridTreeModel
throw new Error('Not defined in mock');
}

valuesTable(column: Column): Promise<never> {
valuesTable(columns: Column | Column[]): Promise<never> {
throw new Error('Not defined in mock');
}

Expand Down
4 changes: 2 additions & 2 deletions packages/dashboard-core-plugins/src/panels/ChartPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export interface GLChartPanelState {
sorts: unknown;
};
irisGridPanelState?: {
partitionColumn: string;
partition: unknown;
partitionColumns: string[];
partitions: unknown[];
};
table?: string;
figure?: string;
Expand Down
70 changes: 29 additions & 41 deletions packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
IrisGridState,
ChartBuilderSettings,
DehydratedIrisGridState,
DehydratedIrisGridPanelState,
ColumnHeaderGroup,
IrisGridContextMenuData,
IrisGridTableModel,
Expand Down Expand Up @@ -78,7 +79,7 @@ import type {
TablePluginComponent,
TablePluginElement,
} from '@deephaven/plugin';
import { ConsoleEvent, InputFilterEvent, IrisGridEvent } from '../events';
import { InputFilterEvent, IrisGridEvent } from '../events';
import {
getInputFiltersForDashboard,
getLinksForDashboard,
Expand Down Expand Up @@ -114,23 +115,20 @@ export interface PanelState {
movedRows: MoveOperation[];
};
irisGridState: DehydratedIrisGridState;
irisGridPanelState: {
partitionColumn: ColumnName | null;
partition: string | null;
isSelectingPartition: boolean;
advancedSettings: [AdvancedSettingsType, boolean][];
};
irisGridPanelState: DehydratedIrisGridPanelState;
pluginState: unknown;
}

// Some of the properties in the loaded panel state may be omitted
// even though they can't be undefined in the dehydrated state.
// This can happen when loading the state saved before the properties were added.
type LoadedPanelState = PanelState & {
irisGridPanelState: PanelState['irisGridPanelState'] &
Partial<
Pick<PanelState['irisGridPanelState'], 'partition' | 'partitionColumn'>
>;
irisGridPanelState: PanelState['irisGridPanelState'] & {
partitions?: (string | null)[];
partitionColumns?: ColumnName[];
partition?: string | null;
partitionColumn?: ColumnName;
};
};

export interface IrisGridPanelProps extends DashboardPanelProps {
Expand Down Expand Up @@ -190,8 +188,8 @@ interface IrisGridPanelState {
movedColumns: readonly MoveOperation[];
movedRows: readonly MoveOperation[];
isSelectingPartition: boolean;
partition: string | null;
partitionColumn: Column | null;
partitions: (string | null)[];
partitionColumns: Column[];
rollupConfig?: UIRollupConfig;
showSearchBar: boolean;
searchValue: string;
Expand Down Expand Up @@ -252,7 +250,6 @@ export class IrisGridPanel extends PureComponent<
this.handleError = this.handleError.bind(this);
this.handleGridStateChange = this.handleGridStateChange.bind(this);
this.handlePluginStateChange = this.handlePluginStateChange.bind(this);
this.handlePartitionAppend = this.handlePartitionAppend.bind(this);
this.handleCreateChart = this.handleCreateChart.bind(this);
this.handleResize = this.handleResize.bind(this);
this.handleShow = this.handleShow.bind(this);
Expand Down Expand Up @@ -298,8 +295,8 @@ export class IrisGridPanel extends PureComponent<
movedColumns: [],
movedRows: [],
isSelectingPartition: false,
partition: null,
partitionColumn: null,
partitions: [],
partitionColumns: [],
rollupConfig: undefined,
showSearchBar: false,
searchValue: '',
Expand Down Expand Up @@ -460,14 +457,14 @@ export class IrisGridPanel extends PureComponent<
(
model: IrisGridModel,
isSelectingPartition: boolean,
partition: string | null,
partitionColumn: Column | null,
partitions: (string | null)[],
partitionColumns: Column[],
advancedSettings: Map<AdvancedSettingsType, boolean>
) =>
IrisGridUtils.dehydrateIrisGridPanelState(model, {
isSelectingPartition,
partition,
partitionColumn,
partitions,
partitionColumns,
advancedSettings,
})
);
Expand Down Expand Up @@ -713,14 +710,6 @@ export class IrisGridPanel extends PureComponent<
glEventHub.emit(InputFilterEvent.TABLE_CHANGED, this, table);
}

handlePartitionAppend(column: Column, value: unknown): void {
const { glEventHub } = this.props;
const { name } = column;
const tableName = this.getTableName();
const command = `${tableName} = ${tableName}.where("${name}=\`${value}\`")`;
glEventHub.emit(ConsoleEvent.SEND_COMMAND, command, false, true);
}

/**
* Create a chart with the specified settings
* @param settings The settings from the chart builder
Expand Down Expand Up @@ -1044,8 +1033,8 @@ export class IrisGridPanel extends PureComponent<
}
const {
isSelectingPartition,
partition,
partitionColumn,
partitions,
partitionColumns,
advancedSettings,
} = IrisGridUtils.hydrateIrisGridPanelState(model, irisGridPanelState);
assertNotNull(this.irisGridUtils);
Expand Down Expand Up @@ -1090,8 +1079,8 @@ export class IrisGridPanel extends PureComponent<
isSelectingPartition,
movedColumns,
movedRows,
partition,
partitionColumn,
partitions,
partitionColumns,
quickFilters,
reverseType,
rollupConfig,
Expand Down Expand Up @@ -1123,8 +1112,8 @@ export class IrisGridPanel extends PureComponent<
model,
panelState: oldPanelState,
isSelectingPartition,
partition,
partitionColumn,
partitions,
partitionColumns,
advancedSettings,
} = this.state;
const {
Expand Down Expand Up @@ -1159,8 +1148,8 @@ export class IrisGridPanel extends PureComponent<
this.getDehydratedIrisGridPanelState(
model,
isSelectingPartition,
partition,
partitionColumn,
partitions,
partitionColumns,
advancedSettings
),
this.getDehydratedIrisGridState(
Expand Down Expand Up @@ -1247,8 +1236,8 @@ export class IrisGridPanel extends PureComponent<
model,
movedColumns,
movedRows,
partition,
partitionColumn,
partitions,
partitionColumns,
quickFilters,
reverseType,
rollupConfig,
Expand Down Expand Up @@ -1329,8 +1318,8 @@ export class IrisGridPanel extends PureComponent<
isStuckToRight={isStuckToRight}
movedColumns={movedColumns}
movedRows={movedRows}
partition={partition}
partitionColumn={partitionColumn}
partitions={partitions}
partitionColumns={partitionColumns}
quickFilters={quickFilters}
reverseType={reverseType}
rollupConfig={rollupConfig}
Expand All @@ -1348,7 +1337,6 @@ export class IrisGridPanel extends PureComponent<
onCreateChart={this.handleCreateChart}
onDataSelected={this.handleDataSelected}
onError={this.handleError}
onPartitionAppend={this.handlePartitionAppend}
onStateChange={this.handleGridStateChange}
onContextMenu={this.handleContextMenu}
onAdvancedSettingsChange={this.handleAdvancedSettingsChange}
Expand Down
Loading
Loading