Skip to content

Commit

Permalink
Server-generated column statistics (#4680)
Browse files Browse the repository at this point in the history
Reintroduces the column statistics feature from DHE. This code is
copied, with a few changes to how it behaves and how it functions:

 * Results are sent to the client in a static table rather than a
 simple object payload.
 * Client can control the max number of unique values to display,
 up to a point (previously the max was technically 19, new default
 is 20).
 * Non-Comparable objects now have their "popularity" counts as well
 as Comparable, until a max limit is reached. Only the most common 20
 entries will be sent to the client.
 * Deephaven "null" values are used to represent that a standard
 deviation or average cannot be computed.

Note that until #188 is solved, the JS API and web UI will not display
the unique value list.

Fixes #697
  • Loading branch information
niloc132 authored Nov 2, 2023
1 parent c708dc6 commit 7066260
Show file tree
Hide file tree
Showing 35 changed files with 3,989 additions and 329 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ public void onCallStartedMessageStream(AuthContext authContext) {}

public void onMessageReceivedMessageStream(AuthContext authContext, StreamRequest request) {}

public void onMessageReceivedOpenMessageStream(AuthContext authContext,
StreamRequest request) {}
public void onMessageReceivedOpenMessageStream(AuthContext authContext, StreamRequest request) {}

public void onMessageReceivedNextMessageStream(AuthContext authContext,
StreamRequest request) {}
public void onMessageReceivedNextMessageStream(AuthContext authContext, StreamRequest request) {}
}

class DenyAll implements ObjectServiceAuthWiring {
Expand All @@ -112,13 +110,11 @@ public void onMessageReceivedMessageStream(AuthContext authContext, StreamReques
ServiceAuthWiring.operationNotAllowed();
}

public void onMessageReceivedOpenMessageStream(AuthContext authContext,
StreamRequest request) {
public void onMessageReceivedOpenMessageStream(AuthContext authContext, StreamRequest request) {
ServiceAuthWiring.operationNotAllowed();
}

public void onMessageReceivedNextMessageStream(AuthContext authContext,
StreamRequest request) {
public void onMessageReceivedNextMessageStream(AuthContext authContext, StreamRequest request) {
ServiceAuthWiring.operationNotAllowed();
}
}
Expand All @@ -144,15 +140,13 @@ public void onMessageReceivedMessageStream(AuthContext authContext, StreamReques
}
}

public void onMessageReceivedOpenMessageStream(AuthContext authContext,
StreamRequest request) {
public void onMessageReceivedOpenMessageStream(AuthContext authContext, StreamRequest request) {
if (delegate != null) {
delegate.onMessageReceivedOpenMessageStream(authContext, request);
}
}

public void onMessageReceivedNextMessageStream(AuthContext authContext,
StreamRequest request) {
public void onMessageReceivedNextMessageStream(AuthContext authContext, StreamRequest request) {
if (delegate != null) {
delegate.onMessageReceivedNextMessageStream(authContext, request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.deephaven.proto.backplane.grpc.AjRajTablesRequest;
import io.deephaven.proto.backplane.grpc.ApplyPreviewColumnsRequest;
import io.deephaven.proto.backplane.grpc.AsOfJoinTablesRequest;
import io.deephaven.proto.backplane.grpc.ColumnStatisticsRequest;
import io.deephaven.proto.backplane.grpc.ComboAggregateRequest;
import io.deephaven.proto.backplane.grpc.CreateInputTableRequest;
import io.deephaven.proto.backplane.grpc.CrossJoinTablesRequest;
Expand Down Expand Up @@ -514,6 +515,17 @@ void checkPermissionSeekRow(AuthContext authContext, SeekRowRequest request,
void checkPermissionMetaTable(AuthContext authContext, MetaTableRequest request,
List<Table> sourceTables);

/**
* Authorize a request to ComputeColumnStatistics.
*
* @param authContext the authentication context of the request
* @param request the request to authorize
* @param sourceTables the operation's source tables
* @throws io.grpc.StatusRuntimeException if the user is not authorized to invoke ComputeColumnStatistics
*/
void checkPermissionComputeColumnStatistics(AuthContext authContext,
ColumnStatisticsRequest request, List<Table> sourceTables);

/**
* A default implementation that funnels all requests to invoke {@code checkPermission}.
*/
Expand Down Expand Up @@ -729,6 +741,11 @@ public void checkPermissionMetaTable(AuthContext authContext, MetaTableRequest r
List<Table> sourceTables) {
checkPermission(authContext, sourceTables);
}

public void checkPermissionComputeColumnStatistics(AuthContext authContext,
ColumnStatisticsRequest request, List<Table> sourceTables) {
checkPermission(authContext, sourceTables);
}
}

/**
Expand Down Expand Up @@ -1045,5 +1062,12 @@ public void checkPermissionMetaTable(AuthContext authContext, MetaTableRequest r
delegate.checkPermissionMetaTable(authContext, request, sourceTables);
}
}

public void checkPermissionComputeColumnStatistics(AuthContext authContext,
ColumnStatisticsRequest request, List<Table> sourceTables) {
if (delegate != null) {
delegate.checkPermissionComputeColumnStatistics(authContext, request, sourceTables);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7066260

Please sign in to comment.