Search in sources :

Example 1 with AsOfJoinTablesRequest

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

the class JsTable method asOfJoin.

@JsMethod
public Promise<JsTable> asOfJoin(JsTable rightTable, JsArray<String> columnsToMatch, @JsOptional JsArray<String> columnsToAdd, @JsOptional String asOfMatchRule) {
    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) -> {
        AsOfJoinTablesRequest request = new AsOfJoinTablesRequest();
        request.setLeftId(state().getHandle().makeTableReference());
        request.setRightId(rightTable.state().getHandle().makeTableReference());
        request.setResultId(state.getHandle().makeTicket());
        request.setColumnsToMatchList(columnsToMatch);
        request.setColumnsToAddList(columnsToAdd);
        if (asOfMatchRule != null) {
            request.setAsOfMatchRule(Js.asPropertyMap(AsOfJoinTablesRequest.MatchRule).getAsAny(asOfMatchRule).asDouble());
        }
        workerConnection.tableServiceClient().asOfJoinTables(request, metadata, c::apply);
    }, "asOfJoin(" + rightTable + ", " + columnsToMatch + ", " + columnsToAdd + "," + asOfMatchRule + ")").refetch(this, workerConnection.metadata()).then(state -> Promise.resolve(new JsTable(workerConnection, state)));
}
Also used : AsOfJoinTablesRequest(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.AsOfJoinTablesRequest) JsMethod(jsinterop.annotations.JsMethod)

Aggregations

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