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

fix: Feature logging to Redshift is broken #2655

Merged
merged 2 commits into from
May 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions sdk/python/feast/feature_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,11 @@ def get_schema(self, registry: "Registry") -> pa.Schema:
fields: Dict[str, pa.DataType] = {}

for projection in self._feature_service.feature_view_projections:
for feature in projection.features:
fields[
f"{projection.name_to_use()}__{feature.name}"
] = FEAST_TYPE_TO_ARROW_TYPE[feature.dtype]
fields[
f"{projection.name_to_use()}__{feature.name}__timestamp"
] = PA_TIMESTAMP_TYPE
fields[
f"{projection.name_to_use()}__{feature.name}__status"
] = pa.int32()

# The order of fields in the generated schema should match
# the order created on the other side (inside Go logger).
# Otherwise, some offline stores might not accept parquet files (produced by Go).
# Go code can be found here:
# https://github.com/feast-dev/feast/blob/master/go/internal/feast/server/logging/memorybuffer.go#L51
try:
feature_view = registry.get_feature_view(projection.name, self._project)
except FeatureViewNotFoundException:
Expand Down Expand Up @@ -91,9 +85,21 @@ def get_schema(self, registry: "Registry") -> pa.Schema:
from_value_type(entity.value_type)
]

for feature in projection.features:
fields[
f"{projection.name_to_use()}__{feature.name}"
] = FEAST_TYPE_TO_ARROW_TYPE[feature.dtype]
fields[
f"{projection.name_to_use()}__{feature.name}__timestamp"
] = PA_TIMESTAMP_TYPE
fields[
f"{projection.name_to_use()}__{feature.name}__status"
] = pa.int32()

# system columns
fields[REQUEST_ID_FIELD] = pa.string()
fields[LOG_TIMESTAMP_FIELD] = pa.timestamp("us", tz=UTC)
fields[LOG_DATE_FIELD] = pa.date32()
fields[REQUEST_ID_FIELD] = pa.string()

return pa.schema(
[pa.field(name, data_type) for name, data_type in fields.items()]
Expand Down