Search in sources :

Example 1 with NaturalJoinTablesRequest

use of io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.NaturalJoinTablesRequest in project deephaven-core by deephaven.

the class JsTable method naturalJoin.

@JsMethod
public Promise<JsTable> naturalJoin(JsTable rightTable, JsArray<String> columnsToMatch, @JsOptional JsArray<String> columnsToAdd) {
    if (rightTable.workerConnection != workerConnection) {
        throw new IllegalStateException("Table argument passed to join is not from the same worker as current table");
    }
    return workerConnection.newState((c, state, metadata) -> {
        NaturalJoinTablesRequest request = new NaturalJoinTablesRequest();
        request.setLeftId(state().getHandle().makeTableReference());
        request.setRightId(rightTable.state().getHandle().makeTableReference());
        request.setResultId(state.getHandle().makeTicket());
        request.setColumnsToMatchList(columnsToMatch);
        request.setColumnsToAddList(columnsToAdd);
        workerConnection.tableServiceClient().naturalJoinTables(request, metadata, c::apply);
    }, "naturalJoin(" + rightTable + ", " + columnsToMatch + ", " + columnsToAdd + ")").refetch(this, workerConnection.metadata()).then(state -> Promise.resolve(new JsTable(workerConnection, state)));
}
Also used : NaturalJoinTablesRequest(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.NaturalJoinTablesRequest) JsMethod(jsinterop.annotations.JsMethod)

Aggregations

NaturalJoinTablesRequest (io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.NaturalJoinTablesRequest)1 JsMethod (jsinterop.annotations.JsMethod)1