Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore | adding the support for querying multi interaction filters #203

Merged
merged 8 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.slf4j.LoggerFactory;

class GatewayServiceEntityEdgeFetcher {

private static final Logger LOG = LoggerFactory.getLogger(GatewayServiceEntityEdgeFetcher.class);
static final EdgeResultSet EMPTY_EDGE_RESULT_SET = new ConvertedEdgeResultSet(List.of());

Expand Down Expand Up @@ -119,16 +120,17 @@

return zip(
this.attributeMapConverter.convert(
edgeSetGroupRequest.attributeRequests(), response.getAttributeMap()),
edgeSetGroupRequest.getAllAttributeRequests(), response.getAttributeMap()),

Check warning on line 123 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityEdgeFetcher.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityEdgeFetcher.java#L123

Added line #L123 was not covered by tests
aman-bansal marked this conversation as resolved.
Show resolved Hide resolved
this.baselineMetricAggregationContainerMapConverter.convert(
edgeSetGroupRequest.metricAggregationRequests(), response.getMetricsMap()),
edgeSetGroupRequest.getAllMetricAggregationRequests(), response.getMetricsMap()),

Check warning on line 125 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityEdgeFetcher.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityEdgeFetcher.java#L125

Added line #L125 was not covered by tests
(attributes, metrics) -> (Edge) new ConvertedEdge(neighbor, attributes, metrics))
.toMaybe();
}

@lombok.Value
@Accessors(fluent = true)
private static class ConvertedEdge implements Edge {

Entity neighbor;
Map<AttributeExpression, Object> attributeValues;
Map<AttributeExpression, BaselinedMetricAggregationContainer> metricContainers;
Expand All @@ -147,6 +149,7 @@
@lombok.Value
@Accessors(fluent = true)
private static class ConvertedEdgeResultSet implements EdgeResultSet {

List<Edge> results;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.hypertrace.core.graphql.common.utils.Converter;
import org.hypertrace.gateway.service.v1.common.Expression;
import org.hypertrace.gateway.service.v1.common.Filter;
import org.hypertrace.gateway.service.v1.common.Operator;
import org.hypertrace.gateway.service.v1.entity.InteractionsRequest;
import org.hypertrace.graphql.entity.request.EdgeSetGroupRequest;
import org.hypertrace.graphql.metric.request.MetricAggregationRequest;
Expand All @@ -44,7 +45,7 @@
}

Single<InteractionsRequest> build(EdgeSetGroupRequest edgeSetRequestGroup) {
if (edgeSetRequestGroup.entityTypes().isEmpty()) {
if (edgeSetRequestGroup.edgeSetRequests().isEmpty()) {
return Single.just(InteractionsRequest.getDefaultInstance());
}

Expand All @@ -61,40 +62,49 @@

private Single<Set<Expression>> collectSelectionsAndAggregations(EdgeSetGroupRequest request) {
return this.selectionConverter
.convert(request.attributeRequests())
.mergeWith(this.aggregationConverter.convert(request.metricAggregationRequests()))
.convert(request.getAllAttributeRequests())
.mergeWith(this.aggregationConverter.convert(request.getAllMetricAggregationRequests()))

Check warning on line 66 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java#L65-L66

Added lines #L65 - L66 were not covered by tests
.toObservable()
.flatMap(Observable::fromIterable)
.collect(Collectors.toUnmodifiableSet());
}

private Single<Filter> buildEntityInteractionFilter(EdgeSetGroupRequest request) {
return Observable.fromIterable(request.entityTypes()) // add entity types filter
.collect(Collectors.toUnmodifiableSet())
// Todo: we should be using converter taking argument as logical filters with filter arg schema
return Observable.fromIterable(request.edgeSetRequests().entrySet())

Check warning on line 74 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java#L74

Added line #L74 was not covered by tests
.map(
entityTypes ->
AttributeAssociation.<FilterArgument>of(
request.neighborTypeAttribute().attributeExpressionAssociation().attribute(),
new EntityNeighborTypeFilter(
request.neighborTypeAttribute().attributeExpressionAssociation().value(),
entityTypes)))
.flatMap(
filterAssociation ->
this.filterConverter.convert(
Stream.concat(
request.filterArguments().stream(), // add all other filters
Stream.of(filterAssociation))
.collect(Collectors.toUnmodifiableSet())));
entry ->
Stream.concat(
Stream.of(buildEntityTypeFilter(request, entry.getKey())),
entry.getValue().filterArguments().stream())
.collect(Collectors.toUnmodifiableList()))
.flatMapSingle(this.filterConverter::convert)
.collect(Collectors.toUnmodifiableList())
.map(

Check warning on line 83 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java#L77-L83

Added lines #L77 - L83 were not covered by tests
childFilters ->
Filter.newBuilder()
aman-bansal marked this conversation as resolved.
Show resolved Hide resolved
.setOperator(Operator.OR)
.addAllChildFilter(childFilters)
.build());

Check warning on line 88 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java#L85-L88

Added lines #L85 - L88 were not covered by tests
}

private AttributeAssociation<FilterArgument> buildEntityTypeFilter(
EdgeSetGroupRequest request, String entityType) {
return AttributeAssociation.of(
request.neighborTypeAttribute().attributeExpressionAssociation().attribute(),

Check warning on line 94 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java#L93-L94

Added lines #L93 - L94 were not covered by tests
new EntityNeighborTypeFilter(
request.neighborTypeAttribute().attributeExpressionAssociation().value(), entityType));

Check warning on line 96 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java#L96

Added line #L96 was not covered by tests
}

@Value
@Accessors(fluent = true)
private static class EntityNeighborTypeFilter implements FilterArgument {

FilterType type = FilterType.ATTRIBUTE;
String key = null;
AttributeExpression keyExpression;
FilterOperatorType operator = FilterOperatorType.IN;
Collection<String> value;
FilterOperatorType operator = FilterOperatorType.EQUALS;
String value;

Check warning on line 107 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java#L106-L107

Added lines #L106 - L107 were not covered by tests
AttributeScope idType = null;
String idScope = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.hypertrace.core.graphql.utils.schema.SelectionQuery;
import org.hypertrace.graphql.entity.dao.EntityDao;
import org.hypertrace.graphql.entity.request.EdgeSetGroupRequest;
import org.hypertrace.graphql.entity.request.EdgeSetRequest;
import org.hypertrace.graphql.entity.request.EntityLabelRequest;
import org.hypertrace.graphql.entity.request.EntityLabelRequestBuilder;
import org.hypertrace.graphql.entity.request.EntityRequest;
Expand Down Expand Up @@ -317,12 +318,9 @@
@Value
@Accessors(fluent = true)
private static class EmptyEdgeSetGroupRequest implements EdgeSetGroupRequest {
Set<String> entityTypes = Collections.emptySet();
Collection<AttributeRequest> attributeRequests = Collections.emptyList();
Collection<MetricAggregationRequest> metricAggregationRequests = Collections.emptyList();
Collection<AttributeAssociation<FilterArgument>> filterArguments = Collections.emptyList();
AttributeRequest neighborIdAttribute = null;
AttributeRequest neighborTypeAttribute = null;
Map<String, EdgeSetRequest> edgeSetRequests = Collections.emptyMap();

@Override
public Single<EntityRequest> buildNeighborRequest(
Expand All @@ -331,6 +329,16 @@
new UnsupportedOperationException(
"Does not support fetching neighbors for joined entities"));
}

@Override
public Collection<AttributeRequest> getAllAttributeRequests() {
return Collections.emptyList();

Check warning on line 335 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java#L335

Added line #L335 was not covered by tests
}

@Override
public Collection<MetricAggregationRequest> getAllMetricAggregationRequests() {
return Collections.emptyList();

Check warning on line 340 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java#L340

Added line #L340 was not covered by tests
}
}

@Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import static io.reactivex.rxjava3.core.Single.zip;

import graphql.schema.SelectedField;
import io.grpc.Status;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.Single;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiFunction;
Expand Down Expand Up @@ -89,35 +90,18 @@
Stream<SelectedField> edgeSetFields,
EdgeType edgeType) {
Set<SelectedField> edgeFields = edgeSetFields.collect(Collectors.toUnmodifiableSet());
List<FilterArgument> filterArguments = this.getFilters(edgeFields);

if (!filterArguments.isEmpty() && edgeFields.size() > 1) {
throw Status.UNIMPLEMENTED
.withDescription("Cannot specify more than one edge type with edge filters")
.asRuntimeException();
}

Map<String, Set<SelectedField>> edgesByType = this.getEdgesByType(edgeFields.stream());
Set<SelectedField> allEdges =
edgesByType.values().stream()
.flatMap(Collection::stream)
.collect(Collectors.toUnmodifiableSet());
Map<String, Set<SelectedField>> edgesSelectionsByType =
this.getEdgesSelectionByType(edgeFields.stream());

Check warning on line 94 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L93-L94

Added lines #L93 - L94 were not covered by tests

return zip(
this.getRequestedAndRequiredAttributes(context, allEdges, edgeType),
this.getNeighborIdAttribute(context, edgeType),
this.getNeighborTypeAttribute(context, edgeType),
this.metricAggregationRequestBuilder.build(
context, HypertraceAttributeScopeString.INTERACTION, allEdges.stream()),
this.filterRequestBuilder.build(
context, HypertraceAttributeScopeString.INTERACTION, filterArguments),
(attributeRequests, neighborIdRequest, neighborTypeRequest, metricRequests, filters) ->
this.getEntityTypeToEdgeSetRequest(context, edgeType, edgeFields),

Check warning on line 99 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L99

Added line #L99 was not covered by tests
(neighborIdRequest, neighborTypeRequest, edgeRequests) ->
new DefaultEdgeSetGroupRequest(
edgesByType.keySet(),
attributeRequests,
metricRequests,
neighborIdRequest,
neighborTypeRequest,
edgeRequests,
(entityType, neighborIds) ->
this.neighborEntitiesRequestBuilderProvider
.get()
Expand All @@ -127,12 +111,44 @@
timeRange,
space,
neighborIds,
edgesByType.get(entityType)),
filters));
edgesSelectionsByType.get(entityType))));

Check warning on line 114 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L114

Added line #L114 was not covered by tests
}

private Single<Map<String, EdgeSetRequest>> getEntityTypeToEdgeSetRequest(
GraphQlRequestContext context, EdgeType edgeType, Set<SelectedField> edgeFields) {
return Observable.fromIterable(edgeFields)
.collect(Collectors.groupingBy(this::getEntityType, Collectors.toUnmodifiableSet()))
.flatMap(edgeFieldsMap -> this.getEdgeSetRequestMap(context, edgeType, edgeFieldsMap));

Check warning on line 121 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L119-L121

Added lines #L119 - L121 were not covered by tests
}

private Map<String, Set<SelectedField>> getEdgesByType(Stream<SelectedField> edgeSetStream) {
private Single<Map<String, EdgeSetRequest>> getEdgeSetRequestMap(
GraphQlRequestContext context,
EdgeType edgeType,
Map<String, Set<SelectedField>> entityTypeToEdgeFieldsMap) {
return Observable.fromIterable(entityTypeToEdgeFieldsMap.entrySet())
.flatMapSingle(

Check warning on line 129 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L128-L129

Added lines #L128 - L129 were not covered by tests
entry ->
this.getEdgeSetRequestEntry(context, edgeType, entry.getKey(), entry.getValue()))
.collect(Collectors.toUnmodifiableMap(Entry::getKey, Entry::getValue));

Check warning on line 132 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L131-L132

Added lines #L131 - L132 were not covered by tests
}

private Single<Map.Entry<String, EdgeSetRequest>> getEdgeSetRequestEntry(
GraphQlRequestContext context,
EdgeType edgeType,
String entityType,
Set<SelectedField> edgeFields) {
return zip(
this.getRequestedAndRequiredAttributes(context, edgeFields, edgeType),
this.getMetricAggregationRequestAttributes(context, edgeFields),
this.getFilterArguments(context, edgeFields),

Check warning on line 143 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L140-L143

Added lines #L140 - L143 were not covered by tests
(requestAttributes, metricAttributes, filters) ->
Map.entry(

Check warning on line 145 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L145

Added line #L145 was not covered by tests
entityType,
new DefaultEdgeSetRequest(requestAttributes, metricAttributes, filters)));
}

private Map<String, Set<SelectedField>> getEdgesSelectionByType(
Stream<SelectedField> edgeSetStream) {
return edgeSetStream.collect(
Collectors.groupingBy(
this::getEntityType,
Expand All @@ -155,11 +171,25 @@
.orElseThrow();
}

private Single<List<MetricAggregationRequest>> getMetricAggregationRequestAttributes(
GraphQlRequestContext context, Collection<SelectedField> edges) {
Set<SelectedField> selections =
edges.stream()
.collect(
Collectors.flatMapping(this::getEdgesForEdgeSet, Collectors.toUnmodifiableSet()));
return this.metricAggregationRequestBuilder.build(
context, HypertraceAttributeScopeString.INTERACTION, selections.stream());

Check warning on line 181 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L176-L181

Added lines #L176 - L181 were not covered by tests
}

private Single<List<AttributeRequest>> getRequestedAndRequiredAttributes(
GraphQlRequestContext context, Collection<SelectedField> edges, EdgeType edgeType) {
Set<SelectedField> selections =
edges.stream()
.collect(
Collectors.flatMapping(this::getEdgesForEdgeSet, Collectors.toUnmodifiableSet()));

Check warning on line 189 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L186-L189

Added lines #L186 - L189 were not covered by tests
return this.attributeRequestBuilder
.buildForAttributeQueryableFields(
context, HypertraceAttributeScopeString.INTERACTION, edges.stream())
context, HypertraceAttributeScopeString.INTERACTION, selections.stream())

Check warning on line 192 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L192

Added line #L192 was not covered by tests
.mergeWith(this.getNeighborIdAttribute(context, edgeType))
.mergeWith(this.getNeighborTypeAttribute(context, edgeType))
.collect(Collectors.toUnmodifiableList());
Expand All @@ -183,15 +213,21 @@
}
}

private List<FilterArgument> getFilters(Set<SelectedField> selectedFields) {
return selectedFields.stream()
.map(
selectedField ->
this.argumentDeserializer.deserializeObjectList(
selectedField.getArguments(), FilterArgument.class))
.flatMap(Optional::stream)
.flatMap(Collection::stream)
.collect(Collectors.toUnmodifiableList());
private Single<List<AttributeAssociation<FilterArgument>>> getFilterArguments(
GraphQlRequestContext context, Set<SelectedField> edgeFields) {
Set<FilterArgument> filterArguments =
edgeFields.stream()
.collect(Collectors.flatMapping(this::getFilter, Collectors.toUnmodifiableSet()));

Check warning on line 220 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L218-L220

Added lines #L218 - L220 were not covered by tests

return this.filterRequestBuilder.build(

Check warning on line 222 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L222

Added line #L222 was not covered by tests
context, HypertraceAttributeScopeString.INTERACTION, filterArguments);
}

private Stream<FilterArgument> getFilter(SelectedField selectedField) {
return this.argumentDeserializer
.deserializeObjectList(selectedField.getArguments(), FilterArgument.class)
.stream()
.flatMap(Collection::stream);

Check warning on line 230 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L227-L230

Added lines #L227 - L230 were not covered by tests
}

private Single<AttributeRequest> getNeighborTypeAttribute(
Expand Down Expand Up @@ -220,19 +256,39 @@
@Value
@Accessors(fluent = true)
private static class DefaultEdgeSetGroupRequest implements EdgeSetGroupRequest {

Set<String> entityTypes;
Collection<AttributeRequest> attributeRequests;
Collection<MetricAggregationRequest> metricAggregationRequests;
AttributeRequest neighborIdAttribute;
AttributeRequest neighborTypeAttribute;
Map<String, EdgeSetRequest> edgeSetRequests;

Check warning on line 261 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L261

Added line #L261 was not covered by tests
BiFunction<String, Collection<String>, Single<EntityRequest>> neighborRequestBuilder;
Collection<AttributeAssociation<FilterArgument>> filterArguments;

@Override
public Single<EntityRequest> buildNeighborRequest(
String entityType, Collection<String> neighborIds) {
return this.neighborRequestBuilder.apply(entityType, neighborIds);
}

@Override
public Collection<AttributeRequest> getAllAttributeRequests() {
return this.edgeSetRequests.values().stream()
.map(EdgeSetRequest::attributeRequests)
.flatMap(Collection::stream)
.collect(Collectors.toUnmodifiableSet());

Check warning on line 275 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L272-L275

Added lines #L272 - L275 were not covered by tests
}

@Override
public Collection<MetricAggregationRequest> getAllMetricAggregationRequests() {
return this.edgeSetRequests.values().stream()
.map(EdgeSetRequest::metricAggregationRequests)
.flatMap(Collection::stream)
.collect(Collectors.toUnmodifiableSet());

Check warning on line 283 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L280-L283

Added lines #L280 - L283 were not covered by tests
}
}

@Value
@Accessors(fluent = true)
private static class DefaultEdgeSetRequest implements EdgeSetRequest {
Collection<AttributeRequest> attributeRequests;
Collection<MetricAggregationRequest> metricAggregationRequests;
Collection<AttributeAssociation<FilterArgument>> filterArguments;

Check warning on line 292 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java#L290-L292

Added lines #L290 - L292 were not covered by tests
}
}
Loading