Skip to content

Commit

Permalink
Drop columns from key table
Browse files Browse the repository at this point in the history
  • Loading branch information
georgecwan committed Nov 30, 2023
1 parent c90e574 commit cac3c63
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.partitionedtable_pb.GetTableRequest;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.partitionedtable_pb.MergeRequest;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.partitionedtable_pb.PartitionedTableDescriptor;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.DropColumnsRequest;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.ticket_pb.TypedTicket;
import io.deephaven.web.client.api.barrage.WebBarrageUtils;
import io.deephaven.web.client.api.barrage.def.ColumnDefinition;
Expand All @@ -23,6 +24,7 @@
import io.deephaven.web.shared.data.RangeSet;
import io.deephaven.web.shared.fu.JsConsumer;
import jsinterop.annotations.JsIgnore;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import jsinterop.base.Js;
Expand Down Expand Up @@ -284,13 +286,21 @@ public Column[] getColumns() {
}

/**
* A Table object containing all currently known keys used for this partitioned table.
* Fetch a table containing all the valid keys of the partitioned table.
*
* @return Table
* @return Promise of a Table
*/
@JsProperty
public JsTable getKeyTable() {
return keys;
@JsMethod
public Promise<JsTable> getKeyTable() {
return connection.newState((c, state, metadata) -> {
DropColumnsRequest drop = new DropColumnsRequest();
drop.setColumnNamesList(new String[]{descriptor.getConstituentColumnName()});
drop.setSourceId(keys.state().getHandle().makeTableReference());
drop.setResultId(state.getHandle().makeTicket());
connection.tableServiceClient().dropColumns(drop, metadata, c::apply);
}, "drop constituent column")
.refetch(this, connection.metadata())
.then(state -> Promise.resolve(new JsTable(connection, state)));
}

/**
Expand Down

0 comments on commit cac3c63

Please sign in to comment.