Skip to content

Inconsistent logic with on_demand_feature_views #2072

Description

@MattDelac

Expected Behavior

We should be consistent across the repo about the default value of on_demand_feature_views. We also need to make our conditional statement more resilient as on_demand_feature_views is sometimes None and sometimes []

Current Behavior

The problem is that we often check if on_demand_feature_views is None but we sometimes set it's default value to an empty list

This has a huge impact as the RetrievalJob.to_arrow() method will use self._to_arrow_internal() or self._to_df_internal() depending on the on_demand_feature_views.

It makes it complicated to debug part of the codebase.

Steps to reproduce

Specifications

  • Version:
  • Platform:
  • Subsystem:

Possible Solution

Make the conditional statements more resilient

def had_on_demand_feature_views(on_demand_feature_views) -> bool:
    if on_demand_feature_views is None:
        return False
    if isinstance(on_demand_feature_views, list):
        if len(on_demand_feature_views) == 0:
            return False
    return True

if had_on_demand_feature_views(self.on_demand_feature_views):
    return features_df

instead of

if self.on_demand_feature_views is None:
    return features_df

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions