Repository: feast-dev/feast

Issue:
ODFV does not allow feast.ValueType.UNIX_TIMESTAMP in RequestDataSource schema
## 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:

``` python
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:

``` python
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().


Discussion:

Resolving patch:
diff --git a/sdk/python/feast/on_demand_feature_view.py b/sdk/python/feast/on_demand_feature_view.py
--- a/sdk/python/feast/on_demand_feature_view.py
+++ b/sdk/python/feast/on_demand_feature_view.py
@@ -259,7 +259,9 @@ def get_requested_odfvs(feature_refs, project, registry):
         return requested_on_demand_feature_views
 
 
-def on_demand_feature_view(features: List[Feature], inputs: Dict[str, FeatureView]):
+def on_demand_feature_view(
+    features: List[Feature], inputs: Dict[str, Union[FeatureView, RequestDataSource]]
+):
     """
     Declare an on-demand feature view
 
diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py
--- a/sdk/python/feast/type_map.py
+++ b/sdk/python/feast/type_map.py
@@ -97,7 +97,7 @@ def feast_value_type_to_pandas_type(value_type: ValueType) -> Any:
         ValueType.DOUBLE: "float",
         ValueType.BYTES: "bytes",
         ValueType.BOOL: "bool",
-        ValueType.UNIX_TIMESTAMP: "datetime",
+        ValueType.UNIX_TIMESTAMP: "datetime64[ns]",
     }
     if value_type.name.endswith("_LIST"):
         return "object"


Test patch:
diff --git a/sdk/python/tests/integration/registration/test_inference.py b/sdk/python/tests/integration/registration/test_inference.py
--- a/sdk/python/tests/integration/registration/test_inference.py
+++ b/sdk/python/tests/integration/registration/test_inference.py
@@ -1,12 +1,15 @@
+import pandas as pd
 import pytest
 
-from feast import Entity, RepoConfig, ValueType
+from feast import Entity, Feature, RepoConfig, ValueType
+from feast.data_source import RequestDataSource
 from feast.errors import RegistryInferenceFailure
 from feast.feature_view import FeatureView
 from feast.inference import (
     update_data_sources_with_inferred_event_timestamp_col,
     update_entities_with_inferred_types_from_feature_views,
 )
+from feast.on_demand_feature_view import on_demand_feature_view
 from tests.utils.data_source_utils import (
     prep_file_source,
     simple_bq_source_using_query_arg,
@@ -81,3 +84,21 @@ def test_update_data_sources_with_inferred_event_timestamp_col(simple_dataset_1)
             update_data_sources_with_inferred_event_timestamp_col(
                 [file_source], RepoConfig(provider="local", project="test")
             )
+
+
+def test_modify_feature_views_success():
+    # Create Feature Views
+    date_request = RequestDataSource(
+        name="date_request", schema={"some_date": ValueType.UNIX_TIMESTAMP}
+    )
+
+    @on_demand_feature_view(
+        inputs={"date_request": date_request},
+        features=[Feature("output", ValueType.UNIX_TIMESTAMP)],
+    )
+    def test_view(features_df: pd.DataFrame) -> pd.DataFrame:
+        data = pd.DataFrame()
+        data["output"] = features_df["some_date"]
+        return data
+
+    test_view.infer_features()