Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
fix | fix the context of EDS query while doing explore
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-bansal committed Dec 22, 2023
1 parent 235ff38 commit d0c2074
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static org.hypertrace.gateway.service.v1.common.Value convertToGatewayVal
String attributeName, Value value, Map<String, AttributeMetadata> attributeMetadataMap) {
AttributeMetadata attributeMetadata = attributeMetadataMap.get(attributeName);
if (null == attributeMetadata) {
LOG.debug("No attribute metadata found for {}", attributeName);
LOG.warn("No attribute metadata found for {}", attributeName);

Check warning on line 124 in gateway-service-impl/src/main/java/org/hypertrace/gateway/service/common/converters/EntityServiceAndGatewayServiceConverter.java

View check run for this annotation

Codecov / codecov/patch

gateway-service-impl/src/main/java/org/hypertrace/gateway/service/common/converters/EntityServiceAndGatewayServiceConverter.java#L124

Added line #L124 was not covered by tests
return convertQueryValueToGatewayValue(value);
}
return convertQueryValueToGatewayValue(value, attributeMetadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ QueryRequest buildQueryRequest(
Map<String, AttributeMetadata> attributeMetadataMap =
attributeMetadataProvider.getAttributesMetadata(requestContext, request.getContext());
if (hasOnlyAttributeSource(request.getFilter(), AttributeSource.EDS, attributeMetadataMap)) {
entityIds = getEntityIdsToFilter(requestContext, request, attributeMetadataMap);
entityIds = getEntityIdsToFilterFromSourceEDS(requestContext, request, attributeMetadataMap);
qsSourceFilter =
buildFilter(request.getFilter(), AttributeSource.QS, attributeMetadataMap)
.orElse(request.getFilter());
Expand Down Expand Up @@ -166,7 +166,7 @@ QueryRequest buildQueryRequest(
// This is to get all the entity Ids for the EDS source filter.
// 1. First filter out entity ids based on the time range from QS filter
// 2. Then filter out entity ids return in 1 based on EDS filter.
private List<String> getEntityIdsToFilter(
private List<String> getEntityIdsToFilterFromSourceEDS(
ExploreRequestContext context,
ExploreRequest exploreRequest,
Map<String, AttributeMetadata> attributeMetadataMap) {
Expand All @@ -181,11 +181,14 @@ private List<String> getEntityIdsToFilter(

Set<String> allEntityIds =
this.getEntityIdsInTimeRangeFromQueryService(context, exploreRequest);

ExploreRequest edsExploreRequest =
buildExploreRequest(context, exploreRequest.getContext(), maybeEdsFilter.orElseThrow());
ExploreRequestContext edsRequestExploreContext =
new ExploreRequestContext(context.getGrpcContext(), edsExploreRequest);
List<org.hypertrace.gateway.service.v1.common.Row> resultRows =
this.entityServiceEntityFetcher.getResults(context, edsExploreRequest, allEntityIds);

this.entityServiceEntityFetcher.getResults(
edsRequestExploreContext, edsExploreRequest, allEntityIds);
return resultRows.stream()
.map(row -> row.getColumnsMap().values().stream().findFirst())
.filter(Optional::isPresent)
Expand Down

0 comments on commit d0c2074

Please sign in to comment.