Search in sources :

Example 1 with CrossJoinTablesRequest

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

the class JsTable method crossJoin.

@JsMethod
public Promise<JsTable> crossJoin(JsTable rightTable, JsArray<String> columnsToMatch, @JsOptional JsArray<String> columnsToAdd, @JsOptional Double reserve_bits) {
    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) -> {
        CrossJoinTablesRequest request = new CrossJoinTablesRequest();
        request.setLeftId(state().getHandle().makeTableReference());
        request.setRightId(rightTable.state().getHandle().makeTableReference());
        request.setResultId(state.getHandle().makeTicket());
        request.setColumnsToMatchList(columnsToMatch);
        request.setColumnsToAddList(columnsToAdd);
        if (reserve_bits != null) {
            request.setReserveBits(reserve_bits);
        }
        workerConnection.tableServiceClient().crossJoinTables(request, metadata, c::apply);
    }, "join(" + rightTable + ", " + columnsToMatch + ", " + columnsToAdd + "," + reserve_bits + ")").refetch(this, workerConnection.metadata()).then(state -> Promise.resolve(new JsTable(workerConnection, state)));
}
Also used : CrossJoinTablesRequest(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.CrossJoinTablesRequest) JsMethod(jsinterop.annotations.JsMethod)

Aggregations

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