Skip to content

Commit 6b8e96c

Browse files
authored
fix: Revert mypy config (#3952)
* fetch_arrow_all returns empty table Signed-off-by: Chester Ong <[email protected]> * fix spark_kafka_processor typing errors Signed-off-by: Chester Ong <[email protected]> * fix correct return type Signed-off-by: Chester Ong <[email protected]> * revert _to_arrow_internal Signed-off-by: Chester Ong <[email protected]> * revert kafkaStreamProcessor changes, change base type instead Signed-off-by: Chester Ong <[email protected]> --------- Signed-off-by: Chester Ong <[email protected]>
1 parent dd79dbb commit 6b8e96c

4 files changed

Lines changed: 23 additions & 16 deletions

File tree

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ format-python:
310310
cd ${ROOT_DIR}/sdk/python; python -m black --target-version py38 feast tests
311311

312312
lint-python:
313-
cd ${ROOT_DIR}/sdk/python; python -m mypy --exclude=/tests/ --follow-imports=skip feast
313+
cd ${ROOT_DIR}/sdk/python; python -m mypy feast
314314
cd ${ROOT_DIR}/sdk/python; python -m isort feast/ tests/ --check-only
315315
cd ${ROOT_DIR}/sdk/python; python -m flake8 feast/ tests/
316316
cd ${ROOT_DIR}/sdk/python; python -m black --check feast tests

‎sdk/python/feast/infra/contrib/stream_processor.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from abc import ABC, abstractmethod
22
from types import MethodType
3-
from typing import TYPE_CHECKING, Optional
3+
from typing import TYPE_CHECKING, Any, Optional
44

55
from pyspark.sql import DataFrame
66
from typing_extensions import TypeAlias
@@ -51,7 +51,9 @@ def __init__(
5151
self.data_source = data_source
5252

5353
@abstractmethod
54-
def ingest_stream_feature_view(self, to: PushMode = PushMode.ONLINE) -> None:
54+
def ingest_stream_feature_view(
55+
self, to: PushMode = PushMode.ONLINE
56+
) -> Optional[Any]:
5557
"""
5658
Ingests data from the stream source attached to the stream feature view; transforms the data
5759
and then persists it to the online store and/or offline store, depending on the 'to' parameter.
@@ -75,7 +77,7 @@ def _construct_transformation_plan(self, table: StreamTable) -> StreamTable:
7577
raise NotImplementedError
7678

7779
@abstractmethod
78-
def _write_stream_data(self, table: StreamTable, to: PushMode) -> None:
80+
def _write_stream_data(self, table: StreamTable, to: PushMode) -> Optional[Any]:
7981
"""
8082
Launches a job to persist stream data to the online store and/or offline store, depending
8183
on the 'to' parameter, and returns a handle for the job.

‎sdk/python/feast/infra/offline_stores/contrib/postgres_offline_store/tests/data_source.py‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Dict, Optional
2+
from typing import Dict, Literal, Optional
33

44
import pandas as pd
55
import pytest
@@ -12,6 +12,7 @@
1212
PostgreSQLSource,
1313
)
1414
from feast.infra.utils.postgres.connection_utils import df_to_postgres_table
15+
from feast.infra.utils.postgres.postgres_config import PostgreSQLConfig
1516
from tests.integration.feature_repos.universal.data_source_creator import (
1617
DataSourceCreator,
1718
)
@@ -26,6 +27,10 @@
2627
POSTGRES_DB = "test"
2728

2829

30+
class PostgreSQLOnlineStoreConfig(PostgreSQLConfig):
31+
type: Literal["postgres"] = "postgres"
32+
33+
2934
@pytest.fixture(scope="session")
3035
def postgres_container():
3136
container = (
@@ -106,17 +111,17 @@ def create_offline_store_config(self) -> PostgreSQLOfflineStoreConfig:
106111
def get_prefixed_table_name(self, suffix: str) -> str:
107112
return f"{self.project_name}_{suffix}"
108113

109-
def create_online_store(self) -> Dict[str, str]:
114+
def create_online_store(self) -> PostgreSQLOnlineStoreConfig:
110115
assert self.container
111-
return {
112-
"type": "postgres",
113-
"host": "localhost",
114-
"port": self.container.get_exposed_port(5432),
115-
"database": POSTGRES_DB,
116-
"db_schema": "feature_store",
117-
"user": POSTGRES_USER,
118-
"password": POSTGRES_PASSWORD,
119-
}
116+
return PostgreSQLOnlineStoreConfig(
117+
type="postgres",
118+
host="localhost",
119+
port=self.container.get_exposed_port(5432),
120+
database=POSTGRES_DB,
121+
db_schema="feature_store",
122+
user=POSTGRES_USER,
123+
password=POSTGRES_PASSWORD,
124+
)
120125

121126
def create_saved_dataset_destination(self):
122127
# FIXME: ...

‎sdk/python/feast/infra/offline_stores/snowflake.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def _to_df_internal(self, timeout: Optional[int] = None) -> pd.DataFrame:
470470
def _to_arrow_internal(self, timeout: Optional[int] = None) -> pyarrow.Table:
471471
pa_table = execute_snowflake_statement(
472472
self.snowflake_conn, self.to_sql()
473-
).fetch_arrow_all()
473+
).fetch_arrow_all(force_return_table=False)
474474

475475
if pa_table:
476476
return pa_table

0 commit comments

Comments
 (0)