Skip to content

Commit

Permalink
Rename symbols in .proto files to follow standard conventions (#674)
Browse files Browse the repository at this point in the history
Fixes #673
  • Loading branch information
niloc132 authored May 26, 2021
1 parent 0142a72 commit 902f60d
Show file tree
Hide file tree
Showing 77 changed files with 3,319 additions and 3,314 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ private void startConsole() {
.onNext(response -> scheduler.runImmediately(this::awaitCommand))
.build());
LogSubscriptionRequest request = LogSubscriptionRequest.newBuilder()
.addLevel("STDOUT")
.addLevel("STDERR")
.addLevels("STDOUT")
.addLevels("STDERR")
.setLastSeenLogTimestamp(System.currentTimeMillis() * 1000) // don't replay any logs that came before now
.build();
consoleServiceGrpc.subscribeToLogs(request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ private void runScript() {
final Ticket t2 = SessionState.exportIdToTicket(nextExportId());

tableService.batch(BatchTableRequest.newBuilder()
.addOp(BatchTableRequest.Operation.newBuilder().setTimeTable(TimeTableRequest.newBuilder()
.addOps(BatchTableRequest.Operation.newBuilder().setTimeTable(TimeTableRequest.newBuilder()
.setPeriodNanos(1_000_000_000)))
.addOp(BatchTableRequest.Operation.newBuilder().setTimeTable(TimeTableRequest.newBuilder()
.addOps(BatchTableRequest.Operation.newBuilder().setTimeTable(TimeTableRequest.newBuilder()
.setPeriodNanos(12_000_000)
.setResultId(t2)))
.addOp(BatchTableRequest.Operation.newBuilder().setUpdate(SelectOrUpdateRequest.newBuilder()
.addOps(BatchTableRequest.Operation.newBuilder().setUpdate(SelectOrUpdateRequest.newBuilder()
.setResultId(exportTable)
.setSourceId(TableReference.newBuilder().setBatchOffset(0))
.addColumnSpecs("key = i")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ protected void destroy() {
@Override
public void record(LogBufferRecord record) {
// only pass levels the client wants
if (request.getLevelCount() != 0 && !request.getLevelList().contains(record.getLevel().getName())) {
if (request.getLevelsCount() != 0 && !request.getLevelsList().contains(record.getLevel().getName())) {
return;
}

Expand Down
20 changes: 10 additions & 10 deletions grpc-api/src/main/java/io/deephaven/grpc_api/table/TableModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,37 @@ public interface TableModule {
@Binds @IntoSet
BindableService bindTableServiceGrpcImpl(TableServiceGrpcImpl tableService);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.EMPTYTABLE)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.EMPTY_TABLE)
GrpcTableOperation<?> bindOperationEmptyTable(EmptyTableGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.TIMETABLE)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.TIME_TABLE)
GrpcTableOperation<?> bindOperationTimeTable(TimeTableGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.MERGE)
GrpcTableOperation<?> bindOperationMergeTables(MergeTablesGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.SELECTDISTINCT)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.SELECT_DISTINCT)
GrpcTableOperation<?> bindOperationSelectDistinct(SelectDistinctGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.UPDATE)
GrpcTableOperation<?> bindOperationUpdate(UpdateOrSelectGrpcImpl.UpdateGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.LAZYUPDATE)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.LAZY_UPDATE)
GrpcTableOperation<?> bindOperationLazyUpdate(UpdateOrSelectGrpcImpl.LazyUpdateGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.VIEW)
GrpcTableOperation<?> bindOperationView(UpdateOrSelectGrpcImpl.ViewGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.UPDATEVIEW)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.UPDATE_VIEW)
GrpcTableOperation<?> bindOperationUpdateView(UpdateOrSelectGrpcImpl.UpdateViewGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.SELECT)
GrpcTableOperation<?> bindOperationSelect(UpdateOrSelectGrpcImpl.SelectGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.HEADBY)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.HEAD_BY)
GrpcTableOperation<?> bindOperationHeadBy(HeadOrTailByGrpcImpl.HeadByGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.TAILBY)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.TAIL_BY)
GrpcTableOperation<?> bindOperationTailBy(HeadOrTailByGrpcImpl.TailByGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.HEAD)
Expand All @@ -77,7 +77,7 @@ public interface TableModule {
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.UNGROUP)
GrpcTableOperation<?> bindOperationUngroup(UngroupGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.COMBOAGGREGATE)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.COMBO_AGGREGATE)
GrpcTableOperation<?> bindOperationComboAgg(ComboAggregateGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.JOIN)
Expand All @@ -86,7 +86,7 @@ public interface TableModule {
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.FILTER)
GrpcTableOperation<?> bindOperationFilterTable(FilterTableGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.UNSTRUCTUREDFILTER)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.UNSTRUCTURED_FILTER)
GrpcTableOperation<?> bindOperationUnstructuredFilterTable(UnstructuredFilterTableGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.SNAPSHOT)
Expand All @@ -95,7 +95,7 @@ public interface TableModule {
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.SORT)
GrpcTableOperation<?> bindOperationSortTable(SortTableGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.DROPCOLUMNS)
@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.DROP_COLUMNS)
GrpcTableOperation<?> bindOperationDropColumns(DropColumnsGrpcImpl op);

@Binds @IntoMap @BatchOpCode(BatchTableRequest.Operation.OpCase.FLATTEN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ private <T> GrpcTableOperation<T> getOp(final BatchTableRequest.Operation.OpCase

@Override
public void emptyTable(final EmptyTableRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.EMPTYTABLE, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.EMPTY_TABLE, request, responseObserver);
}

@Override
public void timeTable(final TimeTableRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.TIMETABLE, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.TIME_TABLE, request, responseObserver);
}

@Override
Expand All @@ -90,7 +90,7 @@ public void mergeTables(final MergeTablesRequest request, final StreamObserver<E

@Override
public void selectDistinct(final SelectDistinctRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.SELECTDISTINCT, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.SELECT_DISTINCT, request, responseObserver);
}

@Override
Expand All @@ -100,7 +100,7 @@ public void update(final SelectOrUpdateRequest request, final StreamObserver<Exp

@Override
public void lazyUpdate(final SelectOrUpdateRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.LAZYUPDATE, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.LAZY_UPDATE, request, responseObserver);
}

@Override
Expand All @@ -110,7 +110,7 @@ public void view(final SelectOrUpdateRequest request, final StreamObserver<Expor

@Override
public void updateView(final SelectOrUpdateRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.UPDATEVIEW, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.UPDATE_VIEW, request, responseObserver);
}

@Override
Expand All @@ -120,12 +120,12 @@ public void select(final SelectOrUpdateRequest request, final StreamObserver<Exp

@Override
public void headBy(final HeadOrTailByRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.HEADBY, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.HEAD_BY, request, responseObserver);
}

@Override
public void tailBy(final HeadOrTailByRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.TAILBY, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.TAIL_BY, request, responseObserver);
}

@Override
Expand All @@ -145,7 +145,7 @@ public void ungroup(final UngroupRequest request, final StreamObserver<ExportedT

@Override
public void comboAggregate(final ComboAggregateRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.COMBOAGGREGATE, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.COMBO_AGGREGATE, request, responseObserver);
}

@Override
Expand All @@ -160,7 +160,7 @@ public void snapshot(final SnapshotTableRequest request, final StreamObserver<Ex

@Override
public void dropColumns(final DropColumnsRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.DROPCOLUMNS, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.DROP_COLUMNS, request, responseObserver);
}

@Override
Expand All @@ -170,7 +170,7 @@ public void filter(final FilterTableRequest request, final StreamObserver<Export

@Override
public void unstructuredFilter(final UnstructuredFilterTableRequest request, final StreamObserver<ExportedTableCreationResponse> responseObserver) {
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.UNSTRUCTUREDFILTER, request, responseObserver);
oneShotOperationWrapper(BatchTableRequest.Operation.OpCase.UNSTRUCTURED_FILTER, request, responseObserver);
}

@Override
Expand All @@ -189,7 +189,7 @@ public void batch(final BatchTableRequest request, final StreamObserver<Exported
final SessionState session = sessionService.getCurrentSession();

// step 1: initialize exports
final List<BatchExportBuilder> exportBuilders = request.getOpList().stream()
final List<BatchExportBuilder> exportBuilders = request.getOpsList().stream()
.map(op -> new BatchExportBuilder(session, op))
.collect(Collectors.toList());

Expand All @@ -203,7 +203,7 @@ public void batch(final BatchTableRequest request, final StreamObserver<Exported
switch (ref.getRefCase()) {
case TICKET:
return session.getExport(ref.getTicket());
case BATCHOFFSET:
case BATCH_OFFSET:
final int offset = ref.getBatchOffset();
if (offset < 0 || offset >= exportBuilders.size()) {
throw GrpcUtil.statusRuntimeException(Code.INVALID_ARGUMENT, "invalid table reference: " + ref);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public Table create(final ComboAggregateRequest request, final List<SessionState

final Table result;
if (!request.getForceCombo() && request.getAggregatesCount() == 1
&& request.getAggregates(0).getType() != ComboAggregateRequest.AggType.Percentile
&& request.getAggregates(0).getType() != ComboAggregateRequest.AggType.PERCENTILE
&& request.getAggregates(0).getMatchPairsCount() == 0) {
// This is a special case with a special operator that can be invoked right off of the table api.
result = singleAggregateHelper(parent, groupByColumns, request.getAggregates(0));
Expand All @@ -51,31 +51,31 @@ public Table create(final ComboAggregateRequest request, final List<SessionState

private static Table singleAggregateHelper(final Table parent, final SelectColumn[] groupByColumns, final ComboAggregateRequest.Aggregate aggregate) {
switch (aggregate.getType()) {
case Sum:
case SUM:
return parent.sumBy(groupByColumns);
case AbsSum:
case ABS_SUM:
return parent.absSumBy(groupByColumns);
case Array:
case ARRAY:
return parent.by(groupByColumns);
case Avg:
case AVG:
return parent.avgBy(groupByColumns);
case Count:
case COUNT:
return parent.countBy(aggregate.getColumnName(), groupByColumns);
case First:
case FIRST:
return parent.firstBy(groupByColumns);
case Last:
case LAST:
return parent.lastBy(groupByColumns);
case Min:
case MIN:
return parent.minBy(groupByColumns);
case Max:
case MAX:
return parent.maxBy(groupByColumns);
case Median:
case MEDIAN:
return parent.medianBy(groupByColumns);
case Std:
case STD:
return parent.stdBy(groupByColumns);
case Var:
case VAR:
return parent.varBy(groupByColumns);
case WeightedAvg:
case WEIGHTED_AVG:
return parent.wavgBy(aggregate.getColumnName(), groupByColumns);
default:
throw new UnsupportedOperationException("Unsupported aggregate: " + aggregate.getType());
Expand All @@ -96,7 +96,7 @@ private static Table comboAggregateHelper(final Table parent, final SelectColumn
// if not specified, we apply the aggregate to all columns not "otherwise involved"
matchPairs = Arrays.stream(parent.getColumns())
.map(DataColumn::getName)
.filter(n -> !(groupByColumnSet.contains(n) || (agg.getType() == ComboAggregateRequest.AggType.WeightedAvg && agg.getColumnName().equals(n))))
.filter(n -> !(groupByColumnSet.contains(n) || (agg.getType() == ComboAggregateRequest.AggType.WEIGHTED_AVG && agg.getColumnName().equals(n))))
.toArray(String[]::new);
} else {
matchPairs = agg.getMatchPairsList().toArray(CollectionUtil.ZERO_LENGTH_STRING_ARRAY);
Expand All @@ -106,33 +106,33 @@ private static Table comboAggregateHelper(final Table parent, final SelectColumn

final Supplier<ComboAggregateFactory.ComboBy> comboMapper = () -> {
switch (agg.getType()) {
case Sum:
case SUM:
return ComboAggregateFactory.AggSum(matchPairs);
case AbsSum:
case ABS_SUM:
return ComboAggregateFactory.AggAbsSum(matchPairs);
case Array:
case ARRAY:
return ComboAggregateFactory.AggArray(matchPairs);
case Avg:
case AVG:
return ComboAggregateFactory.AggAvg(matchPairs);
case Count:
case COUNT:
return ComboAggregateFactory.AggCount(agg.getColumnName());
case First:
case FIRST:
return ComboAggregateFactory.AggFirst(matchPairs);
case Last:
case LAST:
return ComboAggregateFactory.AggLast(matchPairs);
case Min:
case MIN:
return ComboAggregateFactory.AggMin(matchPairs);
case Max:
case MAX:
return ComboAggregateFactory.AggMax(matchPairs);
case Median:
case MEDIAN:
return ComboAggregateFactory.AggMed(matchPairs);
case Percentile:
case PERCENTILE:
return ComboAggregateFactory.AggPct(agg.getPercentile(), agg.getAvgMedian(), matchPairs);
case Std:
case STD:
return ComboAggregateFactory.AggStd(matchPairs);
case Var:
case VAR:
return ComboAggregateFactory.AggVar(matchPairs);
case WeightedAvg:
case WEIGHTED_AVG:
return ComboAggregateFactory.AggWAvg(agg.getColumnName(), matchPairs);
default:
throw new UnsupportedOperationException("Unsupported aggregate: " + agg.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ public Table create(final JoinTablesRequest request, final List<SessionState.Exp

final FunctionalInterfaces.ThrowingSupplier<Table, RuntimeException> doJoin = () -> {
switch(request.getJoinType()) {
case CrossJoin:
case CROSS_JOIN:
return lhs.join(rhs, columnsToMatch, columnsToAdd);
case NaturalJoin:
case NATURAL_JOIN:
return lhs.naturalJoin(rhs, columnsToMatch, columnsToAdd);
case AsOfJoin:
case AS_OF_JOIN:
return lhs.aj(rhs, columnsToMatch, columnsToAdd);
case ReverseAsOfJoin:
case REVERSE_AS_OF_JOIN:
return lhs.raj(rhs, columnsToMatch, columnsToAdd);
case ExactJoin:
case EXACT_JOIN:
return lhs.exactJoin(rhs, columnsToMatch, columnsToAdd);
case LeftJoin:
case LEFT_JOIN:
return lhs.leftJoin(rhs, columnsToMatch, columnsToAdd);
default:
throw new RuntimeException("Unsupported join type: " + request.getJoinType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Table create(final UnstructuredFilterTableRequest request, final List<Ses
Assert.eq(sourceTables.size(), "sourceTables.size()", 1);

final Table parent = sourceTables.get(0).get();
final String[] filters = request.getFilterList().toArray(CollectionUtil.ZERO_LENGTH_STRING_ARRAY);
final String[] filters = request.getFiltersList().toArray(CollectionUtil.ZERO_LENGTH_STRING_ARRAY);
final SelectFilter[] selectFilters = ColumnExpressionValidator.validateSelectFilters(filters, parent);
return parent.where(selectFilters);
}
Expand Down
Loading

0 comments on commit 902f60d

Please sign in to comment.