/** * Attach request details with associated feature spec. * * @param request * @return */ private List<RequestDetailWithSpec> joinRequestDetailsWithFeatureSpec(Request request) { // dedup feature ID. Collection<String> featuresId = request .getRequestDetailsList() .stream() .map(RequestDetail::getFeatureId) .collect(Collectors.toSet()); Map<String, FeatureSpec> featureSpecMap = specStorage.getFeatureSpecs(featuresId); return request .getRequestDetailsList() .stream() .map(rd -> new RequestDetailWithSpec(rd, featureSpecMap.get(rd.getFeatureId()))) .collect(Collectors.toList()); } }
public static void validateRequest(Request request) { // entity name shall present if (Strings.isNullOrEmpty(request.getEntityName())) { throw new IllegalArgumentException("entity name must be set"); } // entity id list shall not be empty if (request.getEntityIdList().size() <= 0) { throw new IllegalArgumentException("entity ID must be provided"); } // request detail shall not be empty if (request.getRequestDetailsList().size() <= 0) { throw new IllegalArgumentException("request details must be provided"); } // feature id in each request detail shall have same entity name String entityName = request.getEntityName(); for (RequestDetail requestDetail : request.getRequestDetailsList()) { String featureId = requestDetail.getFeatureId(); if (!featureId.substring(0, featureId.indexOf(".")).equals(entityName)) { throw new IllegalArgumentException( "entity name of all feature ID in request details must be: " + entityName); } } }
private static List<String> makeFeatureTags(Request request) { List<String> tags = new ArrayList<>(request.getRequestDetailsCount()); for (RequestDetail requestDetail : request.getRequestDetailsList()) { String featureId = requestDetail.getFeatureId(); if (Strings.isNullOrEmpty(featureId)) { continue; } String featureTag = makeFeatureTag(featureId); tags.add(featureTag); } return tags; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ENTITYNAME_FIELD_NUMBER; hash = (53 * hash) + getEntityName().hashCode(); if (getEntityIdCount() > 0) { hash = (37 * hash) + ENTITYID_FIELD_NUMBER; hash = (53 * hash) + getEntityIdList().hashCode(); } if (getRequestDetailsCount() > 0) { hash = (37 * hash) + REQUESTDETAILS_FIELD_NUMBER; hash = (53 * hash) + getRequestDetailsList().hashCode(); } if (hasTimestampRange()) { hash = (37 * hash) + TIMESTAMPRANGE_FIELD_NUMBER; hash = (53 * hash) + getTimestampRange().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ENTITYNAME_FIELD_NUMBER; hash = (53 * hash) + getEntityName().hashCode(); if (getEntityIdCount() > 0) { hash = (37 * hash) + ENTITYID_FIELD_NUMBER; hash = (53 * hash) + getEntityIdList().hashCode(); } if (getRequestDetailsCount() > 0) { hash = (37 * hash) + REQUESTDETAILS_FIELD_NUMBER; hash = (53 * hash) + getRequestDetailsList().hashCode(); } if (hasTimestampRange()) { hash = (37 * hash) + TIMESTAMPRANGE_FIELD_NUMBER; hash = (53 * hash) + getTimestampRange().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof feast.serving.ServingAPIProto.QueryFeatures.Request)) { return super.equals(obj); } feast.serving.ServingAPIProto.QueryFeatures.Request other = (feast.serving.ServingAPIProto.QueryFeatures.Request) obj; boolean result = true; result = result && getEntityName() .equals(other.getEntityName()); result = result && getEntityIdList() .equals(other.getEntityIdList()); result = result && getRequestDetailsList() .equals(other.getRequestDetailsList()); result = result && (hasTimestampRange() == other.hasTimestampRange()); if (hasTimestampRange()) { result = result && getTimestampRange() .equals(other.getTimestampRange()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ENTITYNAME_FIELD_NUMBER; hash = (53 * hash) + getEntityName().hashCode(); if (getEntityIdCount() > 0) { hash = (37 * hash) + ENTITYID_FIELD_NUMBER; hash = (53 * hash) + getEntityIdList().hashCode(); } if (getRequestDetailsCount() > 0) { hash = (37 * hash) + REQUESTDETAILS_FIELD_NUMBER; hash = (53 * hash) + getRequestDetailsList().hashCode(); } if (hasTimestampRange()) { hash = (37 * hash) + TIMESTAMPRANGE_FIELD_NUMBER; hash = (53 * hash) + getTimestampRange().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof feast.serving.ServingAPIProto.QueryFeatures.Request)) { return super.equals(obj); } feast.serving.ServingAPIProto.QueryFeatures.Request other = (feast.serving.ServingAPIProto.QueryFeatures.Request) obj; boolean result = true; result = result && getEntityName() .equals(other.getEntityName()); result = result && getEntityIdList() .equals(other.getEntityIdList()); result = result && getRequestDetailsList() .equals(other.getRequestDetailsList()); result = result && (hasTimestampRange() == other.hasTimestampRange()); if (hasTimestampRange()) { result = result && getTimestampRange() .equals(other.getTimestampRange()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof feast.serving.ServingAPIProto.QueryFeatures.Request)) { return super.equals(obj); } feast.serving.ServingAPIProto.QueryFeatures.Request other = (feast.serving.ServingAPIProto.QueryFeatures.Request) obj; boolean result = true; result = result && getEntityName() .equals(other.getEntityName()); result = result && getEntityIdList() .equals(other.getEntityIdList()); result = result && getRequestDetailsList() .equals(other.getRequestDetailsList()); result = result && (hasTimestampRange() == other.hasTimestampRange()); if (hasTimestampRange()) { result = result && getTimestampRange() .equals(other.getTimestampRange()); } result = result && unknownFields.equals(other.unknownFields); return result; }