Skip to content

Commit 72982e3

Browse files
committed
Integ tests
1 parent f490693 commit 72982e3

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

sagemaker-mlops/src/sagemaker/mlops/feature_store/dataset_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def construct_feature_group_to_be_merged(
143143
raise RuntimeError(f"No metastore configured for FeatureGroup {fg.feature_group_name}.")
144144

145145
catalog_config = fg.offline_store_config.data_catalog_config
146-
disable_glue = catalog_config.disable_glue_table_creation or False
146+
disable_glue = getattr(catalog_config, "disable_glue_table_creation", False) or False
147147

148148
features = [fd.feature_name for fd in fg.feature_definitions]
149149
record_id = fg.record_identifier_feature_name

sagemaker-mlops/src/sagemaker/mlops/feature_store/feature_utils.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import boto3
1212
import pandas
1313
import pandas as pd
14-
from pandas import DataFrame, Series, read_csv\
15-
14+
from pandas import DataFrame, Series, read_csv
15+
from sagemaker.core.utils.utils import Unassigned
1616
from sagemaker.mlops.feature_store import FeatureGroup as CoreFeatureGroup, FeatureGroup
1717
from sagemaker.core.helper.session_helper import Session
1818
from sagemaker.core.s3.client import S3Uploader, S3Downloader
@@ -369,7 +369,7 @@ def create_athena_query(feature_group_name: str, session: Session):
369369
raise RuntimeError("No metastore is configured with this feature group.")
370370

371371
catalog_config = fg.offline_store_config.data_catalog_config
372-
disable_glue = catalog_config.disable_glue_table_creation or False
372+
disable_glue = getattr(catalog_config, "disable_glue_table_creation", False) or False
373373

374374
return AthenaQuery(
375375
catalog=catalog_config.catalog if disable_glue else "AwsDataCatalog",
@@ -451,7 +451,16 @@ def ingest_dataframe(
451451
raise ValueError("max_workers must be greater than 0.")
452452

453453
fg = CoreFeatureGroup.get(feature_group_name=feature_group_name)
454-
feature_definitions = {fd.feature_name: fd.feature_type for fd in fg.feature_definitions}
454+
feature_definitions = {}
455+
for fd in fg.feature_definitions:
456+
collection_type = getattr(fd, "collection_type", None)
457+
# Handle Unassigned, empty string, or None as None
458+
if isinstance(collection_type, Unassigned) or collection_type == "" or collection_type is None:
459+
collection_type = None
460+
feature_definitions[fd.feature_name] = {
461+
"FeatureType": fd.feature_type,
462+
"CollectionType": collection_type,
463+
}
455464

456465
manager = IngestionManagerPandas(
457466
feature_group_name=feature_group_name,

sagemaker-mlops/src/sagemaker/mlops/feature_store/ingestion_manager_pandas.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from sagemaker.core.resources import FeatureGroup as CoreFeatureGroup
1717
from sagemaker.core.shapes import FeatureValue
18+
from sagemaker.core.utils.utils import Unassigned
1819

1920
logger = logging.getLogger(__name__)
2021

@@ -293,7 +294,10 @@ def _is_feature_collection_type(
293294
"""Check if the feature is a collection type."""
294295
feature_def = feature_definitions.get(feature_name)
295296
if feature_def:
296-
return feature_def.get("CollectionType") is not None
297+
collection_type = feature_def.get("CollectionType")
298+
if isinstance(collection_type, Unassigned) or collection_type is None or collection_type == "":
299+
return False
300+
return True
297301
return False
298302

299303
@staticmethod

0 commit comments

Comments
 (0)