-
Notifications
You must be signed in to change notification settings - Fork 8
fix(explore): order by on eds attributes #127
base: main
Are you sure you want to change the base?
Changes from 9 commits
0a5e0c5
e3f5535
f9483a2
735f2b4
998534a
a5826ce
d9c4e9c
b4b2851
7c6a52b
4c5f357
9680686
53df6ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,12 +18,15 @@ | |
| import org.hypertrace.gateway.service.common.converters.EntityServiceAndGatewayServiceConverter; | ||
| import org.hypertrace.gateway.service.common.util.AttributeMetadataUtil; | ||
| import org.hypertrace.gateway.service.common.util.ExpressionReader; | ||
| import org.hypertrace.gateway.service.common.util.OrderByUtil; | ||
| import org.hypertrace.gateway.service.entity.config.EntityIdColumnsConfigs; | ||
| import org.hypertrace.gateway.service.explore.ExploreRequestContext; | ||
| import org.hypertrace.gateway.service.v1.common.OrderByExpression; | ||
| import org.hypertrace.gateway.service.v1.explore.ExploreRequest; | ||
|
|
||
| public class EntityServiceEntityFetcher { | ||
| private static final int DEFAULT_ENTITY_REQUEST_LIMIT = 10_000; | ||
|
|
||
| private final AttributeMetadataProvider attributeMetadataProvider; | ||
| private final EntityIdColumnsConfigs entityIdColumnsConfigs; | ||
| private final EntityQueryServiceClient entityQueryServiceClient; | ||
|
|
@@ -57,7 +60,20 @@ private EntityQueryRequest buildRequest( | |
|
|
||
| addGroupBys(exploreRequest, builder); | ||
| addSelections(requestContext, exploreRequest, builder); | ||
|
|
||
| // Ideally, needs the limit and offset for group by, since the fetcher is only triggered when | ||
| // there is a group by, or a single aggregation selection. A single aggregated selection would | ||
| // always return a single result (i.e. limit 1) | ||
| builder.setLimit(DEFAULT_ENTITY_REQUEST_LIMIT); | ||
|
|
||
| // TODO: Push group by down to EQS | ||
| // If there is a group by, specify a large limit and track actual limit, offset and order by | ||
| // expression list, so we can compute these once the we get the results. | ||
| if (requestContext.hasGroupBy()) { | ||
| // Will need to do the ordering, limit and offset ourselves after we get the group by results | ||
|
||
| requestContext.setOrderByExpressions(getRequestOrderByExpressions(exploreRequest)); | ||
| } | ||
|
|
||
| return builder.build(); | ||
| } | ||
|
|
||
|
|
@@ -126,4 +142,9 @@ private Filter.Builder buildFilter( | |
|
|
||
| return filterBuilder.addAllChildFilter(entityIdsInFilter); | ||
| } | ||
|
|
||
| private List<OrderByExpression> getRequestOrderByExpressions(ExploreRequest request) { | ||
| return OrderByUtil.matchOrderByExpressionsAliasToSelectionAlias( | ||
| request.getOrderByList(), request.getSelectionList(), request.getTimeAggregationList()); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.