Skip to content

fix: JsPartitionedTable keyColumn and keyColumnTypes ordering#4931

Merged
georgecwan merged 3 commits intodeephaven:mainfrom
georgecwan:fix-partition-keycolumn-order
Dec 19, 2023
Merged

fix: JsPartitionedTable keyColumn and keyColumnTypes ordering#4931
georgecwan merged 3 commits intodeephaven:mainfrom
georgecwan:fix-partition-keycolumn-order

Conversation

@georgecwan
Copy link
Copy Markdown
Contributor

@georgecwan georgecwan commented Dec 11, 2023

Fixes issue where JsPartitionedTable returns the keyColumns and keyColumn types in the constituent table's column order which doesn't always match the partitioned table's column order.

@georgecwan georgecwan requested a review from niloc132 December 11, 2023 15:08
@georgecwan georgecwan self-assigned this Dec 11, 2023
@georgecwan georgecwan changed the title fix: JsPartitionedTable keyColumn and keyColumn types ordering fix: JsPartitionedTable keyColumn and keyColumnTypes ordering Dec 11, 2023
@georgecwan georgecwan closed this Dec 11, 2023
@georgecwan georgecwan force-pushed the fix-partition-keycolumn-order branch from 9c8eebc to 414be28 Compare December 11, 2023 15:25
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 11, 2023
@georgecwan georgecwan reopened this Dec 11, 2023
@georgecwan georgecwan marked this pull request as ready for review December 11, 2023 17:48
Comment on lines +104 to +110
ColumnDefinition columnDefinition = tableDefinition.getColumnsByName().get(false).get(name);
int index = 0;
while (!columns[index].getName().equals(name)) {
index++;
}
keyColumnTypes.add(columnDefinition.getType());
keyColumns[keyColumns.length] = columns[index];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to loop twice, i think this would do the job too?

Suggested change
ColumnDefinition columnDefinition = tableDefinition.getColumnsByName().get(false).get(name);
int index = 0;
while (!columns[index].getName().equals(name)) {
index++;
}
keyColumnTypes.add(columnDefinition.getType());
keyColumns[keyColumns.length] = columns[index];
ColumnDefinition columnDefinition = tableDefinition.getColumnsByName().get(false).get(name);
keyColumnTypes.add(columnDefinition.getType());
keyColumns[keyColumns.length] = columns[columnDefinition.getIndex()];

@georgecwan georgecwan requested a review from niloc132 December 18, 2023 21:12
@georgecwan georgecwan force-pushed the fix-partition-keycolumn-order branch from 2d56f1f to 12f0eec Compare December 18, 2023 21:16
@georgecwan georgecwan merged commit 98efe77 into deephaven:main Dec 19, 2023
@georgecwan georgecwan deleted the fix-partition-keycolumn-order branch December 19, 2023 16:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants