Skip to content

fix: resolve entity-column and feature-name collisions in the ibis point-in-time join - #7207

Open
NUAAwqy wants to merge 1 commit into
feast-dev:masterfrom
NUAAwqy:fix/ibis-pitj-column-collisions
Open

NUAAwqy wants to merge 1 commit into
feast-dev:masterfrom
NUAAwqy:fix/ibis-pitj-column-collisions

Conversation

@NUAAwqy

@NUAAwqy NUAAwqy commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

get_historical_features on the DuckDB offline store (and the contrib Oracle and MSSQL stores) crashes with IbisInputError: Duplicate column name 'trips' in result set when 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 trips and a feature view whose feature is also named trips:

store.get_historical_features(
    entity_df=pd.DataFrame({
        "driver_id": [1, 1, 1],
        "event_timestamp": pd.to_datetime(["2024-01-01 10:00", "2024-01-02 10:00", "2024-01-03 10:00"]),
        "trips": [5, 6, 7],
    }),
    features=["trips_view:trips"],
)

fails with IbisInputError: Duplicate column name 'trips' in result set inside point_in_time_join.

Root cause

The left join that accumulates the feature tables renames the feature side's clashing columns to {name}_yyyy. The final select of 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:

  • feature refs are taken from their own table, so a rename can never hide them;
  • 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 columns;
  • feature columns are deduplicated across feature tables, so two feature views contributing the same bare feature name no longer crash either.

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 on master with the IbisInputError);
  • 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.py pass, including #7166's ts_y/pos_y cases.

Signed-off-by: NUAAwqy 146524024+NUAAwqy@users.noreply.github.com


Devin Review

…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>
@NUAAwqy
NUAAwqy requested a review from a team as a code owner November 21, 2026 16:10

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

5 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +561 to +564
shadowed = set(feature_refs)
entity_cols_out = [
c for c in entity_columns if c != "entity_row_id" and c not in shadowed
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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.

Suggested change
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
]

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +565 to +570
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]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +577 to +580
*[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],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@codecov-commenter

codecov-commenter commented Nov 21, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.67%. Comparing base (7e7208b) to head (27e174d).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@           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           
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 55.25% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/infra/offline_stores/ibis.py 70.68% <100.00%> (+0.64%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e7208b...27e174d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@franciscojavierarceo franciscojavierarceo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
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.

3 participants