MCPcopy Create free account
hub / github.com/feast-dev/feast / _merge

Function _merge

sdk/python/feast/infra/offline_stores/dask.py:1076–1103  ·  view source on GitHub ↗
(
    entity_df_with_features: dd.DataFrame,
    df_to_join: dd.DataFrame,
    join_keys: List[str],
)

Source from the content-addressed store, hash-verified

1074
1075
1076def _merge(
1077 entity_df_with_features: dd.DataFrame,
1078 df_to_join: dd.DataFrame,
1079 join_keys: List[str],
1080) -> dd.DataFrame:
1081 # tmp join keys needed for cross join with null join table view
1082 tmp_join_keys = []
1083 if not join_keys:
1084 entity_df_with_features["__tmp"] = 1
1085 df_to_join["__tmp"] = 1
1086 tmp_join_keys = ["__tmp"]
1087
1088 # Get only data with requested entities
1089 df_to_join = dd.merge(
1090 entity_df_with_features,
1091 df_to_join,
1092 left_on=join_keys or tmp_join_keys,
1093 right_on=join_keys or tmp_join_keys,
1094 suffixes=("", "__"),
1095 how="left",
1096 )
1097
1098 if tmp_join_keys:
1099 df_to_join = df_to_join.drop(tmp_join_keys, axis=1).persist()
1100 else:
1101 df_to_join = df_to_join.persist()
1102
1103 return df_to_join
1104
1105
1106def _normalize_timestamp(

Callers 1

Calls 1

persistMethod · 0.45

Tested by

no test coverage detected