Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODFV does not allow feast.ValueType.UNIX_TIMESTAMP in RequestDataSource schema #2053

Closed
ArrichM opened this issue Nov 17, 2021 · 0 comments · Fixed by #2167
Closed

ODFV does not allow feast.ValueType.UNIX_TIMESTAMP in RequestDataSource schema #2053

ArrichM opened this issue Nov 17, 2021 · 0 comments · Fixed by #2167
Assignees

Comments

@ArrichM
Copy link
Contributor

ArrichM commented Nov 17, 2021

Expected Behavior

When defining a field with ValueType.UNIX_TIMESTAMP in a RequestDataSource, the input will be a datetime64[ns] or datetime64[ns, tz] pd.Series.

Current Behavior

ValueType.UNIX_TIMESTAMP is translated to "datetime" which is not understood by the pd.Series constructor. Thus, infer_features fails if there are ValueType.UNIX_TIMESTAMP present in the RequestDataSource schema.

Steps to reproduce

While this will work:

import feast
import pandas as pd

date_request = feast.data_source.RequestDataSource(
    name="date_request",
    schema={"some_date": feast.ValueType.STRING},
)
@feast.on_demand_feature_view.on_demand_feature_view(
    inputs={
        "date_request": date_request,
    },
    features=[
        feast.Feature("output", feast.ValueType.STRING),
    ],
)
def test_view(features_df: pd.DataFrame) -> pd.DataFrame:
    data = pd.DataFrame()
    data["output"] = features_df["some_date"].astype("category")
    return data

test_view.infer_features()

This won't:

import feast
import pandas as pd

date_request = feast.data_source.RequestDataSource(
    name="date_request",
    schema={"some_date": feast.ValueType.UNIX_TIMESTAMP},  # <-- now a timestamp
)
@feast.on_demand_feature_view.on_demand_feature_view(
    inputs={
        "date_request": date_request,
    },
    features=[
        feast.Feature("output", feast.ValueType.STRING),
    ],
)
def test_view(features_df: pd.DataFrame) -> pd.DataFrame:
    data = pd.DataFrame()
    data["output"] = features_df["some_date"].astype("category")
    return data

test_view.infer_features()

Specifications

  • Version: 0.15.1
  • Platform: macOS
  • Subsystem: BigSur

Possible Solution

Change the dtype mapping of ValueType.UNIX_TIMESTAMP from "datetime" to "datetime64[ns]" locally for OnDemandFeatureView.infer_features() or in feast_value_type_to_pandas_type().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants