Skip to content

fix(mlops): generate valid DatasetBuilder SQL for String event times - #6442

Open
AkshayShah03 wants to merge 1 commit into
aws:masterfrom
AkshayShah03:fix/dataset-builder-query-generation
Open

AkshayShah03 wants to merge 1 commit into
aws:masterfrom
AkshayShah03:fix/dataset-builder-query-generation

Conversation

@AkshayShah03

Copy link
Copy Markdown

Issue #, if available: N/A

Description of changes:

This fixes two v3 regressions in DatasetBuilder query generation.

1. String event times are cast with from_unixtime. The casts compare the feature type against an enum:

cast_fn = "from_iso8601_timestamp" if event_time_feature.feature_type == FeatureTypeEnum.STRING else "from_unixtime"

FeatureDefinition is now a pydantic shape that stores feature_type as a plain str ("String"), so the comparison is always False. Every with_event_time_range(...) filter and point_in_time_accurate_join() condition wrapped ISO-8601 String event times in from_unixtime(), which Athena rejects for varchar. This is the common case for feature groups. The fix compares the normalized type value, via _is_string_feature_type, in the three places.

2. WHERE is_deletedAND .... The deleted-records CTE joined the event-time conditions without a leading space, so with_event_time_range() without as_of() produced invalid SQL. v2 started that clause with a newline. The fix adds the separator.

Testing:

  • New TestDatasetBuilderStringEventTimeQuery builds the query for String event times with a range and a PIT join. It asserts from_iso8601_timestamp(...) is used and that is_deletedAND doesn't appear. It fails before this change.
  • tests/unit/sagemaker/mlops/feature_store: 390 passed. The 28 feature_processor collection errors also happen on master.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Two v3 regressions in DatasetBuilder query generation:

- Event time casts compared feature_type to FeatureTypeEnum.STRING, but
  FeatureDefinition is now a pydantic shape that stores feature_type as a
  plain str ('String'), so the comparison was always False and every
  event-time range filter and point-in-time join wrapped ISO-8601 String
  event times in from_unixtime(), which Athena rejects for varchar. Compare
  the normalized type value instead.
- The deleted-records CTE joined event time conditions without a leading
  space, so with_event_time_range() without as_of() produced
  'WHERE is_deletedAND ...'. (v2 started the clause with a newline.)

This branch is waiting to be deployed

1 waiting deployment
manual-approval — 1cadb98d Waiting Oct 12, 2026 by AkshayShah03 via wait-for-approval #1996
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant