@@ -89,17 +89,23 @@ def __init__(self, offline_store_name: str, data_source_name: str):
8989
9090
9191class FeatureNameCollisionError (Exception ):
92- def __init__ (self , feature_refs_collisions : List [str ]):
93- collisions = [ref .split (":" , 1 ) for ref in feature_refs_collisions ]
94- collision_feature_views = [y for (y , _ ) in collisions ]
95- collision_feature_names = [x for (_ , x ) in collisions ]
96- feature_names = ", " .join (set (collision_feature_names ))
97- feature_views = ", " .join (set (collision_feature_views ))
92+ def __init__ (self , feature_refs_collisions : List [str ], full_feature_names ):
93+ if full_feature_names :
94+ collisions = [ref .replace (":" , "__" ) for ref in feature_refs_collisions ]
95+ error_message = (
96+ "To resolve this collision, please ensure that the features in question "
97+ "have different names."
98+ )
99+ else :
100+ collisions = [ref .split (":" )[1 ] for ref in feature_refs_collisions ]
101+ error_message = (
102+ "To resolve this collision, either use the full feature name by setting "
103+ "'full_feature_names=True', or ensure that the features in question have different names."
104+ )
105+
106+ feature_names = ", " .join (set (collisions ))
98107 super ().__init__ (
99- f"The following feature name(s) have collisions: { feature_names } . Set 'full_feature_names' "
100- f"argument in the data retrieval function to True to use the full feature name which is prefixed "
101- f"by the feature view name, or rename colliding features.\n Collisions occur in the following "
102- f"feature view(s): { feature_views } ."
108+ f"Duplicate features named { feature_names } found.\n { error_message } "
103109 )
104110
105111
0 commit comments