Skip to content
Merged
Changes from all 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 @@ -6,6 +6,7 @@
import static java.util.Objects.isNull;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toUnmodifiableList;
import static org.hypertrace.core.documentstore.expression.operators.RelationalOperator.EQ;
import static org.hypertrace.core.documentstore.expression.operators.RelationalOperator.IN;
import static org.hypertrace.core.documentstore.model.options.ReturnDocumentType.NONE;
import static org.hypertrace.entity.data.service.v1.AttributeValue.VALUE_LIST_FIELD_NUMBER;
Expand Down Expand Up @@ -45,6 +46,7 @@
import org.hypertrace.core.documentstore.SingleValueKey;
import org.hypertrace.core.documentstore.expression.impl.ConstantExpression;
import org.hypertrace.core.documentstore.expression.impl.IdentifierExpression;
import org.hypertrace.core.documentstore.expression.impl.LogicalExpression;
import org.hypertrace.core.documentstore.expression.impl.RelationalExpression;
import org.hypertrace.core.documentstore.model.options.UpdateOptions;
import org.hypertrace.core.documentstore.model.subdoc.SubDocumentUpdate;
Expand Down Expand Up @@ -342,7 +344,10 @@ public void update(EntityUpdateRequest request, StreamObserver<ResultSetChunk> r
// Finally, return the selections
List<Document> documents =
getProjectedDocuments(
request.getEntityIdsList(), request.getSelectionList(), requestContext);
maybeTenantId.get(),
request.getEntityIdsList(),
request.getSelectionList(),
requestContext);

responseObserver.onNext(
convertDocumentsToResultSetChunk(documents, request.getSelectionList()));
Expand Down Expand Up @@ -531,6 +536,7 @@ private JSONDocument convertToJsonDocument(LiteralConstant literalConstant) {
}

private List<Document> getProjectedDocuments(
final String tenantId,
final Iterable<String> entityIds,
final List<Expression> selectionList,
final RequestContext requestContext)
Expand All @@ -546,10 +552,16 @@ private List<Document> getProjectedDocuments(
final Filter filter =
Filter.builder()
.expression(
RelationalExpression.of(
IdentifierExpression.of(EntityServiceConstants.ENTITY_ID),
IN,
ConstantExpression.ofStrings(entityIdList)))
LogicalExpression.and(
List.of(
RelationalExpression.of(
IdentifierExpression.of(EntityServiceConstants.ENTITY_ID),
IN,
ConstantExpression.ofStrings(entityIdList)),
RelationalExpression.of(
IdentifierExpression.of(EntityServiceConstants.TENANT_ID),
EQ,
ConstantExpression.of(tenantId)))))
.build();

final org.hypertrace.core.documentstore.query.Query query =
Expand Down