in scala-spark-sdk/src/main/scala/software/amazon/sagemaker/featurestore/sparksdk/helpers/FeatureGroupHelper.scala [47:101]
def checkAndParseTargetStore(
describeResponse: DescribeFeatureGroupResponse,
targetStores: List[String]
): List[TargetStore] = {
// Skip the check if target store is null, then use default approach for ingestion based on
// the configuration of feature group
if (targetStores == null) {
return null
}
val parsedStores = targetStores
.map(store =>
if (TargetStore.fromValue(store) == null) TargetStore.UNKNOWN_TO_SDK_VERSION
else TargetStore.fromValue(store)
)
.toSet
if (parsedStores.contains(TargetStore.UNKNOWN_TO_SDK_VERSION)) {
throw ValidationError(
s"Found unknown target store, the valid values are [${TargetStore.knownValues().toArray.mkString(", ")}]."
)
}
if (parsedStores.size != targetStores.size) {
throw ValidationError(s"Found duplicate target store, please remove duplicate value and try again.")
}
if (parsedStores.isEmpty) {
throw ValidationError(
"Target stores cannot be empty, please provide at least one target store or leave it unspecified."
)
}
val invalidTargetStoresList = new ListBuffer[TargetStore]()
// Online store is specified as target store however online store is not enabled
if (parsedStores.contains(TargetStore.ONLINE_STORE) && !isFeatureGroupOnlineStoreEnabled(describeResponse)) {
invalidTargetStoresList += TargetStore.ONLINE_STORE
}
// Offline store is specified as target store however offline store is not enabled
if (parsedStores.contains(TargetStore.OFFLINE_STORE) && !isFeatureGroupOfflineStoreEnabled(describeResponse)) {
invalidTargetStoresList += TargetStore.OFFLINE_STORE
}
if (invalidTargetStoresList.nonEmpty) {
throw ValidationError(
s"[${invalidTargetStoresList.mkString(",")}] of FeatureGroup: '${describeResponse.featureGroupName()}' are not enabled, however they are specified in target store."
)
}
parsedStores.toList
}