Skip to content

Commit a5b594f

Browse files
authored
fix | fix the query for fetching the updated document (#282)
1 parent 704f9fb commit a5b594f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

entity-service-impl/src/main/java/org/hypertrace/entity/query/service/EntityQueryServiceImpl.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import static java.util.Objects.isNull;
77
import static java.util.stream.Collectors.joining;
88
import static java.util.stream.Collectors.toUnmodifiableList;
9+
import static org.hypertrace.core.documentstore.expression.operators.RelationalOperator.EQ;
910
import static org.hypertrace.core.documentstore.expression.operators.RelationalOperator.IN;
1011
import static org.hypertrace.core.documentstore.model.options.ReturnDocumentType.NONE;
1112
import static org.hypertrace.entity.data.service.v1.AttributeValue.VALUE_LIST_FIELD_NUMBER;
@@ -342,7 +343,10 @@ public void update(EntityUpdateRequest request, StreamObserver<ResultSetChunk> r
342343
// Finally, return the selections
343344
List<Document> documents =
344345
getProjectedDocuments(
345-
request.getEntityIdsList(), request.getSelectionList(), requestContext);
346+
maybeTenantId.get(),
347+
request.getEntityIdsList(),
348+
request.getSelectionList(),
349+
requestContext);
346350

347351
responseObserver.onNext(
348352
convertDocumentsToResultSetChunk(documents, request.getSelectionList()));
@@ -531,6 +535,7 @@ private JSONDocument convertToJsonDocument(LiteralConstant literalConstant) {
531535
}
532536

533537
private List<Document> getProjectedDocuments(
538+
final String tenantId,
534539
final Iterable<String> entityIds,
535540
final List<Expression> selectionList,
536541
final RequestContext requestContext)
@@ -550,6 +555,11 @@ private List<Document> getProjectedDocuments(
550555
IdentifierExpression.of(EntityServiceConstants.ENTITY_ID),
551556
IN,
552557
ConstantExpression.ofStrings(entityIdList)))
558+
.expression(
559+
RelationalExpression.of(
560+
IdentifierExpression.of(EntityServiceConstants.TENANT_ID),
561+
EQ,
562+
ConstantExpression.of(tenantId)))
553563
.build();
554564

555565
final org.hypertrace.core.documentstore.query.Query query =

0 commit comments

Comments
 (0)