Repository navigation
Conversation
…int-in-time join
The point_in_time_join used by get_historical_features on the DuckDB
offline store (and the contrib Oracle and MSSQL stores) broke in two ways
when an entity dataframe column shared its name with a requested feature:
- the left join that accumulates the feature tables renames the feature
side's clashing columns to "{name}_yyyy", and the final select of entity
columns + feature refs then failed with
"IbisInputError: Duplicate column name 'trips' in result set";
- two feature views contributing the same bare feature name
(full_feature_names=False) produced the same duplicate-column failure.
Select each side's columns explicitly instead of relying on the join's
name resolution, and deduplicate the accumulated feature columns. A
feature ref that clashes with an entity column wins, consistently with
the inner join above it (where the entity's clashing copy is not
selected); the shadowed entity column is not carried forward, so the
result can never contain duplicate column names.
Add regression tests: an entity column clashing with a feature name, the
full-feature-names variant where both columns come back, and feature
accumulation across multiple feature tables.
Signed-off-by: NUAAwqy <146524024+NUAAwqy@users.noreply.github.com>
There was a problem hiding this comment.
Devin Review found 3 potential issues.
5 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| shadowed = set(feature_refs) | ||
| entity_cols_out = [ | ||
| c for c in entity_columns if c != "entity_row_id" and c not in shadowed | ||
| ] |
There was a problem hiding this comment.
🔴 Duplicate columns after an earlier collision
When a feature replaces an entity column, point_in_time_join selects that feature twice on the next join with different names. Ibis rejects the duplicate, so historical retrieval returns no dataset.
Learn more
Historical retrieval processes feature views in order and builds one accumulated table. When a feature shadows an entity column, the accumulated table contains only the feature under that name, but entity_columns still records the original entity schema. On a later join with a different feature name, the projection selects the already-shadowed name as both an entity column and a carried feature. Ibis rejects duplicate names in a projection.
Example: Pass an entity dataframe with trips and request positions:trips followed by rates:conv_rate. The second join selects the feature trips twice instead of returning it alongside conv_rate.
Recommended fix: Exclude both current and previously added feature names from the entity projection. Add a regression test combining entity-column shadowing with a subsequent view that contributes a different name.
| shadowed = set(feature_refs) | |
| entity_cols_out = [ | |
| c for c in entity_columns if c != "entity_row_id" and c not in shadowed | |
| ] | |
| shadowed = set(feature_refs) | |
| entity_cols_out = [ | |
| c | |
| for c in entity_columns | |
| if c != "entity_row_id" and c not in shadowed and c not in all_feature_cols | |
| ] |
Was this helpful? React with 👍 or 👎 to provide feedback.
| current_new_cols = [ | ||
| c for c in dict.fromkeys(feature_refs) if c not in all_feature_cols | ||
| ] | ||
| # refs earlier feature tables contributed, except those the current | ||
| # table's refs shadow: already present in acc_table | ||
| carried_cols = [c for c in all_feature_cols if c not in shadowed] |
There was a problem hiding this comment.
🔴 Both same-name features disappear
When an on-demand dependency repeats another view’s bare feature name, point_in_time_join drops both copies. The final projection still requests that name, so historical retrieval fails.
Learn more
An on-demand feature view computes features from other inputs. Historical retrieval includes its source features in the provider request but checks for name collisions only among explicitly requested features. With bare names, a source feature can therefore collide with a feature from another view in the Ibis join. The repeated name is excluded from both projections, but the final projection still includes it.
Example: Request drivers:score and customer_rating:adjusted_score, where customer_rating reads customers:score. The explicit names pass validation, but the second join removes score and the final projection cannot find it.
Recommended fix: Resolve collisions using the full source reference before projecting feature names, or reject ambiguous dependency names with a clear collision error. Do not silently pick one view’s value when a transformation needs the other. Add a historical retrieval test with a colliding implicit dependency.
Was this helpful? React with 👍 or 👎 to provide feedback.
| *[acc_table[c] for c in entity_cols_out], | ||
| acc_table["entity_row_id"], | ||
| *[acc_table[c] for c in carried_cols], | ||
| *[feature_table[c] for c in current_new_cols], |
There was a problem hiding this comment.
🔴 Fetched values overwrite on-demand inputs
When a fetched feature shares a required request-data name, point_in_time_join replaces the supplied value. The on-demand transform then computes historical features from the fetched value instead.
Learn more
An on-demand feature view can declare a request input that the caller supplies in the entity dataframe. Historical retrieval verifies that this input exists before the join, but the join discards it if a fetched feature has the same output name. The Arrow retrieval job passes the joined table to the on-demand transform, which reads the fetched value under the request input’s name. For example, the existing conversion-rate transform reads val_to_add directly from its input table.
Example: Request that conversion-rate transform and a separate view’s bare val_to_add feature, with the colliding view joined last. If the entity dataframe supplies val_to_add=5 but the feature supplies 10, the transform adds 10 and returns a valid-looking incorrect value.
Recommended fix: Keep required request data separate from the final feature-name projection until on-demand transformations have run. If the transform input schema cannot distinguish the sources, reject the collision before retrieval instead of substituting a value.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7207 +/- ##
=======================================
Coverage 53.67% 53.67%
=======================================
Files 462 462
Lines 58549 58554 +5
Branches 8634 8634
=======================================
+ Hits 31424 31429 +5
Misses 24988 24988
Partials 2137 2137
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
franciscojavierarceo
left a comment
There was a problem hiding this comment.
we need to fix the existing repeated entity/feature projection and same-name feature removal findings. the current projection still selects an earlier shadowed feature twice on a later join, and removes both copies of a name requested from successive views. we also need to repair the duplicate regression test and the resulting lint failure.
| assert rows == {1: (5, 20.0), 2: (6, 30.0)} | ||
|
|
||
|
|
||
| def test_point_in_time_join_full_feature_names_no_collision_with_entity_columns(): |
There was a problem hiding this comment.
this repeats the function defined at line 335, so Python replaces that test before pytest collects it. CI fails with F811, and the earlier case asks for positions__trips from a table that only has trips. we need to remove the invalid duplicate, retain the case with the renamed source column, and commit the formatter changes reported by the same job.
Summary
get_historical_featureson the DuckDB offline store (and the contrib Oracle and MSSQL stores) crashes withIbisInputError: Duplicate column name 'trips' in result setwhen an entity dataframe column shares its name with a requested feature — or when two feature views contribute the same bare feature name (full_feature_names=False).Reproduction
Entity dataframe with a request column
tripsand a feature view whose feature is also namedtrips:fails with
IbisInputError: Duplicate column name 'trips' in result setinsidepoint_in_time_join.Root cause
The left join that accumulates the feature tables renames the feature side's clashing columns to
{name}_yyyy. The finalselectof entity columns + feature refs then asks for the feature's plain name, which no longer exists — and for the entity's plain name, which now collides with nothing but was already selected.Fix
Select each side's columns explicitly in the accumulating left join instead of relying on the join's name resolution:
Testing
New unit tests in
test_ibis.py:test_point_in_time_join_with_entity_column_clashing_with_a_feature_name— the collision no longer crashes; the feature's point-in-time value wins and shadows the entity column (fails onmasterwith theIbisInputError);test_point_in_time_join_full_feature_names_no_collision_with_entity_columns— with full feature names both the entity column and the prefixed feature come back;test_point_in_time_join_accumulates_features_from_multiple_tables— features accumulated from earlier tables survive later joins.All 16 tests in
test_ibis.pypass, including #7166'sts_y/pos_ycases.Signed-off-by: NUAAwqy 146524024+NUAAwqy@users.noreply.github.com