Skip to content

Commit

Permalink
Revert remaining .proto changes. Add unimplemented rejection for gRPC…
Browse files Browse the repository at this point in the history
… API.
  • Loading branch information
rcaudy committed Dec 1, 2021
1 parent 7327bbd commit 68a1d43
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public interface TableModule {
@BatchOpCode(BatchTableRequest.Operation.OpCase.EXACT_JOIN)
GrpcTableOperation<?> bindOperationExactJoin(JoinTablesGrpcImpl.ExactJoinTablesGrpcImpl op);

@Binds
@IntoMap
@BatchOpCode(BatchTableRequest.Operation.OpCase.LEFT_JOIN)
GrpcTableOperation<?> bindOperationLeftJoin(JoinTablesGrpcImpl.LeftJoinTablesGrpcImpl op);

@Binds
@IntoMap
@BatchOpCode(BatchTableRequest.Operation.OpCase.NATURAL_JOIN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.deephaven.proto.backplane.grpc.FlattenRequest;
import io.deephaven.proto.backplane.grpc.HeadOrTailByRequest;
import io.deephaven.proto.backplane.grpc.HeadOrTailRequest;
import io.deephaven.proto.backplane.grpc.LeftJoinTablesRequest;
import io.deephaven.proto.backplane.grpc.MergeTablesRequest;
import io.deephaven.proto.backplane.grpc.NaturalJoinTablesRequest;
import io.deephaven.proto.backplane.grpc.RunChartDownsampleRequest;
Expand Down Expand Up @@ -231,6 +232,12 @@ public void exactJoinTables(final ExactJoinTablesRequest request,
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.EXACT_JOIN, request, responseObserver);
}

@Override
public void leftJoinTables(LeftJoinTablesRequest request,
StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.LEFT_JOIN, request, responseObserver);
}

@Override
public void asOfJoinTables(AsOfJoinTablesRequest request,
StreamObserver<ExportedTableCreationResponse> responseObserver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
import io.deephaven.proto.backplane.grpc.BatchTableRequest;
import io.deephaven.proto.backplane.grpc.CrossJoinTablesRequest;
import io.deephaven.proto.backplane.grpc.ExactJoinTablesRequest;
import io.deephaven.proto.backplane.grpc.LeftJoinTablesRequest;
import io.deephaven.proto.backplane.grpc.NaturalJoinTablesRequest;
import io.deephaven.proto.backplane.grpc.Ticket;
import io.grpc.StatusRuntimeException;

import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

Expand Down Expand Up @@ -175,6 +175,28 @@ public static Table doJoin(final Table lhs, final Table rhs,
}
}

@Singleton
public static class LeftJoinTablesGrpcImpl extends JoinTablesGrpcImpl<LeftJoinTablesRequest> {

private static final MultiDependencyFunction<LeftJoinTablesRequest> EXTRACT_DEPS =
(request) -> Lists.newArrayList(request.getLeftId(), request.getRightId());

@Inject
public LeftJoinTablesGrpcImpl(final UpdateGraphProcessor updateGraphProcessor) {
super(updateGraphProcessor, BatchTableRequest.Operation::getLeftJoin, LeftJoinTablesRequest::getResultId,
EXTRACT_DEPS,
LeftJoinTablesRequest::getColumnsToMatchList, LeftJoinTablesRequest::getColumnsToAddList,
LeftJoinTablesGrpcImpl::doJoin);
}

public static Table doJoin(final Table lhs, final Table rhs,
final MatchPair[] columnsToMatch, final MatchPair[] columnsToAdd,
final LeftJoinTablesRequest request) {
throw GrpcUtil.statusRuntimeException(Code.UNIMPLEMENTED,
"LeftJoinTables is currently unimplemented");
}
}

@Singleton
public static class NaturalJoinTablesGrpcImpl extends JoinTablesGrpcImpl<NaturalJoinTablesRequest> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ service TableService {
*/
rpc ExactJoinTables(ExactJoinTablesRequest) returns (ExportedTableCreationResponse) {}

/*
* Returns the result of a left join operation.
*/
rpc LeftJoinTables(LeftJoinTablesRequest) returns (ExportedTableCreationResponse) {}

/*
* Returns the result of an as of join operation.
*/
Expand Down Expand Up @@ -361,6 +366,14 @@ message ExactJoinTablesRequest {
repeated string columns_to_add = 5;
}

message LeftJoinTablesRequest {
Ticket result_id = 1;
TableReference left_id = 2;
TableReference right_id = 3;
repeated string columns_to_match = 4;
repeated string columns_to_add = 5;
}

message AsOfJoinTablesRequest {
enum MatchRule {
LESS_THAN_EQUAL = 0;
Expand Down Expand Up @@ -630,11 +643,12 @@ message BatchTableRequest {
CrossJoinTablesRequest cross_join = 23;
NaturalJoinTablesRequest natural_join = 24;
ExactJoinTablesRequest exact_join = 25;
AsOfJoinTablesRequest as_of_join = 26;
FetchTableRequest fetch_table = 27;
FetchPandasTableRequest fetch_pandas_table = 28;
ApplyPreviewColumnsRequest apply_preview_columns = 29;
CreateInputTableRequest create_input_table = 30;
LeftJoinTablesRequest left_join = 26;
AsOfJoinTablesRequest as_of_join = 27;
FetchTableRequest fetch_table = 28;
FetchPandasTableRequest fetch_pandas_table = 29;
ApplyPreviewColumnsRequest apply_preview_columns = 30;
CreateInputTableRequest create_input_table = 31;
}
}
}
264 changes: 178 additions & 86 deletions pyclient/pydeephaven/proto/table_pb2.py

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions pyclient/pydeephaven/proto/table_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def __init__(self, channel):
request_serializer=deephaven_dot_proto_dot_table__pb2.ExactJoinTablesRequest.SerializeToString,
response_deserializer=deephaven_dot_proto_dot_table__pb2.ExportedTableCreationResponse.FromString,
)
self.LeftJoinTables = channel.unary_unary(
'/io.deephaven.proto.backplane.grpc.TableService/LeftJoinTables',
request_serializer=deephaven_dot_proto_dot_table__pb2.LeftJoinTablesRequest.SerializeToString,
response_deserializer=deephaven_dot_proto_dot_table__pb2.ExportedTableCreationResponse.FromString,
)
self.AsOfJoinTables = channel.unary_unary(
'/io.deephaven.proto.backplane.grpc.TableService/AsOfJoinTables',
request_serializer=deephaven_dot_proto_dot_table__pb2.AsOfJoinTablesRequest.SerializeToString,
Expand Down Expand Up @@ -399,6 +404,14 @@ def ExactJoinTables(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def LeftJoinTables(self, request, context):
"""
Returns the result of a left join operation.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def AsOfJoinTables(self, request, context):
"""
Returns the result of an as of join operation.
Expand Down Expand Up @@ -608,6 +621,11 @@ def add_TableServiceServicer_to_server(servicer, server):
request_deserializer=deephaven_dot_proto_dot_table__pb2.ExactJoinTablesRequest.FromString,
response_serializer=deephaven_dot_proto_dot_table__pb2.ExportedTableCreationResponse.SerializeToString,
),
'LeftJoinTables': grpc.unary_unary_rpc_method_handler(
servicer.LeftJoinTables,
request_deserializer=deephaven_dot_proto_dot_table__pb2.LeftJoinTablesRequest.FromString,
response_serializer=deephaven_dot_proto_dot_table__pb2.ExportedTableCreationResponse.SerializeToString,
),
'AsOfJoinTables': grpc.unary_unary_rpc_method_handler(
servicer.AsOfJoinTables,
request_deserializer=deephaven_dot_proto_dot_table__pb2.AsOfJoinTablesRequest.FromString,
Expand Down Expand Up @@ -1100,6 +1118,23 @@ def ExactJoinTables(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def LeftJoinTables(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/io.deephaven.proto.backplane.grpc.TableService/LeftJoinTables',
deephaven_dot_proto_dot_table__pb2.LeftJoinTablesRequest.SerializeToString,
deephaven_dot_proto_dot_table__pb2.ExportedTableCreationResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def AsOfJoinTables(request,
target,
Expand Down

0 comments on commit 68a1d43

Please sign in to comment.