Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
passing data source proto to the offline server
Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
  • Loading branch information
dmartinol committed Oct 15, 2024
commit fb0a18fd4d431a26c86f0dbf94a28bbe26ff9e93
5 changes: 4 additions & 1 deletion sdk/python/feast/infra/offline_stores/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,11 @@ def get_table_column_names_and_types_from_data_source(
)

api_parameters = {
"data_source_name": data_source.name,
"data_source_proto": str(data_source),
}
logger.debug(
f"Calling {OfflineStore.get_table_column_names_and_types_from_data_source.__name__} with {api_parameters}"
)
table = _send_retrieve_remote(
api=OfflineStore.get_table_column_names_and_types_from_data_source.__name__,
api_parameters=api_parameters,
Expand Down
2 changes: 0 additions & 2 deletions sdk/python/feast/infra/passthrough_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,6 @@ def validate_data_source(
def get_table_column_names_and_types_from_data_source(
self, config: RepoConfig, data_source: DataSource
) -> Iterable[Tuple[str, str]]:
if isinstance(data_source, FileSource):
return data_source.get_table_column_names_and_types(config=config)
return self.offline_store.get_table_column_names_and_types_from_data_source(
config=config, data_source=data_source
)
36 changes: 17 additions & 19 deletions sdk/python/feast/offline_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import traceback
from datetime import datetime
from typing import Any, Dict, List, cast
from feast.protos.feast.core.DataSource_pb2 import DataSource as DataSourceProto

import pyarrow as pa
import pyarrow.flight as fl
from google.protobuf.json_format import MessageToDict, Parse

from feast import FeatureStore, FeatureView, utils
from feast.arrow_error_handler import arrow_server_error_handling_decorator
from feast.data_source import DataSource
from feast.errors import FeastObjectNotFoundException
from feast.feature_logging import FeatureServiceLoggingSource
from feast.feature_view import DUMMY_ENTITY_NAME
Expand Down Expand Up @@ -481,26 +484,21 @@ def validate_data_source(self, command: dict):
logger.debug(f"DataSource {data_source_name} not found, validation skipped")

def get_table_column_names_and_types_from_data_source(self, command: dict):
data_source_name = command["data_source_name"]
logger.info(f"Fetching table columns metadata for {data_source_name}")
try:
data_source = self.store.registry.get_data_source(
name=data_source_name, project=self.store.config.project
)
column_names_and_types = data_source.get_table_column_names_and_types(
self.store.config
)
data_source_proto_str = command["data_source_proto"]
logger.debug(f"Fetching table columns metadata from {data_source_proto_str}")
data_source_proto = DataSourceProto()
Parse(data_source_proto_str, data_source_proto)
data_source = DataSource.from_proto(data_source_proto)
logger.debug(f"Converted to DataSource {data_source}")

column_names_and_types = data_source.get_table_column_names_and_types(
self.store.config
)

column_names, types = zip(*column_names_and_types)
logger.debug(
f"DataSource {data_source_name} has columns {column_names} with types {types}"
)
except FeastObjectNotFoundException:
logger.debug(
f"DataSource {data_source_name} not found, returning empty columns and no types"
)
column_names = tuple()
types = tuple()
column_names, types = zip(*column_names_and_types)
logger.debug(
f"DataSource {data_source.name} has columns {column_names} with types {types}"
)
return pa.table({"name": column_names, "type": types})


Expand Down