/** * 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); } } }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + FEATUREID_FIELD_NUMBER; hash = (53 * hash) + getFeatureId().hashCode(); hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + type_; hash = (37 * hash) + LIMIT_FIELD_NUMBER; hash = (53 * hash) + getLimit(); 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.RequestDetail)) { return super.equals(obj); } feast.serving.ServingAPIProto.RequestDetail other = (feast.serving.ServingAPIProto.RequestDetail) obj; boolean result = true; result = result && getFeatureId() .equals(other.getFeatureId()); result = result && type_ == other.type_; result = result && (getLimit() == other.getLimit()); 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) + FEATUREID_FIELD_NUMBER; hash = (53 * hash) + getFeatureId().hashCode(); hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + type_; hash = (37 * hash) + LIMIT_FIELD_NUMBER; hash = (53 * hash) + getLimit(); 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) + FEATUREID_FIELD_NUMBER; hash = (53 * hash) + getFeatureId().hashCode(); hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + type_; hash = (37 * hash) + LIMIT_FIELD_NUMBER; hash = (53 * hash) + getLimit(); 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.RequestDetail)) { return super.equals(obj); } feast.serving.ServingAPIProto.RequestDetail other = (feast.serving.ServingAPIProto.RequestDetail) obj; boolean result = true; result = result && getFeatureId() .equals(other.getFeatureId()); result = result && type_ == other.type_; result = result && (getLimit() == other.getLimit()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * <pre> * feature ID to be included in the query. * feature ID is in the form of [entity_name].[granularity].[feature_name] * e.g: "driver.day.total_accepted_booking" * all requested feature ID shall have same entity name. * </pre> * * <code>string featureId = 1;</code> */ public Builder clearFeatureId() { featureId_ = getDefaultInstance().getFeatureId(); onChanged(); return this; } /**
/** * <pre> * feature ID to be included in the query. * feature ID is in the form of [entity_name].[granularity].[feature_name] * e.g: "driver.day.total_accepted_booking" * all requested feature ID shall have same entity name. * </pre> * * <code>string featureId = 1;</code> */ public Builder clearFeatureId() { featureId_ = getDefaultInstance().getFeatureId(); onChanged(); return this; } /**
public Builder mergeFrom(feast.serving.ServingAPIProto.RequestDetail other) { if (other == feast.serving.ServingAPIProto.RequestDetail.getDefaultInstance()) return this; if (!other.getFeatureId().isEmpty()) { featureId_ = other.featureId_; onChanged(); } if (other.type_ != 0) { setTypeValue(other.getTypeValue()); } if (other.getLimit() != 0) { setLimit(other.getLimit()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
public Builder mergeFrom(feast.serving.ServingAPIProto.RequestDetail other) { if (other == feast.serving.ServingAPIProto.RequestDetail.getDefaultInstance()) return this; if (!other.getFeatureId().isEmpty()) { featureId_ = other.featureId_; onChanged(); } if (other.type_ != 0) { setTypeValue(other.getTypeValue()); } if (other.getLimit() != 0) { setLimit(other.getLimit()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * <pre> * feature ID to be included in the query. * feature ID is in the form of [entity_name].[granularity].[feature_name] * e.g: "driver.day.total_accepted_booking" * all requested feature ID shall have same entity name. * </pre> * * <code>string featureId = 1;</code> */ public Builder clearFeatureId() { featureId_ = getDefaultInstance().getFeatureId(); onChanged(); return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof feast.serving.ServingAPIProto.RequestDetail)) { return super.equals(obj); } feast.serving.ServingAPIProto.RequestDetail other = (feast.serving.ServingAPIProto.RequestDetail) obj; boolean result = true; result = result && getFeatureId() .equals(other.getFeatureId()); result = result && type_ == other.type_; result = result && (getLimit() == other.getLimit()); result = result && unknownFields.equals(other.unknownFields); return result; }
public Builder mergeFrom(feast.serving.ServingAPIProto.RequestDetail other) { if (other == feast.serving.ServingAPIProto.RequestDetail.getDefaultInstance()) return this; if (!other.getFeatureId().isEmpty()) { featureId_ = other.featureId_; onChanged(); } if (other.type_ != 0) { setTypeValue(other.getTypeValue()); } if (other.getLimit() != 0) { setLimit(other.getLimit()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
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; }