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: JsPartitionedTable keyColumn and keyColumnTypes ordering #4931

Merged
merged 3 commits into from
Dec 19, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
import jsinterop.annotations.JsType;
import jsinterop.base.Js;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

/**
* Represents a set of Tables each corresponding to some key. The keys are available locally, but a call must be made to
Expand Down Expand Up @@ -95,19 +92,21 @@ public Promise<JsPartitionedTable> refetch() {
WebBarrageUtils.readSchemaMessage(descriptor.getConstituentDefinitionSchema_asU8()));
ColumnDefinition[] columnDefinitions = tableDefinition.getColumns();
Column[] columns = new Column[0];
Column[] keyColumns = new Column[0];
for (int i = 0; i < columnDefinitions.length; i++) {
ColumnDefinition columnDefinition = columnDefinitions[i];
Column column = columnDefinition.makeJsColumn(columns.length, tableDefinition.getColumnsByName());
columns[columns.length] = column;
if (descriptor.getKeyColumnNamesList().indexOf(columnDefinition.getName()) != -1) {
keyColumnTypes.add(columnDefinition.getType());
keyColumns[keyColumns.length] = column;
}
}
Column[] keyColumns = new Column[0];
JsArray<String> keyColumnNames = descriptor.getKeyColumnNamesList();
for (int i = 0; i < keyColumnNames.length; i++) {
String name = keyColumnNames.getAt(i);
ColumnDefinition columnDefinition = tableDefinition.getColumnsByName().get(false).get(name);
keyColumnTypes.add(columnDefinition.getType());
keyColumns[keyColumns.length] = columns[columnDefinition.getColumnIndex()];
}
this.columns = JsObject.freeze(columns);
this.keyColumns = JsObject.freeze(keyColumns);

return w.getExportedObjects()[0].fetch();
}).then(result -> {
keys = (JsTable) result;
Expand Down
Loading